ControlStyle QML Type
normal 상태의 컨트롤에 대한 스타일을 정의합니다. 더 보기...
| Import Statement: | import Qt.labs.StyleKit |
| Inherits: | |
| Inherited By: |
속성
- variations : list<StyleVariation>
상세 설명
컨트롤 스타일은 Control 의 스타일을 지정하는 방법을 설명합니다. Qt Quick background , indicator, handle, text 와 같은 델리게이트에 그룹화된 프로퍼티와 padding, spacing 와 같은 레이아웃 프로퍼티를 제공합니다. Qt Quick Controls 에서 Control 의 API에 익숙하다면 ControlStyle API를 쉽게 따라할 수 있을 것입니다.
ControlStyle은 ControlStateStyle 을 상속하는데, 이는 일반 상태를 나타내기 때문입니다. ControlStyle에 직접 설정된 속성은 다른 상태가 활성화되지 않았을 때 컨트롤이 어떻게 보이는지 설명합니다. 상태별 오버라이드는 hovered pressed , checked 와 같이 중첩된 상태를 통해 설정됩니다.
Each stylable control 에서 Style, Theme, 또는 StyleVariation 는 컨트롤 스타일입니다. 예를 들어 아래 스니펫에서 control, button 및 radioButton 는 모두 ControlStyles입니다:
Style { control { padding: 6 text { color: "white" } background { radius: 4 border.color: "gray" } indicator { implicitWidth: 20 implicitHeight: 20 border.width: 1 } handle { implicitWidth: 20 implicitHeight: 20 radius: 10 } } button { background { implicitWidth: 120 shadow.opacity: 0.6 shadow.verticalOffset: 2 shadow.horizontalOffset: 2 shadow.color: "gray" color: "lightsteelblue" gradient: Gradient { GradientStop { position: 0.0; color: Qt.alpha("black", 0.0)} GradientStop { position: 1.0; color: Qt.alpha("black", 0.2)} } } hovered { background.color: "lightslategrey" } pressed { background.scale: 0.95 } } radioButton { } checkBox { } slider { } // etc... }
All stylable controls, Style, Theme, StyleVariation, ControlStateStyle, DelegateStyle도 참조하세요 .
속성 문서
variations : list<StyleVariation>
이 컨트롤 유형에 대한 type variations 목록입니다.
유형 변형은 이 컨트롤 유형의 자식(또는 하위)인 컨트롤에 대해 대체 스타일을 제공합니다. 예를 들어, 이를 사용하여 frame 내의 모든 buttons 스타일을 다른 곳의 버튼과 다르게 지정할 수 있습니다:
Style { frame { variations: StyleVariation { button { text.color: "ghostwhite" background.border.width: 0 background.color: "slategrey" } } } groupBox { // groupBox falls back to frame. Therefore, if the varations set on a // frame is not wanted on a groupBox, just override it and set it back to []. variations: [] } }
StyleVariation::variations 첨부 속성을 통해 애플리케이션의 특정 컨트롤 인스턴스에 적용되는 인스턴스 변형과 달리, 유형 변형은 애플리케이션이 선택하지 않아도 Style 에서 컨트롤 유형의 모든 인스턴스에 적용됩니다.
StyleVariation 를참조하세요 .
© 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.