Stephen Chu
2012-11-01 17:03:56 UTC
I find out what QPrivateSignal is for but it's not clear if lambda can
still be used to connect to such private signals.
If I connect QTimer::timeout() to a slot that takes no argument, it
compiles fine. But when I try to connect to a lambda function without
any argument, the results in the mentioned error.
Is this designed behavior? It makes using lambda function as slot really
hard since there's no mention in documentation which signals are limited
this way.
FYI. I am using clang 3.1.
still be used to connect to such private signals.
If I connect QTimer::timeout() to a slot that takes no argument, it
compiles fine. But when I try to connect to a lambda function without
any argument, the results in the mentioned error.
Is this designed behavior? It makes using lambda function as slot really
hard since there's no mention in documentation which signals are limited
this way.
FYI. I am using clang 3.1.
QTimer timer;
connect(&timer, &QTimer::timeout, [=](){});
error: no matching function for call to object of type
'PageLogPanel::<lambda at ../../Dropbox/Client2012/PageLogPanel.cpp:47:36>'
f((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type
*>(arg[I+1]))...), ApplyReturnValue<R>(arg[0]);
^
note: in instantiation of member function
'QtPrivate::FunctorCall<QtPrivate::IndexesList<0>,
QtPrivate::List<QTimer::QPrivateSignal>, void, PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36> >::call' requested here
FunctorCall<typename Indexes<N>::Value, SignalArgs, R,
Function>::call(f, arg);
^
note: in instantiation of function template specialization
'QtPrivate::Functor<PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36>,
1>::call<QtPrivate::List<QTimer::QPrivateSignal>, void>' requested here
FuncType::template call<Args,
R>(static_cast<QFunctorSlotObject*>(this_)->function, r, a);
^
note: in instantiation of member function
'QtPrivate::QFunctorSlotObject<PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36>, 1,
QtPrivate::List<QTimer::QPrivateSignal>, void>::impl' requested here
QSlotObjectBase(&impl), function(f) {}
^
note: in instantiation of member function
'QtPrivate::QFunctorSlotObject<PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36>, 1,
QtPrivate::List<QTimer::QPrivateSignal>, void>::QFunctorSlotObject'
requested here
new QtPrivate::QFunctorSlotObject<Func2,
SignalType::ArgumentCount, typename SignalType::Arguments, typename
SignalType::ReturnType>(slot),
^
../../Dropbox/Client2012/PageLogPanel.cpp:47:2: note: in instantiation
of function template specialization 'QObject::connect<void
(QTimer::*)(), PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36> >' requested here
connect(&timer, &QTimer::timeout, [=](){});
^
../../Dropbox/Client2012/PageLogPanel.cpp:47:36: note: candidate
function not viable: requires 0 arguments, but 1 was provided
connect(&timer, &QTimer::timeout, [=](){});
^
It seems
http://qt.gitorious.org/qt/qtbase/commit/dee57bc91080740201a0bf0b8c42eb374ee696f3
added QPrivateSignal to the signal signature?
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
connect(&timer, &QTimer::timeout, [=](){});
error: no matching function for call to object of type
'PageLogPanel::<lambda at ../../Dropbox/Client2012/PageLogPanel.cpp:47:36>'
f((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type
*>(arg[I+1]))...), ApplyReturnValue<R>(arg[0]);
^
note: in instantiation of member function
'QtPrivate::FunctorCall<QtPrivate::IndexesList<0>,
QtPrivate::List<QTimer::QPrivateSignal>, void, PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36> >::call' requested here
FunctorCall<typename Indexes<N>::Value, SignalArgs, R,
Function>::call(f, arg);
^
note: in instantiation of function template specialization
'QtPrivate::Functor<PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36>,
1>::call<QtPrivate::List<QTimer::QPrivateSignal>, void>' requested here
FuncType::template call<Args,
R>(static_cast<QFunctorSlotObject*>(this_)->function, r, a);
^
note: in instantiation of member function
'QtPrivate::QFunctorSlotObject<PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36>, 1,
QtPrivate::List<QTimer::QPrivateSignal>, void>::impl' requested here
QSlotObjectBase(&impl), function(f) {}
^
note: in instantiation of member function
'QtPrivate::QFunctorSlotObject<PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36>, 1,
QtPrivate::List<QTimer::QPrivateSignal>, void>::QFunctorSlotObject'
requested here
new QtPrivate::QFunctorSlotObject<Func2,
SignalType::ArgumentCount, typename SignalType::Arguments, typename
SignalType::ReturnType>(slot),
^
../../Dropbox/Client2012/PageLogPanel.cpp:47:2: note: in instantiation
of function template specialization 'QObject::connect<void
(QTimer::*)(), PageLogPanel::<lambda at
../../Dropbox/Client2012/PageLogPanel.cpp:47:36> >' requested here
connect(&timer, &QTimer::timeout, [=](){});
^
../../Dropbox/Client2012/PageLogPanel.cpp:47:36: note: candidate
function not viable: requires 0 arguments, but 1 was provided
connect(&timer, &QTimer::timeout, [=](){});
^
It seems
http://qt.gitorious.org/qt/qtbase/commit/dee57bc91080740201a0bf0b8c42eb374ee696f3
added QPrivateSignal to the signal signature?
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest