Results 1 to 3 of 3

Thread: Emitting signal from a non-Qt Thread

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Emitting signal from a non-Qt Thread

    I think in this case it is easier to just call the slot via QMetaObject:.invokeMethod(), i.e. no need for an intermediary "emitter" object.

    Qt Code:
    1. QMetaObject::invokeMethod(receiver, "takeData", Qt::QueuedConnection);
    To copy to clipboard, switch view to plain text mode 
    You can even pass arguments that way.

    Cheers,
    _

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

    FreddyKay (29th January 2016)

  3. #2
    Join Date
    Jun 2013
    Posts
    20
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Emitting signal from a non-Qt Thread

    True, thanks.

    Anyway, the problem was at another point of the program entirely and prevented it from starting the even loop in the first place, which is why my signal / slots would not connect. Solved now.

Similar Threads

  1. Replies: 10
    Last Post: 3rd January 2015, 12:25
  2. Issue emitting signal from background thread.
    By Chris@Link in forum Newbie
    Replies: 8
    Last Post: 3rd July 2012, 17:56
  3. Emitting signals in other thread
    By mvbhavsar in forum Newbie
    Replies: 9
    Last Post: 8th June 2011, 08:17
  4. Replies: 5
    Last Post: 22nd February 2011, 21:21
  5. Emitting signal from DLL to EXE
    By Miihkali in forum Qt Programming
    Replies: 6
    Last Post: 27th March 2009, 08:32

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.