SwipeView QML Type
사용자가 옆으로 스와이프하여 페이지를 탐색할 수 있습니다. 더 보기...
Import Statement: | import QtQuick.Controls |
Inherits: |
속성
- horizontal : bool
(since QtQuick.Controls 2.3 (Qt 5.10))
- interactive : bool
(since QtQuick.Controls 2.1 (Qt 5.8))
- orientation : enumeration
(since QtQuick.Controls 2.2 (Qt 5.9))
- vertical : bool
(since QtQuick.Controls 2.3 (Qt 5.10))
첨부 속성
- index : int
- isCurrentItem : bool
- isNextItem : bool
(since QtQuick.Controls 2.1 (Qt 5.8))
- isPreviousItem : bool
(since QtQuick.Controls 2.1 (Qt 5.8))
- view : SwipeView
자세한 설명
스와이프뷰는 스와이프 기반 탐색 모델을 제공합니다.
스와이프뷰는 페이지 집합으로 채워집니다. 한 번에 한 페이지씩 표시됩니다. 사용자는 옆으로 스와이프하여 페이지 사이를 이동할 수 있습니다. 스와이프뷰 자체는 완전히 비시각적이라는 점에 유의하세요. 사용자에게 여러 페이지가 있다는 시각적 단서를 제공하기 위해 PageIndicator 와 결합하는 것이 좋습니다.
SwipeView { id: view currentIndex: 1 anchors.fill: parent Item { id: firstPage } Item { id: secondPage } Item { id: thirdPage } } PageIndicator { id: indicator count: view.count currentIndex: view.currentIndex anchors.bottom: view.bottom anchors.horizontalCenter: parent.horizontalCenter }
위에 표시된 것처럼 SwipeView는 일반적으로 뷰의 자식으로 인라인으로 정의된 정적 페이지 집합으로 채워집니다. add , insert, move, remove 페이지를 런타임에 동적으로 채울 수도 있습니다.
SwipeView가 TabBar 와 같은 다른 컨테이너와 쌍을 이루는 경우 각 컨트롤의 currentIndex 속성 간에 양방향 바인딩을 만들어야 합니다. 바인딩을 깨지 않고 이 작업을 수행하려면 currentIndex
를 직접 설정하지 말고 대신 setCurrentIndex() 등을 사용하세요. 자세한 내용은 Managing the Current Index 을 참조하세요.
currentIndex
변경 시 작업을 수행하려면 onCurrentIndexChanged
속성 변경 신호 처리기를 사용합니다:
onCurrentIndexChanged: { print("currentIndex changed to", currentIndex) // ... }
일반적으로 스와이프뷰에 과도한 양의 페이지를 추가하는 것은 바람직하지 않습니다. 그러나 페이지의 양이 많아지거나 개별 페이지가 상대적으로 복잡한 경우에는 사용자가 바로 접근할 수 없는 페이지를 언로드하여 리소스를 확보하는 것이 바람직할 수 있습니다. 다음 예는 Loader 을 사용하여 최대 3개의 페이지를 동시에 인스턴스화하는 방법을 보여줍니다.
SwipeView { Repeater { model: 6 Loader { active: SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem sourceComponent: Text { text: index Component.onCompleted: console.log("created:", index) Component.onDestruction: console.log("destroyed:", index) } } } }
참고: 스와이프뷰는 뷰에 추가된 항목의 지오메트리 관리를 대신합니다. 항목에 앵커를 사용하는 것은 지원되지 않으며 width
또는 height
할당은 뷰에 의해 재정의됩니다. 이는 항목의 루트에만 적용됩니다. 너비와 높이를 지정하거나 하위 항목에 앵커를 사용하면 예상대로 작동합니다.
TabBar, PageIndicator, 스와이프뷰, 탐색 컨트롤, 컨테이너 컨트롤 및 포커스 관리 사용자 지정하기( Qt Quick Controls )를참조하세요 .
속성 문서
horizontal : bool |
interactive : bool |
이 속성은 사용자가 SwipeView 와 상호 작용할 수 있는지 여부를 나타냅니다. 사용자는 상호 작용하지 않는 뷰를 스와이프할 수 없습니다.
기본값은 true
입니다.
이 속성은 QtQuick.Controls 2.1(Qt 5.8)에 도입되었습니다.
orientation : enumeration |
이 속성은 방향을 유지합니다.
가능한 값은 다음과 같습니다:
Constant | 설명 |
---|---|
Qt.Horizontal | 가로(기본값) |
Qt.Vertical | Vertical |
이 프로퍼티는 QtQuick.Controls 2.2 (Qt 5.9)에 도입되었습니다.
horizontal 및 vertical 을참조하십시오 .
vertical : bool |
첨부된 속성 문서
SwipeView.isCurrentItem : bool |
이 자식이 현재 항목인 경우 이 첨부 프로퍼티는 true
입니다.
SwipeView 의 각 하위 항목에 첨부됩니다.
SwipeView.isNextItem : bool |
이 하위 항목이 다음 항목인 경우 이 첨부 속성은 true
입니다.
SwipeView 의 각 자식 항목에 첨부됩니다.
이 프로퍼티는 QtQuick.Controls 2.1(Qt 5.8)에 도입되었습니다.
SwipeView.isPreviousItem : bool |
이 자식이 이전 항목인 경우 이 첨부된 속성은 true
입니다.
SwipeView 의 각 자식 항목에 첨부됩니다.
이 프로퍼티는 QtQuick.Controls 2.1 (Qt 5.8)에 도입되었습니다.
SwipeView.view : SwipeView |
이 첨부된 속성은 이 자식 항목을 관리하는 뷰를 보유합니다.
SwipeView 의 각 자식 항목에 첨부됩니다.
© 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.