Unable to get the qt creator qt components quickstart example working



  • 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 value 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-snapshot/creator-qml-components-example.html
    Can anyone help me solve the problem.



  • The link you have provided is broken :(



  • my apologies. but i think admin has corrected the link now.



  • You tried with the script : runOutOfBattery.qs, right ?



  • yep, i tried both runOutofBattery.qs and changing it manually in simulator. for both of them, changes are not reflected in progressbar value. I also tested it on symbian device. same problem. so i am guessing somehow i am not able to connect the signal. btw were u able to get it right on your machine.



  • No, i haven't tried on the device yet.



  • I am having problem with this too. I am using Qt SDK 1.1.4 that comes with Qt 4.7.4
    Progress bar is showing the correct percentage of the battery on startup. I guess that is because of this part of the code
    @ProgressBar {
    ...
    value: deviceinfo.batteryLevel
    }@

    And it is not changing on battery level change. I guess it is because of this code:
    @
    DeviceInfo {
    id: deviceinfo

         Component.onCompleted: {
             deviceinfo.startBatteryLevelChanged();
         }
         onBatteryLevelChanged: {
              progressbar1.value = batteryLevel
          }@
    

    I have managed to google out that deviceinfo.startBatteryLevelChanged() should be replaced with the property in QtMobility 1.2
    http://doc.qt.nokia.com/qtmobility/qml-deviceinfo.html#details
    So I have changed the code to
    @DeviceInfo {
    id:deviceinfo
    Component.onCompleted:{
    monitorBatteryLevelChanges: true
    }
    onBatteryLevelChanged: {
    progressbar1.value= batteryLevel
    }
    }
    @
    It still doesn't work.

    My question is:
    When does onBatteryLevelChanged function gets called? When I press F1 on it there is no help (No documentation available).
    How can I make my progress bar refresh?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.