summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-08-20 04:53:22 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-08-20 04:53:22 (GMT)
commit43c2a627123d9f4a884dbe96e1ef6dbde02e50d5 (patch)
tree5e89b664a1203dea4be334511553324cb339c9c9 /demos
parentbf7aafc435e26a2938a2cc211a249c6e140b41fc (diff)
downloadQt-43c2a627123d9f4a884dbe96e1ef6dbde02e50d5.zip
Qt-43c2a627123d9f4a884dbe96e1ef6dbde02e50d5.tar.gz
Qt-43c2a627123d9f4a884dbe96e1ef6dbde02e50d5.tar.bz2
Add a quit button to declarative examples in QtDemo
Diffstat (limited to 'demos')
-rw-r--r--demos/qtdemo/qmlShell.qml58
1 files changed, 25 insertions, 33 deletions
diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml
index b5fdf39..b8a019e 100644
--- a/demos/qtdemo/qmlShell.qml
+++ b/demos/qtdemo/qmlShell.qml
@@ -100,6 +100,30 @@ Item {
}
}
+ Rectangle{ id: closeButton
+ width: 24
+ height: 24
+ z: 11
+ border.color: "#aaaaaaaa"
+ gradient: Gradient{
+ GradientStop{ position: 0.0; color: "#34FFFFFF" }
+ GradientStop{ position: 1.0; color: "#7AFFFFFF" }
+ }
+ anchors.left: frame.right
+ anchors.bottom: frame.top
+ anchors.margins: -(2*width/3)
+ Text{
+ text: 'X'
+ font.bold: true
+ color: "white"
+ font.pixelSize: 12
+ anchors.centerIn: parent
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: main.show = false;
+ }
+ }
Text{
id: errorTxt
@@ -116,32 +140,6 @@ Item {
onLinkActivated: Qt.openUrlExternally(link);
}
}
- Rectangle{
- id: helpLabel
- property bool timedOut: false
- z: 9
- //Positioned in the top left corner
- x: 8
- y: 8
- color: "white"
- border.color: "black"
- border.width: 1
- width: helpText.width + 16
- height: helpText.height + 8
- Text{
- id: helpText
- color: "black"
- anchors.centerIn: parent
- text: "Click outside the example to exit it."
- }
- opacity: 0
- Behavior on opacity{ NumberAnimation{duration:500} }
- Timer{
- id: helpTimer
- interval: 5000
- onTriggered: {helpLabel.timedOut=true}
- }
- }
Rectangle{ id: blackout //Maybe use a colorize effect instead?
z: 8
anchors.fill: parent
@@ -154,7 +152,6 @@ Item {
hoverEnabled: main.show //To steal focus from the buttons
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
anchors.fill: parent
- onClicked: main.show=false;
}
states: [
@@ -166,10 +163,6 @@ Item {
opacity: 1
}
PropertyChanges {
- target: helpLabel
- opacity: helpLabel.timedOut?0:1
- }
- PropertyChanges {
target: blackout
opacity: 0.5
}
@@ -178,8 +171,7 @@ Item {
transitions: [//Should not be too long, because the component has already started running
Transition { from: ''; to: "show"; reversible: true
ParallelAnimation{
- ScriptAction{ script: {helpLabel.timedOut = false; helpTimer.restart();} }
- NumberAnimation{ exclude: helpLabel; properties: "opacity"; easing.type: Easing.InQuad; duration: 500}
+ NumberAnimation{ properties: "opacity"; easing.type: Easing.InQuad; duration: 500}
PropertyAction { target: loader; property: "focus"; value: true}//Might be needed to ensure the focus stays with us
}
}