Results 1 to 4 of 4

Thread: Counter-intuitive behavior of QThreads signals/slots

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Counter-intuitive behavior of QThreads signals/slots

    Quote Originally Posted by reddish View Post
    Upon examining the Qt documentation, I found only a single line that explains this behavior:[...]
    You will have to read that document once more. The paragraph that explains this behavior is:
    Like other objects, QThread objects live in the thread where the object was created -- not in the thread that is created when QThread::run() is called. It is generally unsafe to provide slots in your QThread subclass, unless you protect the member variables with a mutex.
    Instead of subclassing QThread, put a QObject subclass inside the thread and all connections will behave as you expect.

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

    reddish (8th September 2008)

  3. #2
    Join Date
    Sep 2008
    Location
    Delft, Netherlands
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Counter-intuitive behavior of QThreads signals/slots

    Quote Originally Posted by jacek View Post
    You will have to read that document once more.
    Indeed I will, I missed that part completely. Thanks for pointing it out.

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.