qt creator qt components quickstart example doest work for me
Hi,
I am new to QML. I was testing the quickstart example in Qt creator 2.3 titled "Creating a Qt Quick Application Using Qt Quick Components", but the progressbar doesnt change when battery level changes in Qt Simulator. Progressbar shows correct value initially, but doesnt reflect the changes according to battery level. I think i am not able to set up the signal properly. Here is the online link to the example : http://doc.qt.nokia.com/qtcreator-sn...s-example.html.
Can anyone help me solve the problem.
krish
Re: qt creator qt components quickstart example doest work for me
Yes... This is not a good example to start with...
I decided too to switch from "classic" widgets to Qt Quick (so kindda newbie here). But as Qt Quick is in big/rapid development there are changes/breaks into code/documentation between QtMobility 1.1 and QtMobility 1.2 (at least in documentation and it seems in libraries as code doesn't work)...
QtMobility 1.2 example:
http://doc.qt.nokia.com/qtmobility-1...o.html#details
QtMobility 1.1 example:
http://doc.qt.nokia.com/qtmobility-1...o.html#details
So in 1.1 to tell system to send signals to your app you should use start* methods:
Quote:
Detailed Description
This element is part of the QtMobility.systeminfo 1.1 module. It is a convience class to make QML usage easier.
Note: To use notification signals, you need to use the start* slots.
Component.onCompleted: {
deviceinfo.startPowerStateChanged();
deviceinfo.startBatteryLevelChanged();
}
But in 1.2, you should use monitor* methods:
Quote:
Detailed Description
This element is part of the QtMobility.systeminfo 1.1 module. It is a convience class to make QML usage easier.
Note: To use notification signals, you need to set the monitor* properties to true.
Even if it's said in docs that:
Quote:
monitorBatteryLevelChanges : bool read-only
Use the monitorBatteryLevelChanges signal.
monitorBatteryLevelChanges is a read-only property it can really be assigned a bool value. So in order to fix the example you should change:
Component.onCompleted: {
//deviceinfo.startBatteryLevelChanged();
deviceinfo.monitorBatteryLevelChanges = true;
}