diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2013-08-05 15:41:11 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-17 13:24:07 +0200 |
commit | 37492efee021ccc6e550ecb67a3240b76eb2219e (patch) | |
tree | 52a8f1bd3a7973e69728f69563948fa10263f03f /examples/quick/dialogs/systemdialogs | |
parent | 7ebd0523e10fee949eec2a05b20e0897c3eeb1ba (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/quick/dialogs/systemdialogs')
-rw-r--r-- | examples/quick/dialogs/systemdialogs/FileDialogs.qml | 11 |
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 + } + } } } } |