[Development] Prefix includes with module name
Kurt Pattyn
pattyn.kurt at gmail.com
Wed Nov 6 12:43:16 CET 2013
What is the general rule to include files in a Qt add-on module, more specific, when should include files be prefixed with the module name?
If I look at QTcpSocket.h I see:
#include <QtNetwork/qabstractsocket.h>
#include <QtCore/qvariant.h>
Includes prefixed with the module name.
In QTcpSocket.cpp:
#include “qtcpsocket.h”
#include “qtcpsocket_p.h”
#include “qlist.h”
#include “qhostaddress.h”
Includes not prefixed.
If I look at qdbusabstractadaptor.cpp:
#include <QtCore/qcoreapplication.h>
#include <QtCore/qset.h>
…
#include “qdbusabstractadaptor.h”
Includes not related to the dbus adaptor are prefixed with the QtCore module name, the other is not prefixed.
Sometimes private header files are included prefixed with private (private/…_p.h), sometimes not.
Is there a general rule, best practice to follow for include files when implementing a module or add-on for Qt?
Thanks,
Kurt
More information about the Development
mailing list