欢迎来到天天文库
浏览记录
ID:6824317
大小:48.50 KB
页数:7页
时间:2018-01-27
《从qt4升级到qt5遇到的问题汇总及解决方法》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、从QT4升级到QT5遇到的问题汇总及解决方法PC部分:【改QTDIR变量】在工程根目录下找到.user文件, 如InnoTabPlugin.vcxproj.user修改指向你的QT5根目录: 2、$(Platform)'=='Template3、Win32'"> C:qtQt5.2.15.2.1msvc2010 或者找到这个文件Qt4VSPropertySheet.props,在里面修改:4、="UserMacros"> c:QtQt5.2.15.2.1msvc2010 【新增QtWidgets模块】相对于QT4, QT5的一个主要的基础架构修改是,将widget从QtGui模块剥离开来,新增QtWidgets模块,头文件包含“QtWidgets”。#include #include ......修改为:#include#include
2、$(Platform)'=='Template
3、Win32'"> C:qtQt5.2.15.2.1msvc2010
4、="UserMacros"> c:QtQt5.2.15.2.1msvc2010
5、......#include 修改为 #include ......#include 修改为 #include .pro文件中Qt += widgets【QApplication放入QtWidgets】#include 改成: #include 【新增QtWetKitWidgets模块】头文件包含要加QtWebKitWidgets目录.#include 6、/QWebFrame> 替换为: #include#include 替换为:#include.pro文件中Qt += webkitwidgets【QSortFilterProxyModel】#include 修改为: #include 【QDesktopServices::storageLocation系统目录问题】前使用Q7、DesktopServices::storageLocation(QDesktopServices::xxxx)来获取一些系统目录,现在则要改成QStandardPaths::writableLocation(QStandardPaths::xxxx)如:QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation); 可修改为:QString directory = QStandardPaths::writableLocation(QStandardPaths::DataLocati8、on); 而QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);修改为:QString location = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);【QHttp用QNetworkAccessManager代替】QHttp类已经被废弃,请用以下的类替换QNetworkAccessManagerQNetworkReplyQNetworkRequest (代替QHttpRequestHea9、der)m_pReply = m_httpManager.get(QNetworkRequest(url));connect(m_pReply, SIGNAL(readyRead()), this,SLOT(readyRead()));connect(m_pReply, SIGNAL(finished()),this, SLOT(finishDownload ()));connect(m_pReply, SI
6、/QWebFrame> 替换为: #include#include 替换为:#include.pro文件中Qt += webkitwidgets【QSortFilterProxyModel】#include 修改为: #include 【QDesktopServices::storageLocation系统目录问题】前使用Q
7、DesktopServices::storageLocation(QDesktopServices::xxxx)来获取一些系统目录,现在则要改成QStandardPaths::writableLocation(QStandardPaths::xxxx)如:QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation); 可修改为:QString directory = QStandardPaths::writableLocation(QStandardPaths::DataLocati
8、on); 而QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);修改为:QString location = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);【QHttp用QNetworkAccessManager代替】QHttp类已经被废弃,请用以下的类替换QNetworkAccessManagerQNetworkReplyQNetworkRequest (代替QHttpRequestHea
9、der)m_pReply = m_httpManager.get(QNetworkRequest(url));connect(m_pReply, SIGNAL(readyRead()), this,SLOT(readyRead()));connect(m_pReply, SIGNAL(finished()),this, SLOT(finishDownload ()));connect(m_pReply, SI
此文档下载收益归作者所有