aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-21 11:56:08 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-21 21:39:41 +0000
commit175d0ea3f80af0ca32baec489d8ea66dd4ee3418 (patch)
tree2e4d30797a32967195b9db1dccde0bb8b8f119e5 /src/quicktemplates2
parentaae5b793666091a780e63b68b2a0426f8edd6174 (diff)
Drawer: reparent to the overlay by default
Drawer is a special type of popup that always resides at one of the window edges. Therefore it makes sense for drawers to operate on window coordinates. Re-parenting drawers to the window overlay achieves that. Now that the window overlay is guaranteed to always exist and the ApplicationWindow.overlay attached property works even with plain QML Window, we can reliably use it as a parent for Drawer. Task-number: QTBUG-53168 Change-Id: I37c727001350217ea1d2d9c52d73b4cae44d7c8d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp22
1 files changed, 22 insertions, 0 deletions
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: