首页 > 其他 > 详细

Qt4程序转向Qt5

时间:2015-05-09 11:52:32      阅读:281      评论:0      收藏:0      [点我收藏+]

C++ GUI Programming with Qt 4上一段代码,编译不能通过:

问题一:编译按钮为灰色,compile output提示找不到  .pro文件,

           原因是有中文路径问题,导致不能识别.pro文件,全部用英文路径即可。

问题二:

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‘
In file included from finddialog . cpp : 2 : 0 :
finddialog . h : 7 : 7 : error : forward declaration of ‘class QLabel‘
finddialog . cpp : 6 : 17 : error : invalid use of incomplete type ‘class QLineEdit‘
In file included from finddialog . cpp : 2 : 0 :
finddialog . h : 8 : 7 : error : forward declaration of ‘class QLineEdit‘
finddialog . cpp : 7 : 7 : error : invalid use of incomplete type ‘class QLabel‘
In file included from finddialog . cpp : 2 : 0 :
finddialog . h : 7 : 7 : error : forward declaration of ‘class QLabel‘
finddialog . cpp : 8 : 48 : error : invalid use of incomplete type ‘class QCheckBox‘
In file included from finddialog . cpp : 2 : 0 :
finddialog . h : 6 : 7 : error : forward declaration of ‘class QCheckBox‘
finddialog . cpp : 9 : 57 : error : invalid use of incomplete type ‘class QCheckBox‘
In file included from finddialog . cpp : 2 : 0 :
finddialog . h : 6 : 7 : error : forward declaration of ‘class QCheckBox‘
finddialog . cpp : 10 : 42 : error : invalid use of incomplete type ‘class QPushButton‘

在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

原文:http://my.oschina.net/u/1772925/blog/412519

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!