|
I'm trying to do, in gpssearchview.cpp, something like:
connect(d->mapSearchWidget, SIGNAL(signalMouseModeChanged(KMap::MouseMode)), this, SLOT(slotMouseMode Changed(KMap::MouseMode))); and when I run digikam, in Konsole says:
No such signal KMap::KMapWidget::signalMouseModeChanged(KMap::MouseMode) in ./gpssearchview.cpp KMap::MouseMode is an enum that holds the mouse modes in libkmap: enum MouseMode{
MouseModePan, MouseModeSelection, MouseModeZoom, MouseModeFilter, ...}; If I remove the parameter of the signal ( I put signalMouseModeChanged() instead of signalMouseModeChanged(KMap::MouseMode)), all works and the signal is emitted right. QSignal doesn't admit enum parameters in signals?
Gabriel
_______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
|
Hey
On 10/20/2010 10:35 AM, Gabriel Voicu wrote: > I'm trying to do, in gpssearchview.cpp, something like: > > connect(d->mapSearchWidget, SIGNAL(signalMouseModeChanged(KMap::MouseMode)), > this, SLOT(slotMouseMode Changed(KMap::MouseMode))); > > and when I run digikam, in Konsole says: > No such signal KMap::KMapWidget::signalMouseModeChanged(KMap::MouseMode) in > ./gpssearchview.cpp > > KMap::MouseMode is an enum that holds the mouse modes in libkmap: > > enum MouseMode{ > MouseModePan, > MouseModeSelection, > MouseModeZoom, > MouseModeFilter, > ...}; course use int ant cast the enums, but that would be ugly. Regards, Johannes _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
|
In reply to this post by Gabriel Voicu
Hi,
I have had problems when using enums for signals, and I have had problems when using namespace-qualified types for signals. Have a look at the section "Enums and Typedefs Must Be Fully Qualified for Signal and Slot Parameters", http://doc.qt.nokia.com/4.6/moc.html maybe it needs to have the namespace in the .h file. You'll see some places where I have used "int" parameters in signals. It's a bit ugly, but works reliably. Marcel _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
|
On Wed, Oct 20, 2010 at 12:26 PM, Marcel Wiesweg <[hidden email]> wrote:
Hi, Thank you, guys, It worked! In kmap_widget class, I declared the signal void signalCurrentMouseModeChanged(KMap::MouseMode currentMouseMode) instead of
void signalCurrentMouseModeChanged(MouseMode currentMouseMode). It's pretty funny that QObject::connect compares the two objects literally, but anyway, it's good to know for the future! Have a nice day, Gabriel _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
|
> It's pretty funny that QObject::connect compares the two objects literally, > but anyway, it's good to know for the future! Yes. The SIGNAL / SLOT macros convert its parameter to a string constant, QObject::connect takes const char*. The string is then parsed by QMetaObject::normalizedSignature, removing spaces etc. The great advantage of this approach is that it works with DBus, QtScript, QML etc. The disadvantage is that connect arguments are not checked by the compiler - I manage again and again to include parameter names in connect. Marcel _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
| Free forum by Nabble | Edit this page |
