Qt4 lambda slot
-
I am working for a client that is using a very old version of Qt 4.8. I have put forward a case for upgrading, however it remains to be seen if this will happen.
In the mean time I have to modify and update this very old source. I want to implement a lambda connection, I'm not sure if this is even possible with this version:
QObject::connect(this, SIGNAL(error(const char*)), [this](const char* cpszMsg) { perror(cpszMsg); QApplication::quit(); exit(-1); });When I try to build this I get:
no matching function for call to 'clsMainWnd::connect(clsMainWnd* const, const char*, clsMainWnd::clsMainWnd(int, char**, QWidget*)::<lambda(const char*)>)'I also tried:
QObject::connect(this, &clsMainWnd::error, [this](const char* cpszMsg) { perror(cpszMsg); QApplication::quit(); exit(-1); });Same result
-
Qt4 does not support the new signal/slot syntax.
-
Qt4 does not support the new signal/slot syntax.
@Christian-Ehrlicher , thats what I was afraid of.
-
@Christian-Ehrlicher , thats what I was afraid of.
@SPlatten said in Qt4 lambda slot:
thats what I was afraid of.
Reading the documentation would have helped to ask. But documentation is bad ... I know.
-
@SPlatten said in Qt4 lambda slot:
thats what I was afraid of.
Reading the documentation would have helped to ask. But documentation is bad ... I know.
@Christian-Ehrlicher , I tried google before posting, couldn't see an absolute answer...I just don't understand why large companies still allow themselves to fall into this obsolete trap.
-
@Christian-Ehrlicher , I tried google before posting, couldn't see an absolute answer...I just don't understand why large companies still allow themselves to fall into this obsolete trap.
@SPlatten
The standard page for this is New Signal Slot Syntax whose first sentence isThis page was used to describe the new signal and slot syntax during its development. The feature is now released with Qt 5.
fall into this obsolete trap.
What "obsolete" do you mean? The new syntax was an addition at Qt5.