Results 1 to 2 of 2

Thread: QThread interthread communication

  1. #1
    Join Date
    Apr 2008
    Location
    Russia, Moscow
    Posts
    86
    Thanks
    2
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4

    Default QThread interthread communication

    Just for academic interest. I we emit signal from other thread to main thread - this call slot inside main thread context. But if we send signal from main thread to other thread this again call slot in main thread context. So i think i must create new QObject inside run() method and connect signal from main thread to slot this new object. And i don't understand why QThread object don't use moveToThread for himself from begining?

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

    Default Re: QThread interthread communication

    Quote Originally Posted by SABROG View Post
    So i think i must create new QObject inside run() method and connect signal from main thread to slot this new object.
    Yes, that's correct.

    And i don't understand why QThread object don't use moveToThread for himself from begining?
    Why would it do that? For instance you couldn't have passed it a parent in such a case...
    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. QThread interthread communication
    By hunsrus in forum Qt Programming
    Replies: 2
    Last Post: 10th March 2009, 14:49
  2. QThread and QTcpSocket
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2008, 13:06
  3. QThread communication with GUI
    By ldiamond in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2008, 00:00
  4. Communication between QThread and Yes/No QMessageBox?
    By pmaktieh.sirhc in forum Qt Programming
    Replies: 11
    Last Post: 25th January 2007, 03:45
  5. Is it possible to create a QThread without inheriting ?
    By probine in forum Qt Programming
    Replies: 6
    Last Post: 23rd March 2006, 22:51

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.