StyleReader QML Type
특정 컨트롤에 대한 활성 스타일에서 속성을 읽습니다. 더 보기...
| Import Statement: | import Qt.labs.StyleKit |
| Inherits: |
속성
- 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 Controls 와 active style 사이의 다리 역할을 합니다. 컨트롤과 그 델리게이트가 바인딩해야 하는 모든 스타일 속성( backgrounds, indicators, handles, text, padding 등)을 노출합니다. 모든 내장된 StyleKit 컨트롤은 이 목적을 위해 내부적으로 스타일리더를 사용합니다.
상태 속성( hovered, pressed, focused, checked, highlighted 등)은 컨트롤이 어떤 상태인지 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.implicitWidth implicitHeight: styleReader.background.implicitHeight 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 를참조하세요 .
속성 문서
checked : bool
컨트롤이 선택되었는지 여부입니다.
이를 컨트롤의 checked 속성에 바인딩합니다.
기본값은 false 입니다.
ControlStateStyle.checked 를참조하세요 .
controlType : enumeration
이 리더가 속성을 읽을 Style 에서 어떤 제어 유형을 식별합니다. 아래 사전 정의된 값 중 하나로 설정하거나 Style 에 정의된 custom control type 로 설정할 수 있습니다.
| Constant | 설명 |
|---|---|
StyleReader.Button | Button |
StyleReader.CheckBox | CheckBox |
StyleReader.ComboBox | ComboBox |
StyleReader.Frame | Frame |
StyleReader.GroupBox | GroupBox |
StyleReader.ItemDelegate | ItemDelegate |
StyleReader.Label | Label |
StyleReader.Menu | Menu |
StyleReader.Dialog | Dialog |
StyleReader.Page | Page |
StyleReader.Pane | Pane |
StyleReader.Popup | Popup |
StyleReader.ProgressBar | ProgressBar |
StyleReader.RadioButton | RadioButton |
StyleReader.ScrollBar | ScrollBar |
StyleReader.ScrollView | ScrollView |
StyleReader.SearchField | SearchField |
StyleReader.Slider | Slider |
StyleReader.SpinBox | SpinBox |
StyleReader.Switch | Switch |
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 입니다.
ControlStyleState.disabled도 참조하십시오 .
focused : bool
컨트롤에 활성 초점이 있는지 여부입니다.
이를 컨트롤의 activeFocus 속성에 바인딩합니다.
기본값은 false 입니다.
ControlStateStyle.focused 를참조하세요 .
font : font [read-only]
style 에 정의된 대로 이 컨트롤 유형의 유효 글꼴입니다. 또한 스타일의 text 속성에 설정된 모든 글꼴 오버라이드도 고려합니다.
컨트롤의 font 속성을 이 속성에 바인딩합니다.
참고: 컨트롤에서 StyleReader 으로 전달되는 hovered, pressed 및 palette 과 같은 프로퍼티와 달리 글꼴은 출력입니다. 컨트롤의 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.