Results 1 to 6 of 6

Thread: using QtGui

  1. #1
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question using QtGui

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: using QtGui

    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

  3. The following user says thank you to jpn for this useful post:

    nupul (7th April 2006)

  4. #3
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Talking Re: using QtGui

    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

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: using QtGui

    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

  6. #5
    Join Date
    Feb 2006
    Location
    Boulder, Colorado, USA
    Posts
    63
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using QtGui

    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.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: using QtGui

    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.

Similar Threads

  1. Qt 4.3.3 - Server build without QtGui?
    By Mike in forum Installation and Deployment
    Replies: 7
    Last Post: 12th February 2008, 19:49
  2. relink qtplugin to QtGui && QtCore
    By patrik08 in forum Qt Programming
    Replies: 0
    Last Post: 1st June 2007, 12:44
  3. Replies: 5
    Last Post: 24th April 2006, 15:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.