#include <Qt/someheader> not portable

Simon Hausmann hausmann at kde.org
Sat Feb 4 13:04:57 GMT 2006


On Saturday 04 February 2006 13:07, Thiago Macieira wrote:
> Thomas Braxton wrote:
> >> > wrong:
> >> > #include <Qt/qwidget.h>
> >> >
> >> > right:
> >> > #include <QtGui/QWidget>
> >> > #include <QWidget>
> >> > #include <QtGui/qwidget.h>
> >> > #include <qwidget.h>
>
> I'd like to ask that people use only these forms:
> #include <QtModule/QClassName>
> #include <QtModule/qclassname.h>
>
> The other two forms require more -I switches to the compiler on the
> command-line (one for every Qt module [core, gui, xml, network, testlib,
> qt3support, svg, opengl]). All includes inside the Qt headers themselves
> are of the second form.
>
> The documentation on doc.trolltech.com says "#include <QClassName>",
> though.

I think #include <QClassName> is the style we should promote to application 
developers. It's convenient and it does not require one to remember which 
module a certain class is each time one adds an #include statement.

#include <QtModule/headerfile.h> on the other hand makes sense for installed 
library header files because it means that a user of the header file doesn't 
have to care about having the depending modules in the include search path.


Simon




More information about the kde-core-devel mailing list