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


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.


Reply
Highlighted
Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA
Accepted Solution

ToggleButton slots signal problem

Trying to connect a signal to a slot:

 

connect(myToggleButton, SIGNAL(checkChanged(bool)), myDataClass, SLOT(setMyValueOn(bool)));

 In myDataClass.hpp:

public slots:
  void setMyValueOn(bool valueOn);

 In the cpp file:

void MyDataClass::setMyValueOn(bool valueOn)
{
  // never called
}

 I've the MyDataClass is a subclass of QObject and has Q_OBJECT in the appropraite place in the hpp file.

 

I think I'm using the toggle switch incorrectly.

 

 

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: ToggleButton slots signal problem

The signal is called checkedChanged(bool). Smiley Happy

 

Btw I suggest using Qt Creator if you're developing mostly in C++. It has very convenient signals autocompletion feature. 

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: ToggleButton slots signal problem

[ Edited ]
The signal is called checkedChanged(bool)

oh, jeez. 

This stopped my work last night.  Would be nice if it let us know the signature is incorrect when building.

 

QT Creator: Are you referring to this one:

http://qt-project.org/downloads

 

Or something made from BB?

 

Also, does onCheckedChanged() emit a signal, or only checkedChanged(bool)?

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: ToggleButton slots signal problem

[ Edited ]

QT creator: yes. It's a pain to setup but speeds up the development considerably. It's very lightweight and fast, has better Qt classes support, can compile multiple files in parallel. Even deployment is faster somehow.

 

Version 2.6+ has QNX plugin (it's enabled by default) which allows deploying to BB10. It works with Cascades, haven't tried to setup QML though. And there is no preview support for QML.

 

I'm using it on MacOS. There were problems on Windows, but didn't investigate them. Maybe I made a mistake during setup.

 

Setup instructions:

http://qt-project.org/wiki/Qt-Creator-with-BlackBerry-10

 

p.s. I think the signal is checkedChanged(bool) only but in slot you can omit arguments.

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: ToggleButton slots signal problem

I saw the onCheckedChanged() method and thought it could be used; that also threw me for a loop yesterday.

 

One last thing, in the class destructor, is it necesary to disconnect signals, or does this process happen automatically?

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: ToggleButton slots signal problem

[ Edited ]

It happens automatically, but in some cases (multithreaded apps) deleteLater() is needed. Check QObject::~QObject description at http://doc.qt.digia.com/qt/qobject.html for details.

 


Andrey Fidrya, @zmeyc on twitter