TableViewDelegate QML Type
TableView...에 할당할 수 있는 위임인.. . 더보기...
Import Statement: | import QtQuick.Controls |
Since: | Qt 6.9 |
Inherits: |
속성
자세한 설명
TableViewDelegate는 TableView 의 delegate property 에 할당할 수 있는 델리게이트로, 애플리케이션 스타일을 사용하여 뷰에서 테이블의 각 셀을 렌더링합니다.
TableView { anchors.fill: parent delegate: TableViewDelegate {} // model: yourModel }
TableViewDelegate는 ItemDelegate 을 상속하므로 background 과 contentItem 의 두 항목으로 구성됩니다.
contentItem의 위치는 padding 로 제어됩니다.
포인터와 상호작용하기
TableViewDelegate는 ItemDelegate 를 상속합니다. 즉, 사용자가 델리게이트를 클릭할 때 clicked 와 같은 신호를 방출합니다. 이 신호에 연결하여 애플리케이션별 기능을 구현할 수 있습니다.
그러나 ItemDelegate API는 클릭 위치나 어떤 수식어가 붙었는지에 대한 정보를 제공하지 않습니다. 이러한 정보가 필요한 경우 포인터 핸들러 등을 사용하는 것이 더 나은 방법입니다:
TableView { id: tableView delegate: TableViewDelegate { TapHandler { acceptedButtons: Qt.RightButton onTapped: someContextMenu.open() } TapHandler { acceptedModifiers: Qt.ControlModifier onTapped: tableView.doSomethingToCell(row, column) } } }
참고: 사용자가 델리게이트를 클릭할 때 발생하는 기본 동작(예: 현재 인덱스 변경)을 비활성화하려면 pointerNavigationEnabled 을 false
으로 설정하면 됩니다.
표에서 셀 편집하기
TableViewDelegate에는 기본값 edit delegate 이 할당되어 있습니다. TableView 에 edit triggers 이 설정되어 있고 model 에 editing model items 이 지원되는 경우 사용자는 편집 트리거 중 하나를 활성화하여 current 테이블 셀의 텍스트를 편집할 수 있습니다.
기본 편집 대리인은 Qt.EditRole
을 사용하여 model 에 데이터를 읽고 씁니다. 다른 역할을 사용해야 하거나 기본 편집 대리인이 제공하는 것 이외의 요구 사항이 있는 경우 언제든지 TableView.editDelegate 에 자체 대리인을 할당할 수 있습니다.
TableViewDelegate 커스터마이징 및 TableView 를참고하세요 .
프로퍼티 문서
current : bool |
이 프로퍼티는 델리게이트가 selection model 에서 current index 을 나타내는지 여부를 보유합니다.
selected : bool |
이 속성은 델리게이트가 selection model 에서 selected index 를 나타내는지 여부를 보유합니다.
© 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.