I have a connect statement that compiles fine, with the connection type QueuedConnection. Once I OR it with UniqueConnection, it refuses to compile. I had to re-cast it back to Qt::ConnectionType
for it to run. Is this normal/expected behaviour?
I thought the connection method definition would accept an int (which is equivalent to enum) without complaint.
connect(
mySource, SIGNAL(mySig()),
this, SLOT(mySlot())),
static_cast<Qt::ConnectionType>
(Qt::QueuedConnection|Qt::UniqueConnection));
I try this Example :
what you write In your
connect
is wrong, because you should follow this style :you can't use two Connections at the same time
From Qt::ConnectionType for
Qt::UniqueConnection
:Noted that it was introduced in Qt 4.6 and it said that if the connection already exists
QObject::connect()
will fail.as I try
I got an error too because I use the
Qt 6
version and it may work inQt 4.6
.From https://stackoverflow.com/a/20717599/9484913 I try this :
and it works: