Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37072

MouseArea in Flipable: different behavior between QtQuick 1.1 and 2.0

    XMLWordPrintable

Details

    • a4a8ee48b09e578a1515dbea4fedace849c7e465

    Description

      import QtQuick 2.0
      Flipable {
          id: flipable
          width: 240
          height: 240
          property bool flipped: false
          front: Rectangle {
              width: 100;
              height: 100;
              color: "pink";
              anchors.centerIn: parent;
              MouseArea{
                  anchors.fill: parent;
                  onClicked: {
                      flipable.flipped = !flipable.flipped;
                      console.log("Pink");
                  }
              }
          }
          back: Rectangle {
              width: 100;
              height: 100;
              color: "green";
              anchors.centerIn: parent;
              MouseArea{
                  anchors.fill: parent;
                  onClicked: {
                      flipable.flipped = !flipable.flipped;
                      console.log("Green");
                  }
              }
          }
          transform: Rotation {
              id: rotation
              origin.x: flipable.width/2
              origin.y: flipable.height/2
              axis.x: 0; axis.y: 1; axis.z: 0     // set axis.y to 1 to rotate around y-axis
              angle: 0    // the default angle
          }
          states: State {
              name: "back"
              PropertyChanges { target: rotation; angle: 180 }
              when: flipable.flipped
          }
          transitions: Transition {
              NumberAnimation { target: rotation; property: "angle"; duration: 0 }
          }
      }
      

      QtQuick 1.1: Mousearea of front Rectangle and back Rectangle working properly: means onclick event prints “Pink” in front, and prints “Green” in back state.

      QtQuick 2.0: Mousearea of front Rectangle and back Rectangle not working properly: means onclick event prints “Pink” in front, and prints “Pink” in back state.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            w00t Robin Burchell
            g.girija9008@gmail.com Girija
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes