ControlStyle QML Type
normal 상태의 컨트롤 스타일을 정의합니다. 더 보기...
| Import Statement: | import Qt.labs.StyleKit |
| Inherits: | |
| Inherited By: | |
| Status: | Technology preview |
이 유형은 기술 미리보기 단계에 있으며 변경될 수 있습니다.
속성
- variations : list<StyleVariation>
상세 설명
ControlStyle은 Control 의 스타일을 어떻게 적용해야 하는지를 정의합니다. 이 클래스의 API는 Qt Quick Control의 API와 대체로 유사합니다. 즉, background, indicator, handle, text 와 같은 델리게이트용 속성 그룹과 padding, spacing 와 같은 레이아웃 속성을 제공합니다. Qt Quick Controls 의 Control API에 익숙하다면 ControlStyle API도 쉽게 이해할 수 있을 것입니다.
ControlStyle은 ControlStateStyle 를 상속받는데, 이는 정상 상태를 나타내기 때문입니다. ControlStyle에 직접 설정된 속성은 다른 상태가 활성화되지 않았을 때 컨트롤의 모양을 정의합니다. 상태별 재정의는 hovered, pressed, checked 과 같은 중첩된 상태를 통해 설정됩니다.
Each stylable control Style, 또는 내의 요소는 ControlStyle입니다. 예를 들어, 아래 코드 조각에서 , 및 는 모두 ControlStyle입니다: Theme StyleVariation control button radioButton
Style {
control {
padding: 6
text {
color: "white"
}
background {
radius: 4
border.color: "gray"
}
indicator {
width: 20
height: 20
border.width: 1
}
handle {
width: 20
height: 20
radius: 10
}
}
button {
background {
width: 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.