Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Brennan12325
Posts: 205
Registered: ‎05-15-2012
My Device: None
Accepted Solution

touch SIGNAL not found

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?

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Developer
Brennan12325
Posts: 205
Registered: ‎05-15-2012
My Device: None

Re: touch SIGNAL not found

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*)));

 

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Trusted Contributor
marcelnijman
Posts: 118
Registered: ‎06-19-2012
My Device: PlayBook + Red Z10 + BB10 Dev Alpha C

Re: touch SIGNAL not found

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).

Developer
martin78
Posts: 27
Registered: ‎05-15-2012
My Device: Dev Alpha B

Re: touch SIGNAL not found

Yes; also, do not make the mistake of putting the variable names in the connect parameters, for those new to this

:smileyhappy:

 

Martin

------------------------------------------
Macadamian Technologies Inc.
http://www.macadamian.com/