이 페이지에서

ItemDelegate QML Type

다양한 뷰와 컨트롤에서 사용할 수 있는 기본 항목 델리게이트. 더 보기...

속성

상세 설명

ItemDelegate는 표준 뷰 항목을 나타냅니다. 이 클래스는 ListView 및 ComboBox 와 같은 다양한 뷰 및 컨트롤에서 델리게이트로 사용할 수 있습니다.

ItemDelegate는 AbstractButton 에서 API를 상속받습니다. 예를 들어, AbstractButton API를 사용하여 text 을 설정하고, 아이콘을 표시하며, clicks 에 반응할 수 있습니다.

ListView {
    id: listView
    width: 160
    height: 240

    model: Qt.fontFamilies()

    delegate: ItemDelegate {
        text: modelData
        width: listView.width
        onClicked: console.log("clicked:", modelData)

        required property string modelData
    }

    ScrollIndicator.vertical: ScrollIndicator { }
}

‘ItemDelegate 사용자 지정 ’ 및 ‘Delegate 컨트롤’항목도 참조하십시오 .

속성 설명서

highlighted : bool

이 속성은 델리게이트가 강조 표시되어 있는지 여부를 나타냅니다.

델리게이트는 사용자의 주의를 끌기 위해 강조 표시될 수 있습니다. 이는 키보드 상호 작용에는 영향을 미치지 않습니다. 예를 들어, 다음 코드를 사용하여 ListView 에서 현재 항목을 강조 표시할 수 있습니다:

ListView {
    id: listView
    model: 10
    delegate: ItemDelegate {
        text: index
        highlighted: ListView.isCurrentItem

        required property int index

        onClicked: listView.currentIndex = index
    }
}

기본값은 ` false`입니다.

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