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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 60
Registered: ‎05-03-2013
My Device: Z10
My Carrier: Rogers
Accepted Solution

container touch

I hope it's not a dumb question:


I am trying to catch some container's touch, touchEnter and touchExit signals.


I have:


class Example: public QObject {

    virtual ~Example();




public slots:

    void touch(bb::cascades::TouchEvent * event);






I'm trying to connect the container's touch to my touch:


bool result = connect(example_container,SIGNAL(touch(TouchEvent*)),this,SLOT(touch(TouchEvent*)));


But it tells me that neither example_container nor this' touch is a signal/slot.  I look up the docs:




Looks like a slot to me not to mention mine is in the slots section of the header.


Any idea what I'm doing wrong here?

Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: container touch

Can you post the code where you define example_container leading to the connection code?

If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: container touch

[ Edited ]

Type names inside of SIGNAL() and SLOT() macros should be fully-qualified. MOC can't resolve namespaces.


And just to be safe, I suggest using a different name for the slot, for example onTouch. This isn't required, but avoids conflicts if you declare a signal with this name or inherit from a class where the signal is declared.

bool result = QObject:::connect(container, SIGNAL(touch(bb::cascades::TouchEvent*)), this, SLOT(onTouch(bb::cascades::TouchEvent*)));


public slots:

    void onTouch(bb::cascades::TouchEvent * event);

Andrey Fidrya, @zmeyc on twitter
Posts: 60
Registered: ‎05-03-2013
My Device: Z10
My Carrier: Rogers

Re: container touch

I figured out my issue which was a combinatin of a few things:


1. When I tried with fully qualified names (bb::cascades::TouchEvent *) I also had the variable name so it failed. 

2. When I checked another example I had which used QString it didn't have bb::cascades:: and I never made the connection (doesn't have to with QString).  I went and removed both the variable name and bb::cascades::


My bad.  I figured there was something obvious there that I missed.  The most embarassing part is that I've used fully qualified names for widget pointers in slots many times already, just had a brain fart.  Thanks for putting me back on track.