Drawer QML Type
스와이프 제스처로 열고 닫을 수 있는 측면 패널. 더 보기...
Import Statement: | import QtQuick.Controls |
Inherits: |
속성
- dragMargin : real
- edge : enumeration
- interactive : bool
(since QtQuick.Controls 2.2 (Qt 5.9))
- position : real
상세 설명
서랍은 터치 인터페이스에서 탐색을 위한 중앙 위치를 제공하기 위해 자주 사용되는 것과 유사한 스와이프 기반 사이드 패널을 제공합니다.
서랍은 콘텐츠 항목의 네 가장자리 중 어느 곳에나 배치할 수 있습니다. 위의 서랍은 창의 왼쪽 가장자리에 배치되어 있습니다. 그런 다음 창 왼쪽 가장자리에서 서랍을 '끌어서 ' 열면 서랍이 열립니다.
import QtQuick import QtQuick.Controls ApplicationWindow { id: window visible: true Drawer { id: drawer width: 0.66 * window.width height: window.height Label { text: "Content goes here!" anchors.centerIn: parent } } }
서랍은 edges 창 중 하나에 있는 특수한 유형의 팝업입니다. 기본적으로 서랍은 overlay
창에 부모를 다시 지정하므로 창 좌표에서 작동합니다. parent 을 수동으로 다른 위치로 설정하여 서랍이 특정 좌표 공간에서 작동하도록 할 수도 있습니다.
서랍은 창 가장자리의 일부만 덮도록 구성할 수 있습니다. 다음 예는 창 헤더 아래에 표시되도록 서랍을 배치하는 방법을 보여줍니다:
import QtQuick import QtQuick.Controls ApplicationWindow { id: window visible: true header: ToolBar { } Drawer { y: header.height width: window.width * 0.6 height: window.height - header.height } }
position 속성은 0.0
과 1.0
사이의 값으로 서랍의 표시 범위를 결정합니다. 왼쪽 또는 오른쪽 창 가장자리에 있는 서랍의 X 좌표(또는 가로 여백) 또는 위쪽 또는 아래쪽 창 가장자리에 있는 서랍의 Y 좌표(또는 세로 여백)는 설정할 수 없습니다.
위 이미지에서는 애플리케이션의 콘텐츠가 화면 전체에 '푸시' 되어 있습니다. 이는 콘텐츠에 번역을 적용하여 이루어집니다:
import QtQuick import QtQuick.Controls ApplicationWindow { id: window width: 200 height: 228 visible: true Drawer { id: drawer width: 0.66 * window.width height: window.height } Label { id: content text: "Aa" font.pixelSize: 96 anchors.fill: parent verticalAlignment: Label.AlignVCenter horizontalAlignment: Label.AlignHCenter transform: Translate { x: drawer.position * content.width * 0.33 } } }
서랍이 열렸을 때 애플리케이션의 콘텐츠가 그대로 유지되도록 하려면 번역을 적용하지 마세요.
서랍은 non-modal 및 non-interactive 을 만들어 닫을 수 없는 영구 사이드 패널로 구성할 수 있습니다. 자세한 내용은 갤러리 예시를 참조하세요.
참고: 일부 플랫폼에서는 특정 가장자리가 시스템 제스처용으로 예약되어 있어 Drawer와 함께 사용할 수 없을 수 있습니다. 예를 들어 Android 및 iOS에서는 상단 및 하단 가장자리가 시스템 알림 및 제어 센터용으로 예약되어 있을 수 있습니다.
SwipeView, 드로어, 탐색 컨트롤 및 팝업 컨트롤 사용자 지정하기를참조하세요 .
속성 문서
dragMargin : real |
이 속성은 드래그 동작으로 서랍이 열리는 화면 가장자리로부터의 거리를 보유합니다. 값을 0
이하로 설정하면 끌어서 서랍을 열지 못합니다.
기본값은 Application.styleHints.startDragDistance
입니다.
interactive 를참조하세요 .
edge : enumeration |
이 속성은 서랍이 열릴 창의 가장자리를 보유합니다. 허용되는 값은 다음과 같습니다:
Constant | 설명 |
---|---|
Qt.TopEdge | 창의 위쪽 가장자리입니다. |
Qt.LeftEdge | 창의 왼쪽 가장자리(기본값). |
Qt.RightEdge | 창의 오른쪽 가장자리. |
Qt.BottomEdge | 창의 아래쪽 가장자리입니다. |
interactive : bool |
이 속성은 서랍이 대화형인지 여부를 나타냅니다. 비대화형 서랍은 스와이프에 반응하지 않습니다.
기본값은 true
입니다.
이 속성은 QtQuick.Controls 2.2(Qt 5.9)에서 도입되었습니다.
dragMargin 를참조하십시오 .
position : real |
이 속성은 최종 목적지를 기준으로 서랍의 위치를 유지합니다. 즉, 서랍이 완전히 닫혀 있으면 위치는 0.0
, 완전히 열리면 1.0
입니다.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.