Kdelibs Coding Style vs. preparations for Qt5

Friedrich W. H. Kossebau kossebau at kde.org
Sat Dec 29 01:47:13 GMT 2012


Hi,

what about adapting the Kdelibs Coding Style to the upcoming preparations for 
the porting to Qt5? A lot of (KDE) projects follow that kdelibs one, but there 
is (at least?) one rule which seems to conflict with the recommendations for 
the preparations:

--- 8< ---
Qt Includes 

If you add #includes for Qt classes, use both the module and class name. This 
allows library code to be used by applications without excessive compiler 
include paths. 

Example: 
// wrong
#include <QString>
 
// correct
#include <QtCore/QString>
--- 8< ---
>From http://techbase.kde.org/Policies/Kdelibs_Coding_Style#Qt_Includes


Of course the current Qt Coding Style, which is the base of the kdelibs one, 
does not mention anything about that, given that its about their own headers.


Now the Porting from Qt 4 to Qt 5 guide from KDAB recommends this:
--- 8< ---
Fixing up includes

[...]

Or more portably (Which works in Qt 4 and Qt 5):
#include <QWidget>
--- 8< ---
>From http://www.kdab.com/porting-from-qt-4-to-qt-5/


So what to do about this?

Will kde-frameworks be Qt5-only, so not need to support both Qt4 and Qt5 and 
thus to use module-less Qt includes? Or will the includes be if-def'ed?
So will projects which refer to the Kdelibs Coding Style need to add an 
exception to their rules for the includes, if they want to prepare for Qt5?

Or does the rule need adaption?

Cheers
Friedrich




More information about the kde-core-devel mailing list