11-14-2012 04:11 AM
I'm continuing to have issues with the touch signal emitted by VisualNode. I'm connecting to it as follows:
QObject::connect(m_Title, SIGNAL(touch(TouchEvent *)), this, SLOT(onTitleTouched(TouchEvent *)));
The console spits out the following error every time the label is touched:
Object::connect: No such signal bb::cascades::Label::touch(TouchEvent *) in ../src/xxxxxxx.cpp:121
The ultimate goal here is to have a ListView where each item has more than one hitbox and performs a different action when each is hit.
First, however, I have to be able to connect to a touch event for a label in C++. Any ideas how that can be done successfully?
Solved! Go to Solution.
11-14-2012 04:23 AM
For whatever reason explicitly adding the namespace (despite having it included in my source file) solved the issue:
QObject::connect(m_Title, SIGNAL(touch(bb::cascades::TouchEvent*)), this, SLOT(onTitleTouched(bb::cascades::TouchEvent*)));
11-14-2012 05:53 PM
The namespace has to be added because you need to refer to the signal in the *exact* way as it is defined in the header file. This is because the argument to SIGNAL() is not a function prototype but a string (even though it doesn't look like a string).
11-14-2012 10:02 PM
Yes; also, do not make the mistake of putting the variable names in the connect parameters, for those new to this