aboutsummaryrefslogtreecommitdiffstats
path: root/examples/window/window/standalone.qml
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2012-10-22 13:44:21 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-09 13:33:19 +0100
commitfdcde738e585ea0e9912215901e36590ebba7fdf (patch)
tree951d7e27b9449cf906368ecf43265cf866f2a1f2 /examples/window/window/standalone.qml
parente35c6a788a887d7a85a836041e7d8e9a5ee48c46 (diff)
Examples and fixes for QML Window properties
Setting Window.color in QML takes effect immediately. It was only possible to set the property at startup. Examples demonstrate new Window property features. Change-Id: Ic5b43d0d84371f3fe5c42223ccc98e6de27aed10 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'examples/window/window/standalone.qml')
-rw-r--r--examples/window/window/standalone.qml55
1 files changed, 47 insertions, 8 deletions
diff --git a/examples/window/window/standalone.qml b/examples/window/window/standalone.qml
index 079694cc10..a06db633a7 100644
--- a/examples/window/window/standalone.qml
+++ b/examples/window/window/standalone.qml
@@ -44,13 +44,29 @@ import QtQuick.Window 2.0
Item {
width: 320
height: 240
+ // It's not possible to set an Item's windowTitle. If you want to modify
+ // window properties, you need to explicitly create a Window.
Text {
+ id: text1
anchors.centerIn: parent
text: "First Window"
}
Rectangle {
border.color: "black"
- color: childWindow.visible ? "green" : "yellow"
+ radius: 4
+ anchors.top: text1.bottom
+ anchors.horizontalCenter: text1.horizontalCenter
+ width: 100
+ height: 30
+ TextInput {
+ id: ti1
+ focus: true // but the modal popup will prevent input while it is open
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ border.color: "black"
+ color: childWindow.visible ? "goldenrod" : "beige"
radius: height / 4
anchors.bottom: parent.bottom
anchors.right: parent.right
@@ -72,16 +88,39 @@ Item {
id: childWindow
width: 320
height: 240
- x: 320
- y: 240
- color: "green"
+ x: 220
+ y: 120
+ color: "beige"
+ title: "Second Window"
+ modality: Qt.ApplicationModal
+ flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
Text {
+ id: text2
anchors.centerIn: parent
- text: "Second Window"
+ text: "Modal Frameless Stay-on-Top Window"
}
- MouseArea{
- anchors.fill: parent
- onClicked: Qt.quit()
+ Text {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.margins: 10
+ text: "X"
+ MouseArea{
+ anchors.fill: parent
+ onClicked: childWindow.visible = false
+ }
+ }
+ Rectangle {
+ border.color: "black"
+ radius: 4
+ anchors.top: text2.bottom
+ anchors.horizontalCenter: text2.horizontalCenter
+ width: 100
+ height: 30
+ TextInput {
+ id: ti2
+ focus: true
+ anchors.centerIn: parent
+ }
}
}
}