zoukankan      html  css  js  c++  java
  • QT学习之路--创建一个对话框

      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(),被它处理的字符串可以使用工具提取出来翻译成其他语言,也就是做国际化使用。

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

  • 相关阅读:
    ZooKeeper的工作原理
    redis 数据类型详解 以及 redis适用场景场合
    nginx负载均衡原理
    Java中缓存的介绍
    Java中接口的作用
    json与xml的区别
    最经典40个多线程问题总结
    Java线程 : 线程同步与锁
    dbcp与c3p0的区别
    Linux常见命令
  • 原文地址:https://www.cnblogs.com/Caden-liu8888/p/5916390.html
Copyright © 2011-2022 走看看