Results 1 to 4 of 4

Thread: QCoreApplication - startingUp()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    Poland, Cracow
    Posts
    34
    Thanks
    2
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QCoreApplication - startingUp()

    Hi,

    I'm not entirely sure if I can use Qt classes before QCoreApplication app; app.exec(). I met once app.argument() to cause segmentation fault, I don't know why I'm not even able to check if I already can do anything with Qt objects.

    I'm playing with startingUp() static method from QCoreApplication. As far as I understeand it from documentation - it should return true while application is starting up and some more objects needs to be initialized (etc, etc, ...), but whould return false when application (the Qt) is ready for regular processing.

    For me it always returns true (until application quit). As I read in Qt sources - it's set to true at start and to false at shutting down.

    Is it really as I read in sources, or did I miss something? ...and what about usage of Qt classes (except QEvent, of course) before exec()?

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

    Default Re: QCoreApplication - startingUp()

    You can use any classes you want as long as they are not paint devices (QPixmap, QWidget). You can use those as well before QApplication::exec() but only after creating the application object. Also the constructor of QCoreApplication is responsible for loading Qt plugins so SQL and image classes are fully available only after the application object has been created.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2009
    Location
    Poland, Cracow
    Posts
    34
    Thanks
    2
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QCoreApplication - startingUp()

    Thanks for quick response!

    And what about startingUp() in QCoreApplication? Now I took closer look at QApplication and QCoreApplication sources and it appears that QApplication sets this property correctly, but QCoreApplication will always return true.

    I'll drop usage of this method, but I'm just curious.

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

    Default Re: QCoreApplication - startingUp()

    For QApplication it will return false once QApplicationPrivate::initialize() is called happens from the application constructor.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QLocalServer without QCoreApplication ?
    By Raistlin in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2008, 22:44
  2. CLI and QCoreApplication - where to start?
    By soul_rebel in forum Qt Programming
    Replies: 3
    Last Post: 21st October 2007, 13:40
  3. QTcpServer in a QCoreApplication
    By xgoan in forum Qt Programming
    Replies: 1
    Last Post: 23rd March 2007, 10:19
  4. QCoreApplication!!!!
    By fellobo in forum Qt Programming
    Replies: 6
    Last Post: 17th January 2007, 00:56
  5. QCoreApplication question
    By barnabyr in forum Newbie
    Replies: 5
    Last Post: 24th March 2006, 19:38

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
  •  
Qt is a trademark of The Qt Company.