SelectionRectangle QML Type

TableView...에서 테이블 셀을 선택하는 데 사용됩니다.. ..

Import Statement: import QtQuick.Controls
Since: Qt 6.2
Inherits:

Control

속성

첨부 속성

상세 설명

SelectionRectangle은 TableView 에서 표 셀을 선택하는 데 사용됩니다. 사용자는 뷰포트 내에서 포인터를 끌거나 셀 위를 길게 눌러 선택을 시작할 수 있습니다.

SelectionRectangle이 셀을 선택할 수 있으려면 TableViewItemSelectionModel 이 할당되어 있어야 합니다. ItemSelectionModel 은 모델에서 수행된 모든 선택을 저장하며 사용자가 어떤 셀을 선택했는지 쿼리하는 데 사용할 수 있습니다.

다음 예제는 SelectionRectangle이 TableView 을 대상으로 하는 방법을 보여줍니다:

    TableView {
        id: tableView
        anchors.fill: parent
        clip: true

        model: TableModel {
            TableModelColumn { display: "name" }
            rows: [ { "name": "Harry" }, { "name": "Hedwig" } ]
        }

        selectionModel: ItemSelectionModel {
            model: tableView.model
        }

        delegate: Rectangle {
            implicitWidth: 100
            implicitHeight: 30
            color: selected ? "blue" : "lightgray"

            required property bool selected

            Text { text: display }
        }
    }

    SelectionRectangle {
        target: tableView
    }

참고: SelectionRectangle 자체는 선택의 일부로 표시되지 않습니다. 델리게이트(예: topLeftHandlebottomRightHandle)만 사용됩니다. rendering the TableView delegate as selected 도 고려해야 합니다.

TableView, TableView::selectionModel, ItemSelectionModel참조하세요 .

속성 문서

active : bool [read-only]

이 속성은 사용자가 선택을 수행하는 동안 true 입니다. 선택은 사용자가 선택을 시작한 시점부터 뷰포트 내부를 탭하는 등 선택이 다시 제거될 때까지 활성화됩니다.


bottomRightHandle : Component

이 속성은 선택 사각형의 왼쪽 상단 모서리 중앙에 표시될 델리게이트를 보유합니다. 핸들이 제공되면 사용자는 핸들을 드래그하여 선택 영역을 조정할 수 있습니다.

선택 영역이 제거되면 기본적으로 핸들은 숨겨지지 않습니다. 대신 사용자 지정 페이드아웃 애니메이션을 위해 열어야 하는 것은 델리게이트의 책임입니다. 핸들이 숨겨지도록 하는 가장 쉬운 방법은 visibleSelectionRectangleactive 상태에 바인딩하는 것입니다:

SelectionRectangle {
    bottomRightHandle: Rectangle {
        width: 20
        height: 20
        visible: SelectionRectangle.control.active
    }
}

오른쪽 하단에 선택 핸들을 표시하지 않으려면 이 속성을 null 로 설정하세요.

topLeftHandle참조하세요 .


dragging : bool [read-only]

이 속성은 사용자가 선택 사각형을 조정하기 위해 포인터 드래그 또는 핸들 드래그를 수행할 때마다 true 입니다.


selectionMode : enumeration

이 속성은 선택이 시작되어야 하는 시기를 유지합니다.

Constant설명
SelectionRectangle.Drag뷰포트 내에서 포인터 드래그를 수행하여 선택이 시작됩니다.
SelectionRectangle.PressAndHold셀 위를 길게 누르면 선택이 시작됩니다.
SelectionRectangle.AutoSelectionRectangle 은 대상과 플랫폼에 따라 사용할 모드를 선택합니다. 일반적으로 터치 기반 플랫폼에서는 PressAndHold, 데스크톱에서는 Drag 이 사용됩니다. 하지만 Drag 은 플릭과 충돌하지 않는 경우에만 사용됩니다. TableView 즉, interactivefalse 으로 설정하거나 ScrollView (기본적으로 마우스 이벤트에 대해 플릭이 꺼져 있음) 안에 배치해야 Drag 을 선택할 수 있습니다.

기본값은 Auto 입니다.


target : Item

이 프로퍼티는 SelectionRectangle 이 동작할 TableView 을 보유합니다.


topLeftHandle : Component

이 속성은 선택 사각형의 왼쪽 상단 모서리 중앙에 표시될 델리게이트를 보유합니다. 핸들이 제공되면 사용자는 이를 드래그하여 선택 영역을 조정할 수 있습니다.

선택 영역이 제거되면 기본적으로 핸들은 숨겨지지 않습니다. 대신 사용자 지정 페이드아웃 애니메이션을 위해 열어야 하는 것은 델리게이트의 책임입니다. 핸들이 숨겨지도록 하는 가장 쉬운 방법은 visibleSelectionRectangleactive 상태에 바인딩하는 것입니다:

SelectionRectangle {
    topLeftHandle: Rectangle {
        width: 20
        height: 20
        visible: SelectionRectangle.control.active
    }
}

왼쪽 상단에 선택 핸들을 표시하지 않으려면 이 속성을 null 로 설정하세요.

bottomRightHandle참조하세요 .


첨부 속성 문서

SelectionRectangle.control : SelectionRectangle

이 첨부 프로퍼티는 델리게이트 인스턴스를 관리하는 SelectionRectangle 을 보유합니다. 각 핸들 인스턴스에 첨부됩니다.


SelectionRectangle.dragging : bool

사용자가 핸들을 드래그하는 경우 이 첨부 프로퍼티는 true 가 됩니다. 각 핸들 인스턴스에 첨부됩니다.


© 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.