項目qt4遷移代碼到qt5
阿新 • • 發佈:2018-11-22
技術分享 box use set dial font qt5 val get
並需要在pro文件裏加上
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
並將引用的#include <QtGui>替換為#include <QtWidgets>
C++ GUI Programming with Qt 4上一段代碼,編譯不能通過:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
finddialog.cpp: In constructor ‘FindDialog::FindDialog(QWidget*)‘:
finddialog.cpp:5:38: error: invalid use of incomplete type ‘class QLabel‘ |
在Qt官網wiki找到了答案:http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5
Change all instances of
1 | #include <QtGui> |
to
1 | #include <QtWidgets> |
項目qt4遷移代碼到qt5