aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-08-05 15:41:11 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-17 13:24:07 +0200
commit37492efee021ccc6e550ecb67a3240b76eb2219e (patch)
tree52a8f1bd3a7973e69728f69563948fa10263f03f /examples
parent7ebd0523e10fee949eec2a05b20e0897c3eeb1ba (diff)
Qt Quick Dialogs: can see and control geometry of QML implementations
QQuickAbstractDialog had x/y/width/height properties already but they didn't do anything. It's still not possible with the native dialogs because neither QPlatformDialogHelper nor QFileDialogOptions etc. have any geometric properties; but the application author can now see and control the geometry of any QML dialog implementation. Change-Id: Icdac9592c72e81175436436027f7fe3d75ff7f42 Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/dialogs/systemdialogs/FileDialogs.qml11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/quick/dialogs/systemdialogs/FileDialogs.qml b/examples/quick/dialogs/systemdialogs/FileDialogs.qml
index 508466da0c..dca47ae1fd 100644
--- a/examples/quick/dialogs/systemdialogs/FileDialogs.qml
+++ b/examples/quick/dialogs/systemdialogs/FileDialogs.qml
@@ -40,6 +40,7 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.0
+import QtQuick.Window 2.0
import "../../shared"
Rectangle {
@@ -174,6 +175,16 @@ Rectangle {
// TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet.
onClicked: fileDialog.folder = "/tmp" // file:///tmp would also be OK
}
+ Button {
+ text: "set geometry"
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: {
+ fileDialog.width = Math.min(512, Screen.width * 0.9)
+ fileDialog.height = Math.min(340, Screen.height * 0.9)
+ fileDialog.x = (Screen.width - fileDialog.width) / 2
+ fileDialog.y = (Screen.height - fileDialog.height) / 2
+ }
+ }
}
}
}