12-28-2012 09:39 PM
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.
Solved! Go to Solution.
12-29-2012 02:12 AM
The signal is called checkedChanged(bool). ![]()
Btw I suggest using Qt Creator if you're developing mostly in C++. It has very convenient signals autocompletion feature.
12-29-2012 09:55 AM - edited 12-29-2012 10:21 AM
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)?
12-29-2012 10:54 AM - edited 12-29-2012 10:56 AM
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-BlackBe
p.s. I think the signal is checkedChanged(bool) only but in slot you can omit arguments.
12-29-2012 11:09 AM
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?
12-29-2012 11:31 AM - edited 12-29-2012 11:31 AM
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.