[Qt-interest] Forcing another specific thread to execute slots
Preet
preet.desai at gmail.com
Sat Dec 12 07:54:01 CET 2009
Hey all,
This is probably an easy question for some of you =)
I want my main thread to signal slots in secondary threads under certain
situations. Each of these secondary threads are the same subclass of QThread
and have the same slots available. Based on user input, I only want to
signal specific secondary threads. So for example the slots I have in each
secondary thread are SlotA, SlotB and SlotC. To invoke these slots from the
main thread I can create a different signal for each Thread and Slot
(SignalThread1SlotA, SignalThread1SlotB, etc), but that seems like a huge
waste since I could have a lot of threads and slots. I can also emit one
signal from the main thread for all the secondary threads (SignalSlotA
triggers SlotA in Thread1, Thread2, Thread3, etc) and use
QObject::connect/disconnect to selectively signal threads. This also seems
incorrect. I'm not invoking the slot like a normal function call because I
don't want the calling thread to execute the slot. Is there another way to
do this? Can I create signals within the secondary threads (that call these
slots) and use 'emit otherThread->SignalBlah()'? ie. will that still get
otherThread to execute the respective slot?
Regards,
Preet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091212/53001d49/attachment.html
More information about the Qt-interest-old
mailing list