Auto can I check the result of a connect() with Qt::AutoConnection
-
I'm having some weird difference between the same program compiled in Qt 4.8 and Qt 5.15
and I suspect thatQt::AutoConnectiondoesn't behave the same in both case.
Is there a way I can check if the connection resulted inQt::DirectConnectionorQt::QueuedConnection?
Thanks! -
Hi,
Unless you force the type, it will be selected at run time. The objects being in different threads is the key for a queued connection.
-
Can this be checked at runtinme?
connect()returns a handle, but it doesn't contains this kind of information. -
I'm having some weird difference between the same program compiled in Qt 4.8 and Qt 5.15
and I suspect thatQt::AutoConnectiondoesn't behave the same in both case.
Is there a way I can check if the connection resulted inQt::DirectConnectionorQt::QueuedConnection?
Thanks!@JulienMaille said in Auto can I check the result of a connect() with Qt::AutoConnection:
I'm having some weird difference between the same program compiled in Qt 4.8 and Qt 5.15
and I suspect thatQt::AutoConnectiondoesn't behave the same in both case.What weird difference are you seeing?
The behaviour of
Qt::AutoConnectionhas not changed between Qt 4 and Qt 5.Is there a way I can check if the connection resulted in
Qt::DirectConnectionorQt::QueuedConnection?Check
QObject::thread()for both the sender and receiver. If both use the same thread, then the connection isQt::DirectConnection. If they use different threads, then the connection isQt::QueuedConnection. This is what @SGaist meant.You can also call call
QThread::currentThread()in the slot to see which thread ran the slot. -
Thanks to both of you. I believe my issue has to do with processEvent() and not the connect. I will open another topic