Qt 4.6

Christoph Feck christoph at maxiom.de
Wed Jun 10 13:37:53 BST 2009


Hi,

a recent change in Qt 4.6 adds #include <QMetaType> to all generated .moc 
files in order to handle different floating point datatypes.

Many KDE files add #include "file.moc" at the end of the .cpp file. The 
problem is with .cpp files that include X11 headers, where Bool is defined as 
a preprocessor macro.

Compiling KDE with current Qt 4.6 results in the error

	#error qmetatype.h must be included before any header file that defines Bool

The problem occurs (if I counted correctly), with two files in kdelibs, and 
four files in kdebase.

Maybe I am the only one that uses KDE with the Qt from master branch, but my 
question is, if I should commit the fixes to current trunk to get them into 
KDE 4.3. What I currently do is to add something like this:

+#if defined Q_WS_X11
+    #undef Bool
+#endif
+
 #include "kmodifierkeyinfo.moc"

Another option would be to force including <QMetaType> before the X11 headers, 
but I am not sure which solution is cleaner.

I can also wait with the commits after we branched for KDE 4.4, if there is a 
problem with those commits.

Please comment :)

Christoph Feck (kdepepo)




More information about the kde-core-devel mailing list