CustomTheme QML Type
명명된 사용자 지정 테마를 정의합니다. 더 보기...
| Import Statement: | import Qt.labs.StyleKit |
속성
상세 설명
사용자 지정 테마를 사용하면 light 및 dark 외에 추가 테마를 추가할 수 있습니다. 밝은 테마 및 어두운 테마는 운영 체제의 색 구성표에 따라 automatically 적용되지만, 사용자 지정 테마는 애플리케이션에서 명시적으로 활성화해야 합니다. 이러한 차이점을 제외하면 모든 테마는 동일한 방식으로 작동합니다.
Style 내에서 사용자 정의 테마를 얼마든지 정의할 수 있습니다.
Style { CustomTheme { name: "HighContrast" theme: Theme { control.background.color: "white" control.background.border.color: "black" control.background.border.width: 2 } } CustomTheme { name: "Sepia" theme: Theme { control.text.color: "#5b4636" control.background.color: "#f4ecd8" control.background.border.color: "#c8b99a" applicationWindow.background.color: "#efe6d0" } } }
사용자 정의 테마를 활성화하려면 애플리케이션에서 Style::themeName 을 해당 이름으로 설정합니다:
ComboBox { model: StyleKit.style.themeNames onCurrentTextChanged: StyleKit.style.themeName = currentText }
시작할 때 사용자 지정 테마를 기본 테마로 설정할 수도 있습니다:
ApplicationWindow {
width: 1024
height: 800
visible: true
StyleKit.style: MyStyleKitStyle {
themeName: "HighContrast"
}
}스타일에 정의된 사용자 정의 테마는 런타임에 Style::customThemeNames 또는 Style::themeNames 에서 쿼리할 수 있습니다.
참고: Qt.labs 모듈의 유형은 향후 버전에서 호환성을 보장하지 않습니다.
Theme, Style::themeName, Style::customThemeNames 를참조하세요 .
속성 문서
name : string
이 테마의 이름입니다. 활성화하기 위해 Style::themeName 에 할당하는 값입니다.
theme : Component
테마를 정의하는 Theme 컴포넌트입니다. 테마가 활성화된 경우에만 인스턴스화됩니다.
테마에 설정되지 않은 속성은 Style 에 정의된 속성으로 되돌아갑니다.
© 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.