CustomTheme QML Type
Define un tema personalizado con nombre. Más información...
| Import Statement: | import Qt.labs.StyleKit |
| Status: | Technology preview |
Este tipo se encuentra en fase de vista previa tecnológica y está sujeto a cambios.
Propiedades
Descripción detallada
CustomTheme te permite añadir temas adicionales además de light y dark. Mientras que los temas claro y oscuro se aplican automatically en función de la combinación de colores del sistema operativo, un CustomTheme debe ser activado explícitamente por la aplicación. Aparte de esta diferencia, todos los temas funcionan de la misma manera.
Puedes definir tantos temas personalizados como quieras dentro de un 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"
}
}
}Para activar un CustomTheme, establece Style::themeName con su nombre desde la aplicación:
ComboBox {
model: StyleKit.style.availableThemeNames
onCurrentTextChanged: StyleKit.style.themeName = currentText
}También puedes establecer un «CustomTheme» como tema predeterminado al iniciar la aplicación:
ApplicationWindow {
width: 1024
height: 800
visible: true
StyleKit.style: MyStyleKitStyle {
themeName: "HighContrast"
}
}Los temas personalizados definidos en un «Style» se pueden consultar en tiempo de ejecución mediante « Style::customThemeNames » o « Style::availableThemeNames ».
Nota: No se garantiza que los tipos de los módulos de Qt.labs sigan siendo compatibles en futuras versiones.
Véase también Theme, Style::themeName y Style::customThemeNames.
Documentación de propiedades
name : string
El nombre de este tema. Este es el valor que debes asignar a « Style::themeName » para activarlo.
theme : Component
El componente « Theme » que define el tema. Solo se instanciará cuando se active el tema.
Las propiedades no configuradas en el tema se sustituyen por las definidas en el 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.