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
Trusted Contributor
Brennan12325
Posts: 204
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus
Accepted Solution

Connecting to the touch event in C++

How can I connect to the touch event in C++? This code:

 

    QObject::connect(m_Title, SIGNAL(touch(TouchEvent)),
    		this, SLOT(onTitleTouched(TouchEvent)));

 is telling me Label.touch(TouchEvent) is not defined. I'm under the impression, since Label is inheriting from VisualNode, I should have access to that SIGNAL.

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

And of course, like my post if you found it helpful or informative!
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Connecting to the touch event in C++

You may require a different signature for the signal/slot. The samples use this:

QObject::connect(m_Title, SIGNAL(touch(TouchEvent *)),
    		this, SLOT(onTitleTouched(TouchEvent *)));

Or possibly even "bb::cascades::TouchEvent *", but I'm assuming you know how to handle namespaces.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Trusted Contributor
Brennan12325
Posts: 204
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Connecting to the touch event in C++

You are correct, passing a pointer eliminates the error. Thanks!
----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Please use plain text.