SplitView QML Type
각 항목 사이에 드래그 가능한 분할기를 사용하여 항목을 배치합니다. 더 보기...
Import Statement: | import QtQuick.Controls |
Inherits: |
속성
- handle : Component
- orientation : enumeration
- resizing : bool
첨부 속성
- fillHeight : bool
- fillWidth : bool
- maximumHeight : real
- maximumWidth : real
- minimumHeight : real
- minimumWidth : real
- preferredHeight : real
- preferredWidth : real
- view : SplitView
방법
- bool restoreState(state)
- var saveState()
자세한 설명
SplitView는 각 항목 사이에 드래그 가능한 분할기를 사용하여 항목을 가로 또는 세로로 배치하는 컨트롤입니다.
SplitView는 관리하는 항목에 다음과 같은 첨부 프로퍼티를 지원합니다:
- SplitView.minimumWidth
- SplitView.minimumHeight
- SplitView.preferredWidth
- SplitView.preferredHeight
- SplitView.maximumWidth
- SplitView.maximumHeight
- SplitView.fillWidth (하나의 자식에 대해서만 참)
- SplitView.fillHeight (하나의 자식에 대해서만 참)
또한 각 핸들에는 다음과 같은 읽기 전용 첨부 프로퍼티가 있습니다:
참고: 핸들은 이벤트를 처리하지 않고 순수하게 시각적이어야 하며, 마우스오버 및 누른 상태를 방해할 수 있으므로 이벤트를 처리해서는 안 됩니다.
분할 보기에서 선호하는 항목의 크기는 implicitWidth 및 implicitHeight 또는 SplitView.preferredWidth
및 SplitView.preferredHeight
에서 지정할 수 있습니다:
가로 분할 뷰의 경우 각 항목의 기본 높이가 뷰의 높이에 맞게 조정되므로 각 항목의 기본 높이를 지정할 필요가 없습니다. 세로 보기의 경우 반대로 적용됩니다.
분할 핸들을 끌면 뷰의 orientation 에 따라 SplitView.preferredWidth
또는 SplitView.preferredHeight
속성을 덮어씁니다.
가로 보기에서 항목의 크기를 제한하려면 다음 속성을 사용합니다:
SplitView { anchors.fill: parent Item { SplitView.minimumWidth: 25 SplitView.preferredWidth: 50 SplitView.maximumWidth: 100 } // ... }
세로 보기에서 항목의 크기를 제한하려면 다음 속성을 사용합니다:
SplitView { anchors.fill: parent orientation: Qt.Vertical Item { SplitView.minimumHeight: 25 SplitView.preferredHeight: 50 SplitView.maximumHeight: 100 } // ... }
SplitView.fillWidth
분할 보기에는 항상 true
(또는 SplitView.fillHeight
, orientation 이 Qt.Vertical
인 경우)로 설정된 항목(채우기 항목)이 하나씩 있습니다. 즉, 다른 항목이 배치된 후 남은 공간을 모두 해당 항목이 차지하게 됩니다. 기본적으로 SplitView의 마지막에 보이는 자식에 이 설정이 적용되지만 다른 항목에서 fillWidth
을 true
으로 명시적으로 설정하여 변경할 수 있습니다.
핸들은 왼쪽이나 위쪽 또는 오른쪽이나 아래쪽에 있는 항목에 속할 수 있습니다:
- 채우기 항목이 오른쪽에 있는 경우 핸들은 왼쪽 항목에 속합니다.
- 채우기 항목이 왼쪽에 있는 경우: 핸들은 오른쪽 항목에 속합니다.
세 개의 항목이 있는 SplitView를 만들고 가운데 항목에 불필요한 공간을 확보하려면 다음과 같이 하면 됩니다:
SplitView { anchors.fill: parent orientation: Qt.Horizontal Rectangle { implicitWidth: 200 SplitView.maximumWidth: 400 color: "lightblue" Label { text: "View 1" anchors.centerIn: parent } } Rectangle { id: centerItem SplitView.minimumWidth: 50 SplitView.fillWidth: true color: "lightgray" Label { text: "View 2" anchors.centerIn: parent } } Rectangle { implicitWidth: 200 color: "lightgreen" Label { text: "View 3" anchors.centerIn: parent } } }
SplitView의 상태 직렬화하기
SplitView의 주요 목적은 사용자가 다양한 UI 요소의 크기를 쉽게 구성할 수 있도록 하는 것입니다. 또한 사용자가 선호하는 크기를 여러 세션에 걸쳐 기억해야 합니다. 이를 위해 saveState() 및 restoreState() 함수를 사용하여 SplitView.preferredWidth
및 SplitView.preferredHeight
속성 값을 직렬화할 수 있습니다:
import QtCore import QtQuick.Controls ApplicationWindow { // ... Component.onCompleted: splitView.restoreState(settings.splitView) Component.onDestruction: settings.splitView = splitView.saveState() Settings { id: settings property var splitView } SplitView { id: splitView // ... } }
또는 Settings 의 value() 및 setValue() 함수를 사용할 수 있습니다:
import QtCore import QtQuick.Controls ApplicationWindow { // ... Component.onCompleted: splitView.restoreState(settings.value("ui/splitview")) Component.onDestruction: settings.setValue("ui/splitview", splitView.saveState()) Settings { id: settings } SplitView { id: splitView // ... } }
SplitHandle, SplitView 사용자 지정하기 및 컨테이너 컨트롤을참조하세요 .
속성 문서
handle : Component |
이 프로퍼티는 핸들 컴포넌트를 보유합니다.
이 컴포넌트의 인스턴스는 count
이 1
보다 크면 count - 1
번 인스턴스화됩니다.
다음 표는 분할 보기의 방향에 따라 각 핸들의 크기가 조정되는 방식을 설명합니다:
방향 | 핸들 너비 | 핸들 높이 |
---|---|---|
Qt.Horizontal | implicitWidth | SplitView 의 height . |
Qt.Vertical | SplitView 의 width . | implicitHeight |
시각적 크기를 변경하지 않고 마우스 및 터치 이벤트의 핸들 크기를 변경하려면 containmentMask:
SplitView { id: splitView anchors.fill: parent handle: Rectangle { id: handleDelegate implicitWidth: 4 implicitHeight: 4 color: SplitHandle.pressed ? "#81e889" : (SplitHandle.hovered ? Qt.lighter("#c2f4c6", 1.1) : "#c2f4c6") containmentMask: Item { x: (handleDelegate.width - width) / 2 width: 64 height: splitView.height } } Rectangle { implicitWidth: 150 color: "#444" } Rectangle { implicitWidth: 50 color: "#666" } }
SplitView 사용자 지정하기를참조하십시오 .
orientation : enumeration |
이 속성은 SplitView 의 방향을 유지합니다.
방향에 따라 분할 항목이 배치되는 방식이 결정됩니다:
가능한 값은 다음과 같습니다:
Constant | 설명 |
---|---|
Qt.Horizontal | 항목이 가로로 배치됩니다(기본값). |
Qt.Vertical | 항목이 세로로 배치됩니다. |
resizing : bool |
사용자가 분할 핸들을 드래그하여 분할 항목의 크기를 조정하는 경우 이 속성은 true
입니다.
첨부 속성 문서
SplitView.fillHeight : bool |
이 첨부 속성은 다른 모든 항목이 레이아웃된 후 분할 보기에서 항목이 남은 공간을 차지할지 여부를 제어합니다.
기본적으로 분할 보기의 마지막에 보이는 자식이 보기를 채우지만 다른 항목에서 fillHeight
을 true
으로 명시적으로 설정하여 변경할 수 있습니다. 여러 항목에 fillHeight
이 true
으로 설정되어 있는 경우 가장 위에 있는 항목이 뷰를 채웁니다.
fillHeight
가 true
로 설정된 분할 항목의 높이는 해당 minimumHeight 및 maximumHeight 내에서 여전히 제한됩니다.
minimumHeight, preferredHeight, maximumHeight, fillWidth도 참조하세요 .
SplitView.fillWidth : bool |
이 첨부 속성은 다른 모든 항목이 배치된 후 분할 보기에서 항목이 남은 공간을 차지할지 여부를 제어합니다.
기본적으로 분할 보기의 마지막에 보이는 자식이 보기를 채우지만 다른 항목에서 fillWidth
을 true
으로 명시적으로 설정하여 변경할 수 있습니다. 여러 항목에 fillWidth
이 true
으로 설정되어 있는 경우 가장 왼쪽에 있는 항목이 뷰를 채웁니다.
fillWidth
이 true
으로 설정된 분할 항목의 너비는 해당 minimumWidth 및 maximumWidth 내에서 여전히 제한됩니다.
minimumWidth, preferredWidth, maximumWidth, fillHeight도 참조하세요 .
SplitView.maximumHeight : real |
이 첨부 속성은 분할 항목의 최대 높이를 제어합니다. preferredHeight 은 minimumHeight 및 maximumHeight 내에 바인딩됩니다. 분할 항목은 해당 maximumHeight
보다 크게 드래그할 수 없습니다.
기본값은 Infinity
입니다. 이 속성을 기본값으로 재설정하려면 undefined
로 설정합니다.
minimumHeight, preferredHeight, fillHeight, maximumWidth도 참조하세요 .
SplitView.maximumWidth : real |
이 첨부 속성은 분할 항목의 최대 너비를 제어합니다. preferredWidth 은 minimumWidth 및 maximumWidth 내에 바인딩됩니다. 분할 항목은 maximumWidth
보다 크게 드래그할 수 없습니다.
기본값은 Infinity
입니다. 이 속성을 기본값으로 재설정하려면 undefined
로 설정합니다.
minimumWidth, preferredWidth, fillWidth, maximumHeight도 참조하세요 .
SplitView.minimumHeight : real |
이 첨부 속성은 분할 항목의 최소 높이를 제어합니다. preferredHeight 은 minimumHeight 및 maximumHeight 에 바인딩됩니다. 분할 항목은 해당 minimumHeight
보다 작게 드래그할 수 없습니다.
기본값은 0
입니다. 이 속성을 기본값으로 재설정하려면 undefined
로 설정합니다.
maximumHeight, preferredHeight, fillHeight, minimumWidth도 참조하십시오 .
SplitView.minimumWidth : real |
이 첨부 속성은 분할 항목의 최소 너비를 제어합니다. preferredWidth 은 minimumWidth 및 maximumWidth 에 바인딩됩니다. 분할 항목은 minimumWidth
보다 작게 드래그할 수 없습니다.
기본값은 0
입니다. 이 속성을 기본값으로 재설정하려면 undefined
로 설정합니다.
maximumWidth, preferredWidth, fillWidth, minimumHeight도 참조하십시오 .
SplitView.preferredHeight : real |
이 첨부된 속성은 분할 항목의 기본 높이를 제어합니다. 기본 높이가 항목의 크기로 사용되며 minimumHeight 및 maximumHeight 내에 바인딩됩니다. 기본 높이가 설정되어 있지 않으면 항목의 implicitHeight 이 사용됩니다.
분할된 항목의 크기가 조정되면 새 크기를 추적하기 위해 preferredHeight가 설정됩니다.
기본적으로 이 속성은 설정되어 있지 않으므로 implicitHeight 이 대신 사용됩니다. 이 속성을 기본값으로 재설정하려면 undefined
으로 설정하세요.
minimumHeight, maximumHeight, fillHeight, preferredWidth 을참조하세요 .
SplitView.preferredWidth : real |
이 첨부된 속성은 분할 항목의 기본 너비를 제어합니다. 기본 너비는 항목의 크기로 사용되며 minimumWidth 및 maximumWidth 내에 바인딩됩니다. 기본 너비가 설정되지 않은 경우 항목의 implicitWidth 이 사용됩니다.
분할된 항목의 크기가 조정되면 새 크기를 추적하기 위해 preferredWidth가 설정됩니다.
기본적으로 이 속성은 설정되어 있지 않으므로 implicitWidth 이 대신 사용됩니다. 이 속성을 기본값으로 재설정하려면 undefined
으로 설정하세요.
minimumWidth, maximumWidth, fillWidth, preferredHeight도 참조하십시오 .
SplitView.view : SplitView |
이 첨부 속성은 첨부된 항목의 분할 보기를 유지하며, 항목이 분할 보기에 있지 않은 경우 null
을 유지합니다.
메서드 문서
bool restoreState(state) |
state 에서 기본 크기를 읽어 분할된 항목에 적용합니다.
상태가 성공적으로 복원된 경우 true
를 반환하고, 그렇지 않으면 false
을 반환합니다.
Serializing SplitView's State 및 saveState()도 참조하세요 .
var saveState() |
분할된 항목의 기본 크기를 바이트 배열에 저장하고 반환합니다.
Serializing SplitView's State 및 restoreState()도 참조하세요 .
© 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.