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
New Contributor
Posts: 7
Registered: ‎06-20-2013
My Device: Developer
My Carrier: Developer

How can I test which kind of object is QObject::sender() ?

[ Edited ]

Hello!

 

I have the following code

 

QObject::connect(
OrientationSupport::instance(),
SIGNAL(orientationAboutToChange(bb::cascades::UIOrientation::Type)),
this,
SLOT(onOrientationAboutToChange(bb::cascades::UIOrientation::Type)));

 

When I receive a signal, I'd like to know if the sender is an OrientationSupport object, how can I test which kind of object is QObject::sender()?

 

Thanks in advance.

 

Highlighted
Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How can I test which kind of object is QObject::sender() ?

welcome to the support forums.

there is no instanceof in c++, you can use dynamic_cast or q_objectcast and check if it results in a nullpointer
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter