[Marble-devel] Review Request 113392: Support for Qt5

Dennis Nienhüser earthwings at gentoo.org
Tue Oct 22 18:11:12 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/113392/
-----------------------------------------------------------

Review request for Marble.


Repository: marble


Description
-------

Merge request for the qt5 branch which adds support for compiling against Qt5 (using Qt4 still possible). Kudos to Michael Zanetti who did most of the work.

The first patch here is an excerpt of some files to show the approach done for porting without information overload by thousands of lines of a diff. The second and possibly following patches are the full diff.

1) cmake changes (cf. src/lib/CMakeLists.txt)
Qt4 used one Qt4 cmake module, QT_QT${COMPONENT}_LIBRARY style variables, and qt4_ prefixed commands. Qt5 has been split up into several modules, uses Qt5${Component}_LIBRARIES style variables, and qt5_ prefixed commands. Based on whichever Qt version is found (Qt4 is preferred over Qt5), the necessary include directories are added and link targets set up. Three qt_ macros are introduced to make it easier to call qt4_/qt5_ commands often used.

2) API changes (cf. src/lib/MapWizard.cpp)
A small number of classes has API changes, e.g. QUrl. Checks like
#if QT_VERSION < 0x050000
are introduced to distinguish between the Qt4 and Qt5 counterparts. This can't be avoided really, but fortunately the amount of changes is not too high.

3) Renamed classes (cf. src/lib/AbstractDataPlugin.{h,cpp})
To minimize the number of ifdefs introduced, the patch adds typedefs for renamed classes. typedefs are never introduced in headers to avoid spoiling someone else's code. In cpp files the old (Qt4) class name is typedefed to the new (Qt5) one.

4) new virtual methods (cf. src/lib/AbstractDataPluginModel.cpp)
Actually I'm only aware of QAbstractItemModel::roleNames() here. In Qt4 this method was not virtual, and a protected method setRoleNames() was there to do changes. In Qt5 setRoleNames() is deprecated and roleNames() is virtual. To avoid using the now deprecated setRoleNames the patch introduces a roleNames() overload in the Qt5 version only.


Diffs
-----

  src/lib/AbstractDataPlugin.h fc4829a 
  src/lib/AbstractDataPlugin.cpp 70b24c2 
  src/lib/AbstractDataPluginModel.cpp 6504941 
  src/lib/CMakeLists.txt 4f2eee1 
  src/lib/MapWizard.cpp 63eca5d 

Diff: http://git.reviewboard.kde.org/r/113392/diff/


Testing
-------

Note: Do not apply patch 1, just patch 2 or any later (see description).

Both Qt4 and Qt5 version compile and run fine here. If both are installed, cmake will pick up Qt4. Pass -DQT5BUILD=TRUE to cmake to override that.


Thanks,

Dennis Nienhüser

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20131022/938befed/attachment.html>


More information about the Marble-devel mailing list