Migration from 4.8 to 5.2 version of Qt library
-
Could you please advise how to correctly migrate from 4.8 to 5.2 version of Qt library.
Are there any instructions or advices?Now I use 4.8 Qt library and Qt Creator and Visual Studio like IDEs.
-
Sure, there is an official "porting guide":http://qt-project.org/doc/qt-5/portingguide.html. For most projects, the required changes are minimal.
Plus, somebody put together "this nice wiki":http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5.
-
Thank you!
I go to read them. -
Oh, it is not easy....
My project files are build using cmake and qmake.
And I have to change a lot of build scripts.Now I've met the following issue:
How to correctly define "find_package" for the cmake?correct lines for Qt4:
@
find_package(Subversion REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem)
find_package(Boost REQUIRED COMPONENTS system thread)
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtNetwork QtXml)
find_package(Qt4 REQUIRED COMPONENTS ${QT_LIBRARIES})
@ -
I am not using cmake myself, so I don't know the answer here.
But cmake support is actively maintained, so there definitely is a way. If you don't get an answer here, you can try asking on IRC.
-
Could you please advise what is about "include <Qt/qt_windows.h>".
In the Qt5 "Qt" directory is not existed. There is only QtCore/qt_windows.h file. Can I change <Qt/qt_windows.h> to <QtCore/qt_windows.h>? -
Could you please advise what is problem in the "5.2.1\msvc2010\include\qtcore\qdatetime.h"?
Visual Studio shows error at the 122 line:
error C2589: '(' : illegal token on right side of '::' c:\qt\5.2.1\5.2.1\msvc2010\include\qtcore\qdatetime.h 122 -
Hi, just a guess, but try to add
@DEFINES += NOMINMAX@
in your .pro file.(From "this thread:":http://qt-project.org/forums/viewthread/22133 )
-
Thank you, hskoglund. I've done it already. It helped me.
But I've met next problem - using QNetworkRequest and QUrl.
Some code:
@
QNetworkRequest request = // request() from the QNetworkReply
QUrl url = request.url();
QList< QPair<QString, QString> > query = url.queryItems();
@
But QUrl doesn't have queryItems() method.
Also I need missed methods in the Qt5 QUrl:
addQueryItem()
encodedQuery()
setQueryItems()P.S.:
In the topic http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5
there is good phrase "The transition from Qt 4.x to Qt 5 is not expected to be significant"I'm doing this transition during about 3 days...
-
I vaguely recall a class named QUrlQuery being introduced in Qt 5... Check it out. If it works but is not mentioned on the wiki, please add it. I can't do it myself right now.
-
[quote author="sierdzio" date="1395357241"]I vaguely recall a class named QUrlQuery being introduced in Qt 5... Check it out. If it works but is not mentioned on the wiki, please add it. I can't do it myself right now. [/quote]
I've used QUrlQuery also. More accurately QUrl plus QUrlQuery.
It's something like this:
@
QNetworkRequest request = // request() from the QNetworkReply
QUrl url = request.url();
//save query
QUrlQuery query = QUrlQuery(url);//some actions
//...//revert query
url.setQuery(query);
@It works good.
I will add some article with all not mentioned early issues are occurred during Qt4 to Qt5 transition.
Unfortunately there are a lot of them. -
Hi,
You could also add a bug on the "bug report system":http://bugreports.qt-project.org If you have found missing elements in the porting guide. That way the documentation can be improved and more users will see it.