Results 1 to 7 of 7

Thread: QLocalServer without QCoreApplication ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #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: QLocalServer without QCoreApplication ?

    Quote Originally Posted by Raistlin View Post
    I noticed that in Qt 4.4, you need to construct a QCoreApplication object before a QLocalServer can be used. QLocalServer::listen() does return true even if the QCoreApplication does not exist, but no connections can be made.
    That's perfectly normal. All connection oriented classes need events to be delivered to work.

    I do not need QCoreApplication::exec() or any other related methods.
    Hmm... really? Oh.. you probably use waitForNewConnection(), right? It spawns an internal event loop...

    The same problem does not occur with TCP sockets. Anyway has any idea how to handle this nicely?
    Some features need QCoreApplication to work, because there is some initialization code there (for instance plugins are loaded from within the application's constructor, so you need to create it regardless if you're going to use it or not). You might safely create your own application instance, just check if some other code hasn't done it earlier (checking QCoreApplication::instance() for null might be enough).

  2. The following user says thank you to wysota for this useful post:

    Raistlin (9th May 2008)

Similar Threads

  1. CLI and QCoreApplication - where to start?
    By soul_rebel in forum Qt Programming
    Replies: 3
    Last Post: 21st October 2007, 13:40
  2. Replies: 5
    Last Post: 24th July 2007, 17:35
  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.