Results 1 to 6 of 6

Thread: <QtGui/QApplication> vs. <QApplication>

  1. #1
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default <QtGui/QApplication> vs. <QApplication>

    Whenever Qt designer 4.1 creates ui code the includes are generated as #include <QtGui/QApplication>, however documentation suggests to use #include <QApplication> instead.

    What are the advantages/disadvantages of both variants, and which should be used to stay compliant with future versions?

  2. #2
    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: <QtGui/QApplication> vs. <QApplication>

    It's completely the same. It's better to use <QApplication> as it is not vulnerable to a situation when directory structure of includes changes, but you may use both now.

  3. #3
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: <QtGui/QApplication> vs. <QApplication>

    I have an argument pro <QtGui/QApplication>: On Macintosh-plattform, it is common to include headers in the way <framework/headerfile>. e.g. <OpenGL/gl.h>. <QtGui/QApplication> does also match that pattern. This is only important if you use Qt as frameworks on macintosh. The other way works fine when using a regular static or shared library.
    It's nice to be important but it's more important to be nice.

  4. #4
    Join Date
    Jan 2006
    Posts
    109
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: <QtGui/QApplication> vs. <QApplication>

    The "official" documented way is to include <QApplication> but <QtGui/QApplication> works as well.

  5. #5
    Join Date
    Jan 2006
    Location
    Berlin, Germany
    Posts
    64
    Thanks
    1
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: <QtGui/QApplication> vs. <QApplication>

    how about I use "/usr/include/QtGui/QApplication.h"
    ?
    JUST KIDDING

    Katrina

  6. #6
    Join Date
    Jan 2006
    Posts
    14
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: <QtGui/QApplication> vs. <QApplication>

    Quote Originally Posted by katrina
    how about I use "/usr/include/QtGui/QApplication.h"
    ?
    JUST KIDDING

    Katrina
    hey, this doesn't work!!!!! qt header file names are lower-case, use "/usr/include/QtGui/qapplication.h" instead!!
    and dont forget:

    #ifdef WIN32
    #include "c:\my documents and settings\my text files\my include files\..\troll's include files\my qt\my qt 4\my qt 4.1\the include filesi'm looking for\QStupidApplication.h"


Similar Threads

  1. Replies: 7
    Last Post: 10th September 2007, 20:35

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.