Thread and signals
-
i have a singleton class that handles downloading files. and some other classes that have data of files to be downloaded and pathes and ... . this second classes have some SIGNAL-SLOT connections to Communicate with downloader class. for preformance reseaons i want this conecction to be Queued connections ( this to classes live in same thread). but my slots dont invoke when appropriate signal emits.
i tried to move my downloader class to another thread so automaticaly i would have a Queued connection but it down'nt work.
- i contemplate connecting signals after changing thread.
-
i have a singleton class that handles downloading files. and some other classes that have data of files to be downloaded and pathes and ... . this second classes have some SIGNAL-SLOT connections to Communicate with downloader class. for preformance reseaons i want this conecction to be Queued connections ( this to classes live in same thread). but my slots dont invoke when appropriate signal emits.
i tried to move my downloader class to another thread so automaticaly i would have a Queued connection but it down'nt work.
- i contemplate connecting signals after changing thread.
-
@mahd96
what are the arguments of your signal? My guess is some custom object/class/structThat will work fine, if it's used in direct connection, otherwise you'll have to register it to the MetaObjectSystem for Qt to know how to Queue (copy) them.
-
@mahd96 said in Thread and signals:
QObject::connect: Cannot queue arguments of type XXXX
Take a look at this: http://doc.qt.io/qt-5/qtcore-threads-queuedcustomtype-example.html
You need to register your own custom types before using them as parameter for signals/slots.