Hi,
I'm not sure if there is similar topic about this issue - so if yes please just
if forward me to there and accept my excuses. thanks
I'm trying to create very simple example with states and anchors. In general
what I want to do is click a button and "glue" a rectangle to the top-right,
then click another button and stuck it to the bottom-left. But it seems that
anchors.(bottom|left|right|top) stay remembered after the state is changed to
the other one. I tried to some-how zero the andhors.(bottom|left|right|top),
but it did not work with null, null, 0, "" and other stuff I've tried.
Example:
import QtQuick 1.0
Rectangle {
width: 800
height: 600
color: "red"
Rectangle {
id: tricky
width: 100
height: 100
states: [
State {
name: "glued-to-right"
PropertyChanges {
target: tricky
anchors.right: parent.right
anchors.top: parent.top
}
},
State {
name: "glued-to-bottom"
PropertyChanges {
target: tricky
anchors.bottom: parent.bottom
anchors.left: parent.left
}
}
]
}
Rectangle {
width: 100
height: 100
color: "green"
x: 100
y: 100
Text {
text: "click me #1"
}
MouseArea {
anchors.fill: parent
onClicked: {
tricky.state = "glued-to-right"
}
}
}
Rectangle {
width: 100
height: 100
color: "green"
x: 200
y: 100
Text {
text: "click me #2"
}
MouseArea {
anchors.fill: parent
onClicked: {
tricky.state = "glued-to-bottom"
}
}
}
}
So please if someone know how I can de-tack from anchors or some-how ignore
already anchored attribute please help. If it's not possible it would be also
good to know.
Thanks,
Ivo
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-qml