diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/Drawer.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/material/Drawer.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/universal/Drawer.qml | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquickdrawer.cpp | 22 |
4 files changed, 28 insertions, 0 deletions
diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml index 8cf4e5e5..9791bf0c 100644 --- a/src/imports/controls/Drawer.qml +++ b/src/imports/controls/Drawer.qml @@ -40,6 +40,8 @@ import QtQuick.Templates 2.0 as T T.Drawer { id: control + parent: T.ApplicationWindow.overlay + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) diff --git a/src/imports/controls/material/Drawer.qml b/src/imports/controls/material/Drawer.qml index b3ee94f7..1c15e689 100644 --- a/src/imports/controls/material/Drawer.qml +++ b/src/imports/controls/material/Drawer.qml @@ -42,6 +42,8 @@ import QtQuick.Controls.Material.impl 2.0 T.Drawer { id: control + parent: T.ApplicationWindow.overlay + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) diff --git a/src/imports/controls/universal/Drawer.qml b/src/imports/controls/universal/Drawer.qml index 95fef8d1..84831323 100644 --- a/src/imports/controls/universal/Drawer.qml +++ b/src/imports/controls/universal/Drawer.qml @@ -41,6 +41,8 @@ import QtQuick.Controls.Universal 2.0 T.Drawer { id: control + parent: T.ApplicationWindow.overlay + implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index 0f5e5824..4c850473 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -69,6 +69,28 @@ QT_BEGIN_NAMESPACE of the window. \endtable + \code + import QtQuick 2.7 + import QtQuick.Controls 2.0 + + ApplicationWindow { + id: window + visible: true + + Drawer { + id: drawer + width: 0.66 * window.width + height: window.height + } + } + \endcode + + Drawer is a special type of popup that resides at one of the window \l {edge}{edges}. + By default, Drawer re-parents itself to the window \l {ApplicationWindow::}{overlay}, + and therefore operates on window coordinates. It is also possible to manually set the + \l {Popup::}{parent} to something else to make the drawer operate in a specific + coordinate space. + In the image above, the application's contents are \e "pushed" across the screen. This is achieved by applying a translation to the contents: |