![]() |
Qt 6.x
The Qt SDK
|
Side panel that can be opened and closed using a swipe gesture. More...
Additional Inherited Members | |
![]() | |
void | itemGeometryChanged (QQuickItem *, QQuickGeometryChange, const QRectF &) override |
void | itemParentChanged (QQuickItem *, QQuickItem *parent) override |
void | itemChildRemoved (QQuickItem *, QQuickItem *child) override |
void | removeAncestorListeners (QQuickItem *item) |
void | addAncestorListeners (QQuickItem *item) |
![]() | |
bool | m_positioning = false |
QQuickItem * | m_parentItem = nullptr |
QQuickPopup * | m_popup = nullptr |
qreal | m_popupScale = 1.0 |
Side panel that can be opened and closed using a swipe gesture.
\qmltype Drawer \inherits Popup
! \instantiates QQuickDrawer \inqmlmodule QtQuick.Controls
Drawer provides a swipe-based side panel, similar to those often used in touch interfaces to provide a central location for navigation.
Drawer can be positioned at any of the four edges of the content item. The drawer above is positioned against the left edge of the window. The drawer is then opened by "dragging" it out from the left edge of the window.
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 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.
Drawer can be configured to cover only part of its window edge. The following example illustrates how Drawer can be positioned to appear below a window header:
The \l position property determines how much of the drawer is visible, as a value between 0.0
and 1.0
. It is not possible to set the x-coordinate (or horizontal margins) of a drawer at the left or right window edge, or the y-coordinate (or vertical margins) of a drawer at the top or bottom window edge.
In the image above, the application's contents are "pushed" across the screen. This is achieved by applying a translation to the contents:
If you would like the application's contents to stay where they are when the drawer is opened, don't apply a translation.
Drawer can be configured as a non-closable persistent side panel by making the Drawer \l {Popup::modal}{non-modal} and \l {interactive} {non-interactive}. See the \l {Qt Quick Controls 2 - Gallery}{Gallery} example for more details.
Definition at line 141 of file qquickdrawer.cpp.
|
inline |
Definition at line 144 of file qquickdrawer.cpp.
|
overridevirtual |
Reimplemented from QQuickPopupPositioner.
Definition at line 189 of file qquickdrawer.cpp.
References Qt::BottomEdge, QQuickDrawer::edge, QQuickItem::height, Qt::LeftEdge, QQuickPopupPositioner::m_positioning, QQuickPopupPositioner::popup(), position(), QQuickDrawer::position, QQuickPopupPositioner::reposition(), Qt::RightEdge, QQuickItem::setX(), QQuickItem::setY(), Qt::TopEdge, QQuickItem::width, and window().