码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-10-11 21:18:09      阅读:156      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!