I use the C ++ 11 connect syntax and get the following error with this connect statement:
connect(fileSystemCompleter, &QCompleter::activated, [&] (QModelIndex index) { fileSystemPathEdit->setFocus(Qt::PopupFocusReason); });
Error:
error C2664: 'QMetaObject::Connection QObject::connect(const QObject *,const char *,const char *,Qt::ConnectionType) const' : cannot convert parameter 2 from 'overloaded-function' to 'const char *' Context does not allow for disambiguation of overloaded function
Is there any way to rewrite this so that the compiler can eliminate the overloaded function?
EDIT:
From the Qt project ...
Overload
As you can see in the example, connecting to QAbstractSocket :: error is actually not very nice, because the error has overload and the address of the overloaded function requires explicit casting.
Some macros may help (with C ++ 11 or typeof extensions)
It is probably best to recommend not overloading signals or slots ...
... but we added overloads in past minor Qt releases because accepting the function address was not a precedent, we support. But now this would not have been possible without violating source compatibility.
Any ideas what this macro will look like? Or how to make explicit casting?
source share