When and why should one use QtGui? I have seen that whenever a QDirModel or Qdir is being used the only file included is QtGui....why is this?
When and why should one use QtGui? I have seen that whenever a QDirModel or Qdir is being used the only file included is QtGui....why is this?
Last edited by nupul; 7th April 2006 at 06:18. Reason: posted in programming by mistake...should be in newbie
QtGui is a module containing GUI functionality.
It is for lazy people who want to add only one include which includes definitions of the whole module's classes instead of dozens of separate includes, one for each class.
The negative aspect is that you'll include a whole lot of unnecessary definitions..
J-P Nurmi
nupul (7th April 2006)
agreed.......but even the Trolls have done the same in their doc...example of QdirModel.....do they come under the same category as you highlighted?
Nupul
Ok, it doesn't really matter in an example of few lines. It may also be used for keeping an example simple, short and clear..
J-P Nurmi
I find it useful to include QtGui rather than the individual headers whilst developing because I constantly add, remove, or change things in ways that break unexpectedly without the proper headers. After I stabilize the code I take out QtGui and add the proper include files. In headers I use class QSomething, as per the trolls advice in the docs, when I can.
It's ok to include "global" includes like QtGui when using precompiled headers. This boosts the precompiled header size but makes sure everything is included and the compilation remains very fast. When using QtGui inclusion in regular files (especially header files) compilation time increases significantly as the preprocessor has lots of more work to do.
Bookmarks