Solved QMetaObject::Connection, how to test for success
-
I've read in the online documentation that QMetaObject::Connection has an operator bool() which returns true if the connection is valid.
https://doc.qt.io/qt-5/qmetaobject-connection.html
Question is how do I access it? I've tried creating a local instance of QMetaObject::Connection cn and assigning it to the return of a QObject::connect.
How do I perform the test? I see nothing to call.
-
auto conn = QObject::connect()... if (!conn) { qWarning() << "Connect not successful!"; }
-
auto conn = QObject::connect()... if (!conn) { qWarning() << "Connect not successful!"; }
-
Hi,
It should be something like:
If (connection) { // do what you want }
-
Thank you!