이 페이지에서

CustomTheme QML Type

이름이 지정된 사용자 지정 테마를 정의합니다. 더 보기...

Import Statement: import Qt.labs.StyleKit
Status: Technology preview

이 유형은 기술 미리보기 단계에 있으며 변경될 수 있습니다.

속성

자세한 설명

CustomTheme을 사용하면 light 및 dark 이외의 추가 테마를 적용할 수 있습니다. 라이트 및 다크 테마는 운영 체제의 색상 구성에 따라 automatically 자동으로 적용되는 반면, CustomTheme은 애플리케이션에서 명시적으로 활성화해야 합니다. 이 차이점을 제외하면 모든 테마는 동일한 방식으로 작동합니다.

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"
        }
    }
}

CustomTheme을 활성화하려면 애플리케이션에서 Style::themeName 을 해당 테마 이름으로 설정하십시오:

ComboBox {
    model: StyleKit.style.availableThemeNames
    onCurrentTextChanged: StyleKit.style.themeName = currentText
}

또한 시작 시 CustomTheme을 기본 테마로 설정할 수도 있습니다:

ApplicationWindow {
    width: 1024
    height: 800
    visible: true

    StyleKit.style: MyStyleKitStyle {
        themeName: "HighContrast"
    }
}

Style에 정의된 사용자 정의 테마는 런타임에 ` Style::customThemeNames ` 또는 ` Style::availableThemeNames`을 통해 조회할 수 있습니다.

참고: 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.