Results 1 to 3 of 3

Thread: Determine if QThread::currentThread is main thread?

  1. #1
    Join Date
    Oct 2008
    Posts
    37
    Thanked 2 Times in 2 Posts

    Default Determine if QThread::currentThread is main thread?

    Is it possible for me to figure out if I'm the main thread or from a child thread from QThread::currentThread? Or do I have to keep track of the thread id and just against that?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Boston, MA
    Posts
    40
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Determine if QThread::currentThread is main thread?

    QApplication::instance()->thread() will give you main threadid.

  3. #3
    Join Date
    Oct 2008
    Posts
    37
    Thanked 2 Times in 2 Posts

    Default Re: Determine if QThread::currentThread is main thread?

    Brilliant! Thanks.

Similar Threads

  1. How to determine if current thread is the UI thread
    By huangwf in forum Qt Programming
    Replies: 2
    Last Post: 21st September 2007, 08:24
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  3. Replies: 10
    Last Post: 20th March 2007, 22:19
  4. Network programming and the main thread
    By invictus in forum Qt Programming
    Replies: 5
    Last Post: 16th March 2007, 00:25
  5. Main Thread (GUI Thread)
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2006, 16:07

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.