首页 > 其他 > 详细

QT学习之路--创建一个对话框

时间:2016-10-11 21:16:26      阅读:208      评论:0      收藏:0      [点我收藏+]

  Q_OBJECT:这是一个宏,凡是定义信号槽的类都必须声明这个宏.

  函数tr()全名是QObject::tr(),被他处理过的字符串可以使用工具提取出来翻译成其他语言,也就是做国际化使用。

对于QT学习之路:Qt学习之路(7):创建一个对话框(上)这个程序。编译出现

 invalid use of incomplete type ‘class QPushButton’
  findButton->setEnabled(!text.isEmpty());
            ^
In file included from /usr/include/qt5/QtWidgets/QDialog:1:0,
                 from finddialog.h:4,
                 from finddialog.cpp:3:
/usr/include/qt5/QtWidgets/qdialog.h:52:7: error: forward declaration of ‘class QPushButton’
 class QPushButton;


解决办法:  

1.he error should come from your .pro file since your are using Qt5 you should include:

QT += widgets

Change all instances of

#include <QtGui>

to

#include <QtWidgets>

 函数 tr()全名是
QObject::tr(),被它处理的字符串可以使用工具提取出来翻译成其他语言,也就是做国际化使用。

字符串中的&代表快捷键。

 

QT学习之路--创建一个对话框

原文:http://www.cnblogs.com/Caden-liu8888/p/5916390.html

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