1. 程式人生 > >Qt編譯錯誤: 'UnicodeUTF8' is not a member of 'QApplication'

Qt編譯錯誤: 'UnicodeUTF8' is not a member of 'QApplication'

--->編譯遇到類似錯誤:
error: QCalendarWidget: No such file or directory
error: QComboBox: No such file or directory
error: QDateEdit: No such file or directory
解決方案如下:
1.在*.pro檔案裡新增:
QT += widgets
2.修改
#include <QtGui/QCalendarWidget>
#include <QtGui/QComboBox>
#include <QtGui/QDateEdit>
 為
#include <QCalendarWidget>
#include <QComboBox>
#include <QDateEdit>


--->編譯遇到如下錯誤:
1
error: 'UnicodeUTF8' is not a member of 'QApplication'
原因是:QCoreApplication::UnicodeUTF8已被棄用
解決方案如下:
修改
1
setText(QApplication::translate("MainWindow", "&Quitar", 0, QApplication::UnicodeUTF8));
 為
1
setText(QApplication::translate("MainWindow", "&Quitar", 0);