Unsolved Where should I define Connection type in Signal and Slot, whenever We use Lambada?
-
auto expCompleteHandler = [=](const QUuid &id) { }; QList<QMetaObject::Connection> m_connections << QObject::connect(m_mainWindow, &MainWindow::ExperimentCompleted, expCompleteHandler);
Where to define Connection type in above function?
I know on way is
QObject::connect(SenderObj,SIGNAL(Signal_name),ReciverObject,SLOT(Slot_name),Qt::QueuedConnection). -
Hi,
Do you mean like with this overload of QObject::connect ?
-
Yes, I tried like
but it is give the error likeError (active) E0304 no instance of overloaded function "QObject::connect" matches the argument list.
What Should I Have to Do?
-
What version of Qt are you using ?
-
Qt 5.6.3
-
Just tested with 5.10 on macOS and it's working as expected.
By the way, AutoConnection is the default, so unless you plan to change it, there's no real need to add it.
-
Yes sir, I know auto connection is default. I wanted to use Qt::QueuedConnection. I just took as Example to show.