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 
 

posted on   lydstory  阅读(236)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2018-03-20 nvidia 驱动下载地址
2018-03-20 dnn ubuntu 问题
2018-03-20 ubuntu登陆无限循环
2018-03-20 ubuntu 卡在登陆界面无法进入桌面,但是可以进入命令行界面
2018-03-20 ubuntu库文件路径pkgconfig
2018-03-20 python numpy
2018-03-20 【git使用】Failed to connect to 127.0.0.1 port 1080: Connection refused

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示