StyleReader QML Type
특정 컨트롤에 대해 활성 스타일의 속성을 읽어옵니다. 더 보기...
| Import Statement: | import Qt.labs.StyleKit |
| Inherits: | |
| Status: | Technology preview |
이 유형은 기술 미리 보기 단계에 있으며 변경될 수 있습니다.
속성
- checked : bool
- controlType : enumeration
- enabled : bool
- focused : bool
- font : font
- global : ControlStyleProperties
- highlighted : bool
- hovered : bool
- palette : palette
- pressed : bool
- vertical : bool
상세 설명
StyleReader는 Qt Quick Controlsactive style 간의 가교 역할을 합니다. 이 클래스는 컨트롤과 그 델리게이트가 바인딩해야 하는 모든 스타일 속성( backgrounds, indicators, handles, text, padding 등)을 노출합니다. 모든 내장 StyleKit 컨트롤은 이러한 목적으로 내부적으로 StyleReader를 사용합니다.
상태 속성( hovered, pressed, focused, checked, highlighted 등)은 StyleReader에 컨트롤이 현재 어떤 상태에 있는지 알려줍니다. StyleReader는 이러한 속성을 사용하여 Themes, , StyleVariations, fallback types 및 속성 전파를 고려하여 Style 에서 올바른 속성 값을 해결하고 읽습니다.
CustomControl 를 구현할 때는 내장 컨트롤과 동일한 접근 방식을 따를 수 있습니다.
// Main.qml
component CustomButton : Rectangle {
StyleReader {
id: styleReader
controlType: StyleReader.Button
hovered: hoverHandler.hovered
pressed: tapHandler.pressed
palette: app.palette
}
implicitWidth: styleReader.background.width
implicitHeight: styleReader.background.height
color: styleReader.background.color
radius: styleReader.background.radius
HoverHandler { id: hoverHandler }
TapHandler { id: tapHandler }
Text {
font: styleReader.font
anchors.centerIn: parent
text: "ok"
}
}참고: ControlStyleProperties 에서 상속받은 스타일속성은 Style 에 직접 매핑되지 않습니다. 대신, 이들은 활성 상태인 transition 동안 잠재적으로 보간된 값의 캐시를 반영합니다. 이 속성에 값을 쓰더라도 Style 의 해당 속성은 업데이트되지 않으며, 진행 중인 전환에 방해가 될 수 있습니다. 스타일 속성을 변경해야 할 때는 Style 에 직접 값을 작성하십시오.
참고: Qt.labs 모듈의 유형은 향후 버전에서 호환성이 보장되지 않습니다.
또한 CustomControl, Style, StyleVariation.controlType 및 StyleKit 속성 해결을참조하십시오 .
속성 문서
checked : bool
컨트롤이 선택되어 있는지 여부.
이 속성을 컨트롤의 checked 속성에 바인딩합니다.
기본값은 false 입니다.
ControlStateStyle.checked도 참조하십시오 .
controlType : enumeration
이 리더기가 ‘ Style ’ 내의 어떤 컨트롤 유형에서 속성을 읽어오는지 지정합니다. 이 설정은 아래의 미리 정의된 값 중 하나로 설정하거나, ‘ Style ’에 정의된 사용자 정의 컨트롤( custom control type )로 설정할 수 있습니다.
| 상수 | 설명 |
|---|---|
StyleReader.BusyIndicator | BusyIndicator |
StyleReader.Button | Button |
StyleReader.CheckBox | CheckBox |
StyleReader.CheckDelegate | CheckDelegate |
StyleReader.ComboBox | ComboBox |
StyleReader.DelayButton | DelayButton |
StyleReader.Dial | Dial |
StyleReader.Dialog | Dialog |
StyleReader.DialogButtonBox | DialogButtonBox |
StyleReader.Frame | Frame |
StyleReader.GroupBox | GroupBox |
StyleReader.ItemDelegate | ItemDelegate |
StyleReader.Label | Label |
StyleReader.Menu | Menu |
StyleReader.MenuBar | MenuBar |
StyleReader.MenuBarItem | MenuBarItem |
StyleReader.MenuItem | MenuItem |
StyleReader.MenuSeparator | MenuSeparator |
StyleReader.Page | Page |
StyleReader.PageIndicator | PageIndicator |
StyleReader.Pane | Pane |
StyleReader.Popup | Popup |
StyleReader.ProgressBar | ProgressBar |
StyleReader.RadioButton | RadioButton |
StyleReader.RadioDelegate | RadioDelegate |
StyleReader.RoundButton | RoundButton |
StyleReader.ScrollBar | ScrollBar |
StyleReader.ScrollView | ScrollView |
StyleReader.SearchField | SearchField |
StyleReader.Slider | Slider |
StyleReader.SpinBox | SpinBox |
StyleReader.SwipeDelegate | SwipeDelegate |
StyleReader.Switch | Switch |
StyleReader.SwitchDelegate | SwitchDelegate |
StyleReader.TabBar | TabBar |
StyleReader.TabButton | TabButton |
StyleReader.TextArea | TextArea |
StyleReader.TextField | TextField |
StyleReader.ToolBar | ToolBar |
StyleReader.ToolButton | ToolButton |
StyleReader.ToolSeparator | ToolSeparator |
StyleVariation.controlType도 참조하십시오 .
enabled : bool
컨트롤이 활성화되어 있는지 여부.
이 값을 컨트롤의 ` enabled ` 속성에 바인딩합니다.
기본값은 ` true`입니다.
ControlStateStyle.disabled도 참조하십시오 .
focused : bool
컨트롤에 포커스가 활성화되어 있는지 여부.
이 속성을 컨트롤의 ` activeFocus ` 속성에 바인딩합니다.
기본값은 false 입니다.
ControlStateStyle.focused도 참조하십시오 .
font : font [read-only]
style 에 정의된 대로 이 컨트롤 유형에 적용되는 글꼴입니다. 여기에는 스타일의 text 속성에 설정된 글꼴 재정의 사항도 반영됩니다.
컨트롤의 font 속성을 이 속성에 바인딩하십시오.
참고: hovered, pressed, palette 과 같은 속성(이 속성들은 컨트롤에서 StyleReader 로 전달됨)과 달리 , font는 출력 속성입니다. 컨트롤의 font 속성을 이 값에 바인딩해야 하며, 그 반대가 아닙니다.
global : ControlStyleProperties [read-only]
진행 중인 transition 를 우회하여 스타일 속성에 직접 액세스할 수 있게 해줍니다.
상태 전환이 진행 중일 때, StyleReader 에서 읽은 스타일 속성은 보간된 값을 반환할 수 있습니다. 속성 경로 앞에 global 를 추가하면 전환 과정을 우회하여 최종 상태의 값을 즉시 얻을 수 있습니다.
예를 들어, hovered 에서 pressed 로 전환되는 경우, background.color 는 hovered 상태의 color 와 pressed 상태의 색상 사이의 보간된 값을 반환할 수 있습니다. 반면, global.background.color 는 눌린 상태의 색상을 직접 반환합니다.
transitionsEnabled도 참조하십시오 .
highlighted : bool
컨트롤이 강조 표시되어 있는지 여부.
이 속성을 컨트롤의 ` highlighted ` 속성에 바인딩합니다.
기본값은 false 입니다.
ControlStateStyle.highlighted도 참조하십시오 .
hovered : bool
컨트롤 위에 마우스가 올려져 있는지 여부.
이 속성을 컨트롤의 ` hovered ` 속성에 바인딩합니다.
기본값은 ` false`입니다.
ControlStateStyle.hovered도 참조하십시오 .
palette : palette
컨트롤의 팔레트입니다. StyleKit은 이를 사용하여 ` Style` 내의 ` palette `에 바인딩된 색상 속성을 해결합니다.
이 속성을 컨트롤의 ` palette ` 속성에 바인딩하십시오.
Style.palette항목도 참조하십시오 .
pressed : bool
컨트롤이 눌려 있는지 여부.
이 속성을 컨트롤의 pressed 속성에 바인딩합니다.
기본값은 false 입니다.
ControlStateStyle.pressed도 참조하십시오 .
vertical : bool
컨트롤이 세로로 배치되어 있는지 여부.
이 속성을 컨트롤의 orientation 에 바인딩합니다.
기본값은 ` false`입니다.
ControlStateStyle.vertical도 참조하십시오 .
© 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.