Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED] qml: battery state changed
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] qml: battery state changed

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spode
    wrote on last edited by
    #1

    hi. could you write me an example where correspondingly to the battery state you have a different image, please? easy!

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      From the "docs :":http://doc.qt.nokia.com/qtmobility-1.1.0-beta/battery-charge-battery-subscriber-battery-subscriber-qml.html

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • S Offline
        S Offline
        spode
        wrote on last edited by
        #3

        vielen Dank!

        @
        import Qt 4.7
        import QtMobility.publishsubscribe 1.1
        import Qt.labs.particles 1.0

        Rectangle {
        //! [1]
        id: visualCharge
        x: 12
        y: 22 + 196 - height
        width: 76
        height: 196 * batteryCharge.value / 100
        clip: true
        color: "green"
        //! [1]

             Particles {
                 id: bubbles
                 width: parent.width
                 anchors.bottom: parent.bottom
                 source: "content/bubble.png"
                 count: 0
                 velocity: 30
                 velocityDeviation: 10
                 angle: -90
                 //lifeSpan: parent.height * 1000 / (velocity + velocityDeviation / 2)
                 lifeSpan: parent.height * 1000 / (30 + 10 / 2)
             }
        
             states: [
             //! [3]
             State {
                 name: "charging"
                 when: batteryCharging.value
                 PropertyChanges {
                     target: bubbles
                     count: batteryCharge.value / 5
                     emissionRate: 5
                 }
             },
             //! [3]
             //! [2]
             State {
                 name: "low"
                 when: batteryCharge.value < 25 && !batteryCharging.value
                 PropertyChanges {
                     target: visualCharge
                     color: "red"
                 }
             }
             //! [2]
             ]
        
             transitions: [
             Transition {
                 from: "*"
                 to: "low"
                 reversible: true
                 ColorAnimation {
                     duration: 200
                 }
             }
             ]
         }
        

        // By Nokia
        @

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          Wilcommen ;)

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved