This enum describes the types of connection that can be used between signals
and slots. In particular, it determines whether a particular signal is delivered
to a slot immediately or queued for delivery at a later time.
Constant
Value
Description
Qt::DirectConnection
1
When emitted, the signal is
immediately delivered to the slot.
Qt::QueuedConnection
2
When emitted, the signal is queued until the event loop is able
to deliver it to the slot.
Qt::BlockingQueuedConnection
4
Same as QueuedConnection, except that the current thread blocks
until the slot has been delivered. This connection type should only be used for
receivers in a different thread. Note that misuse of this type can lead to
deadlocks in your application.
Qt::AutoConnection
0
If the signal is emitted from the thread in which the receiving
object lives, the slot is invoked directly, as with Qt::DirectConnection;
otherwise the signal is queued, as with
Qt::QueuedConnection.
With queued connections, the parameters must be
of types that are known to Qt's meta-object system, because Qt needs to copy the
arguments to store them in an event behind the scenes. If you try to use a
queued connection and get the error message
QObject::connect: Cannot queue arguments of type 'MyType'
callqRegisterMetaType() to register the data type before you establish the
connection.
文章评论(0条评论)
登录后参与讨论