Results 1 to 2 of 2

Thread: Can you send a signal to a thread?

  1. #1
    Join Date
    Oct 2007
    Posts
    38
    Thanks
    1

    Default Can you send a signal to a thread?

    I don't know what is going on, I am positive I connected my signals properly and my thread won't respond the signal. Maybe it is not possible to send signals to threads? (Although I am able to send signals out of threads to my mainwindow no problem...)

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Can you send a signal to a thread?

    Common pitfalls:
    • First of all, the QThread object itself lives in the thread it was created in. This is the thread where its slots get executed, not in thread which is being executed in QThread::run().
    • Secondly, QThread must enter to event loop with QThread::exec(). Running a busy loop in QThread::run() won't allow the thread to receive signals (which are delivered as events under the hood).

    Hope this helps.
    J-P Nurmi

Similar Threads

  1. creating treeWidgetItem using emitted signal from thread class
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2007, 08:37
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  3. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  4. Manually send signal to slot
    By donmorr in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2006, 15:03
  5. send signal from QCombobox
    By raphaelf in forum Qt Programming
    Replies: 22
    Last Post: 28th February 2006, 14:18

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.