[Interest] MouseAreas in QtQuick 2 Flipable
Michael Andersen
michael at steelcode.com
Sat Apr 20 10:18:09 CEST 2013
Some missing information: I am using Qt 5.0.1
If a reproducer is required, here is an example QML file
The expected behaviour is that when flipped, and the blue square is
clicked, "Back clicked" will be printed to the console. In reality, "Front
clicked" still gets printed.
//- - - - -8< - - - - - -
import QtQuick 2.0
Rectangle {
width: 500
height: 500
Rectangle { //Button to flip sides
height: 50; width: 150;
color:"grey"
anchors.top:parent.top; anchors.left:parent.left
MouseArea{
anchors.fill:parent
onClicked: flipable.flipped = !flipable.flipped}
Text{anchors.centerIn:parent;text:"Flip sides"}
}
Flipable {
id: flipable
front: Rectangle {
color: "red"
anchors.fill: parent
MouseArea {
anchors.fill:parent
onClicked: {console.log("Front clicked");}
}
}
back: Rectangle {
color: "blue"
anchors.fill: parent
MouseArea {
anchors.fill:parent
onClicked: {console.log("Back clicked");}
}
}
anchors.fill: parent
anchors.topMargin: 50
property bool flipped: false
transform: Rotation {
id: rotation
origin.x: flipable.width/2
origin.y: flipable.height/2
axis.x: 0; axis.y: 1; axis.z: 0
angle: 0
}
states: State {
name: "back"
PropertyChanges { target: rotation; angle: 180 }
when: flipable.flipped
}
transitions: Transition {
NumberAnimation { target: rotation; property: "angle";}
}
}
}
//- - - - -8< - - - - - -
On 20 April 2013 10:05, Michael Andersen <michael at steelcode.com> wrote:
> Hi list,
>
> I'm using a Flipable as a container for two pages of controls that
> naturally include MouseAreas. I think I might be misunderstanding the
> purpose of the Flipable because when it is flipped and the back is
> showing, the MouseAreas in the front (now invisible) side still capture the
> mouse clicks.
>
> Is this a bug or intended behaviour?
>
> Regards
> Michael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130420/13dd9973/attachment.html>
More information about the Interest
mailing list