错误:'class QApplication' has no member named 'setMainwidget'
错误:'class QApplication' has no member named 'setMainwidget'
转自:http://blog.csdn.net/chenqiai0/article/details/8648246
在学习 QT的过程中 遇到了一个问题
错误如下:
'class QApplication' has no member named 'setMainWidget'
在 类QApplication里面 没有找到 setMainWidget 成员...
原因是:
Qt 3.x支持setMainWidget,但是Qt4已经取消了对setMainWidget的支持。
以下是一个QT3程序
#include<qapplication.h>
#include<qpushbutton.h>
int main( int argc, char*argv[])
{
QApplicationa( argc, argv );
QPushButtonhello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
returna.exec();
}
*********************************
a.setMainWidget(&hello );
这个按钮被选为这个应用程序的主窗口部件。如果用户关闭了主窗口部件,应用程序就退出了。你不用必须设置一个主窗口部件,但绝大多数程序都有一个。
修改之后的QT4程序
#include<QApplication>
#include<QPushButton>
int main( int argc, char* argv[])
{
QApplication app(argc, argv );
QPushButton*hello = new QPushButton( "Hello world!", 0 );
hello-> resize( 100, 30 );
hello-> show();
return app.exec();
}
错误:'class QApplication' has no member named 'setMainwidget'的更多相关文章
- 安装Stomp扩展时错误提示error: 'zend_class_entry' has no member named 'default_properties'
在安装stomp扩展时, 有这样的提示 error: 'zend_class_entry' has no member named 'default_properties' 交待下安装上下文, sto ...
- 【Linux】解决"no member named 'max_align_t'
编译遇到错误: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.1/../../../../include/c++/5.4.1/cstddef:51:11: erro ...
- ushare编译之 ‘struct sockaddr_storage’ has no member named ‘s_addr’
编译ushare的时候出现'struct sockaddr_storage' has no member named 's_addr' 这是使用libupnp1.6.19出现版本号不兼容的错误. 解决 ...
- CAFFE(FAQ.2):Ubuntu 配置caffe 框架之数据库读取,错误解决:ImportError: No module named leveldb解决办法
Z: 在安装了caffe框架后需要读取大量的数据进行学习训练.比如在MNIST识别训练中,一般直接读图片会比较耗时,我们一般将图片转存为数据库中.目前主流的数据库有以下两种选择: LevelDB Lm ...
- 利用virtualenvwrapper创建虚拟环境出现错误“/usr/bin/python: No module named virtualenvwrapper”
Linux:CentOS7 python: 系统默认python版本2.7,利用python启动 自己安装python版本3.8,利用python3启动 问题描述: 在上述环境中利用virtualen ...
- django之异常错误2(Error was: No module named sqlite3.base)
具体错误代码为: C:\djangoweb\helloworld>manage.py syncdbTraceback (most recent call last): File "C ...
- ubuntu16安装pylearn2 出现错误提示importerror:no module named six.moves
由于市面上的一些教程时间比较早,入门学习时跟随教程安装容易出现各种错误,这些错误基本都是版本不同导致的 所以,我们安装过程中一定要指出包的版本,如果你已经遇到no module named six.m ...
- Spark wordcount 编译错误 -- reduceByKey is not a member of RDD
Attempting to run http://spark.apache.org/docs/latest/quick-start.html#a-standalone-app-in-scala fro ...
- laravel和lumen数据库链接错误_FatalErrorException Call to a member function connection
FatalErrorException in Model.php line 3339: Call to a member function connection() on null 挺简单的一个lum ...
随机推荐
- SPOJ8222 NSUBSTR - Substrings
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...
- Oracle中 如何用一个表的数据更新另一个表中的数据
准备阶段 1.建表语句: create table table1( idd varchar2(10) , val varchar2(20) ); create table table2( idd va ...
- python中如何剔除字符串
问题: 过滤用户输入中前后多余的空白字符 ‘ ++++abc123--- ‘ 过滤某windows下编辑文本中的’\r’: ‘hello world \r\n’ 去掉文本中unicode组 ...
- WPF 回车转Tab实现跳转
1.重写窗体的KeyDown事件 protected override void OnKeyDown(KeyEventArgs e) { if (e.Key == Key.Enter) { // Mo ...
- SVN更新操作提示需要清理操作,清理操作提示乱码,更新SVN失败
1.下载sqlite3.exe,下载方式如下: 1):sqlite网址:https://www.sqlite.org/download.html (根据操作系统自行下载) 2.下载的文件解压后将sql ...
- 最近玩了一下qt5.2.1,顺着写点东西,关于这个版本设置程序主窗口居中
#include <QtGui/QGuiApplication> #include <QDebug> #include <QScreen> #include &qu ...
- BOM-event事件
添加事件监听 <button id="btnShoot">shoot</button><br> <button id="btnA ...
- oracle数据库简单的导入导出操作
一.数据库导出 1.导出用户名/密码,,导出用户名为test_expdp.导出路径默认为oracle中的dpdump文件中 expdp test_expdp/test_expdp@orcl direc ...
- web前端看IE11的变化
一.User-agent的变化 IE11的User-agent Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko IE10的U ...
- Java复习8.多线程
Java复习8 多线程知识 20131007 前言: 在Java中本身就是支持多线程程序的,而不是像C++那样,对于多线程的程序,需要调用操作系统的API 接口去实现多线程的程序,而Java是支持多线 ...