Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

UnicodeUTF8 not member QApplication - generated with Qt5 Designer



  • So I upgraded to Qt5...I loaded my apps from QT4 and I fixed a # of issues like #includes to the Qt5 style. So it gets through most of files now without error. BUT, when it generates the UI headers, Qt actually generates the incorrect code like so:
    iHighlightButton->setText(QApplication::translate("DoubleGraphicView", "Highlight Items", 0, QApplication::UnicodeUTF8));
    iUnHighlightButton->setText(QApplication::translate("DoubleGraphicView", "Unhighlight Items", 0, QApplication::UnicodeUTF8));

    So why would Qt5 generate this which are deprecated values in Qt5...? Am I missing a setting?



  • A hack to get this working is to create a qt 5 application and then copy your projects source files to it.



  • Thanks...what I actually did was install the qt4 libraries/core and this seemed to get past this. But yes if you start with a fresh qt5 project your good to go.



  • QCoreApplication::UnicodeUTF8 is deprecated

    This enum type used to define the 8-bit encoding of character string arguments to translate(). This enum is now obsolete and UTF-8 will be used in all cases. So remove all instances of QCoreApplication::UnicodeUTF8. For example:

    Href_Gui->setWindowTitle(QApplication::translate("Href_Gui", "Url / www", 0, QApplication::UnicodeUTF8));
    label->setText(QApplication::translate("Href_Gui", "Text:", 0, QApplication::UnicodeUTF8));
    label_2->setText(QApplication::translate("Href_Gui", "Url:", 0, QApplication::UnicodeUTF8));
    label_3->setText(QApplication::translate("Href_Gui", "Target / Name:", 0, QApplication::UnicodeUTF8));
    

    to

    Href_Gui->setWindowTitle(QApplication::translate("Href_Gui", "Url / www", 0));
    label->setText(QApplication::translate("Href_Gui", "Text:", 0));
    label_2->setText(QApplication::translate("Href_Gui", "Url:", 0));
    label_3->setText(QApplication::translate("Href_Gui", "Target / Name:", 0));
    

    This solved my problem



  • Hi,

    This is an old post but i've the same problem (as described by snake8080). Is there any other/logical solution (without hacking anything) ?

    Thanks.



  • True. an old post; I found it since I had the same issue. In case someone still needs a solution: I had to manually delete the old intermediate files (moc_*, *.o) that were in the same directory as the source code, then run qmake (from QtCreater menu). Now solved.



  • True. an old post; I found it since I had the same issue. In case someone still needs a solution: I had to manually delete the old intermediate files (moc_*, *.o) that were in the same directory as the source code, then run qmake (from QtCreater menu). Now solved.


Log in to reply