Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Incrementing object values
Forum Updated to NodeBB v4.3 + New Features

Incrementing object values

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 2.1k 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.
  • K Offline
    K Offline
    Kaluss
    wrote on last edited by
    #1

    Hello all,
    Im starting now with QML programming and have small beginner problem. I think I still simply do not get bindig thing :)

    What I want to do:
    In case of each pressing button I want to rotate some image by adding additional 45 degrees. But how I can increment the rotation value?
    @
    states: State{
    name: "move"
    PropertyChanges {
    target: buttonImage
    rotation: 45
    }
    }

    Currently I got smthg like:
    transitions: Transition {
    RotationAnimation{
    duration: 500
    direction: RotationAnimation.Clockwise
    }
    @

    If I set: rotation: buttonImage + 45 i got binding loop.

    Anybody knows?
    BR
    Thomas

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vincent007
      wrote on last edited by
      #2

      rotation: rotation + 45
      Does it work?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kaluss
        wrote on last edited by
        #3

        Like I said before:
        QML Image: Binding loop detected for property "rotation"

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stevenceuppens
          wrote on last edited by
          #4

          Hi,

          @
          import QtQuick 2.1
          import QtQuick.Window 2.1
          import QtQuick.Controls 1.1

          Window {
          visible: true
          width: 360
          height: 400

          color: "grey"
          
          Button {
              id: myButton
          
              anchors.horizontalCenter: parent.horizontalCenter
              anchors.top: parent.top
              anchors.topMargin: 20
          
              text: "rotate the box"
          
              onClicked: box.rotation = box.rotation + 45
          }
          
          // can be replaced by image
          Rectangle {
              id: box
          
              width: 100
              height: 100
          
              color: "blue"
          
              y: 200
              x: (parent.width - width) / 2
          
              Behavior on rotation {
                  NumberAnimation { duration: 200 }
              }
          }
          

          }
          @

          Steven CEUPPENS
          Developer / Architect
          Mobile: +32 479 65 93 10

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kaluss
            wrote on last edited by
            #5

            Ok, its working, but it doesn't animate the transform like when we use:
            @
            states: State{
            name: "move"
            PropertyChanges {
            target: buttonImage
            rotation: 45
            }
            }
            transitions: Transition {
            RotationAnimation{
            duration: 500
            direction: RotationAnimation.Clockwise
            }
            }
            @

            [edit: added missing coding tags SGaist]

            1 Reply Last reply
            0
            • K Offline
              K Offline
              Kaluss
              wrote on last edited by
              #6

              Ahh sry :)
              My bad.
              You are right...
              Didnt read to the end :P

              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