qt4.8转qt5.4
1、头文件包含
#include <QtGui/QProgressBar>
#include <QtGui/QProgressDialog>
#include <QtGui/QMessageBox>
等类似包含QtGui的包含文件,全部将QtGui取消掉。即
#include <QProgressBar>
#include <QProgressDialog>
#include <QMessageBox>
2、Qt::WFlags 替换为Qt::WindowFlags
3、qInstallMsgHandler 函数废弃
可修改为: qInstallMessageHandler ,
MessageOutput 要多加一个参数 : QMessageLogContext& Context
void MessageOutput( QtMsgType type, const QMessageLogContext& Context, const QString &sMsg )
QtMsgHandler 改为 QtMessageHandler
4、QDesktopServices::storageLocation(QDesktopServices::xxxx) 来获取一些系统目录,
Qt5则要改成QStandardPaths::writableLocation(QStandardPaths::xxxx)。
5、error: 'UnicodeUTF8' is not a member of 'QApplication'
原因是:QCoreApplication::UnicodeUTF8已被弃用
解决方案如下:
修改
1
setText(QApplication::translate("MainWindow", "&Quitar", 0, QApplication::UnicodeUTF8));
为
1
setText(QApplication::translate("MainWindow", "&Quitar", 0);
6、toAscii() 和 fromAscii() 方法已经被舍弃
可以使用 fromLatin1() 和 toLatin1() 代替
7、nullptr启用,改用为NULL
8、QHBoxLayout启用,可更改为QFrame
9、构建时发生如下错误:
问题:error: undefined reference to `_imp__glClearColor@16'
解决办法:这是相关库文件没有链接,在 .pro 文件中加入 openGL相关库即可:
win32:LIBS += -lOpengl32 \
-lglu32 \
-lglut
最新文章
- 重构Mybatis与Spring集成的SqlSessionFactoryBean(2)
- 在SSIS中的不同组件间使用局部临时表
- 结构体类型定义(C语言)
- codeforces 381 D Alyona and a tree(倍增)(前缀数组)
- UISegment
- 产品设计敏感度之kindle touch 4
- 【Zookeeper学习】Zookeeper-3.4.6安装部署
- power desinger 学习笔记<;五>;
- Domain Shutdown Error(JBAS010850)
- 项目中出现黄色感叹号 教你去掉Myeclipse的黄色感叹号
- vue轮播组件及去掉路由#
- 单幅图像的深度学习,对NYU数据集进行划分
- vue实战记录(一)- vue实现购物车功能之前提准备
- 纯小白入手 vue3.0 CLI - 2.6 - 组件的复用
- Vue(三):vuex是什么
- PHP简单工厂模式、工厂方法模式和抽象工厂模式
- 异常来自 HRESULT:0x80070057 (E_INVALIDARG)
- bootstrap-treeview中文API 以及后台JSON数据处理
- RedHat yum源配置
- WPF进阶之接口(2):IDisposable,ICollectionView