이 페이지에서

ControlStateStyle QML Type

지정된 상태의 컨트롤 스타일을 설명합니다. 더 보기...

Import Statement: import Qt.labs.StyleKit
Inherits:

ControlStyleProperties

Inherited By:

ControlStyle and CustomControl

속성

상세 설명

ControlStateStyle은 특정 상태의 컨트롤 스타일을 설명합니다. ControlStyle 에 직접 설정된 속성은 다른 상태가 활성화되지 않았을 때 컨트롤이 어떻게 보이는지 설명하므로 ControlStyle 은 ControlStateStyle을 상속합니다. 그런 다음 상태별 오버라이드는 pressed, hovered, checked 와 같은 중첩된 상태를 통해 설정됩니다.

중첩된 상태는 상호 배타적이지 않습니다. 여러 상태가 동시에 활성화될 수 있습니다(예: 버튼에 마우스를 갖다 대고 동시에 누를 수 있습니다). 여러 상태가 활성화되면 일치하는 모든 상태 오버라이드가 적용됩니다. 동일한 속성이 여러 활성 상태에 설정되어 있는 경우 충돌은 다음과 같은 우선 순위에 따라 해결됩니다: pressed, hovered, highlighted, focused, checked, vertical. 예를 들어 컨트롤이 pressedchecked 모두인 경우 pressed.background.colorchecked.background.color 보다 우선합니다.

disabled 상태는 예외입니다. 비활성화된 컨트롤은 상호 작용할 수 없으므로 pressed, hovered, highlighted, focused 상태는 적용되지 않습니다. 그러나 disabledcheckedvertical 와 같은 상태와 결합할 수 있습니다.

상태가 더 깊게 중첩될수록 더 많은 자격이 부여됩니다. 예를 들어 hoveredpressed 이 모두 활성화되어 있는 경우 hovered.pressed.background.colorhovered.background.color 보다 우선합니다. 중첩 순서는 중요하지 않습니다. hovered.pressedpressed.hovered 은 동등합니다. 그러나 두 양식이 동시에 사용되는 경우 어느 것이 우선하는지는 정의되지 않습니다.

상태의 더 깊은 중첩을 사용하여 충돌을 해결할 수도 있습니다. hoveredchecked 에 동일한 속성이 설정되어 있는 경우 우선 순위에 따라 hovered 값이 우선합니다. 확인된 값이 더 우선하거나 완전히 다른 값을 사용하려는 경우 hovered.checked 에서 속성을 재정의하면 두 값보다 우선합니다.

다음 스니펫은 버튼의 상태에 따라 스타일을 다르게 지정하는 방법을 보여줍니다:

button {
    text.color: "white"
    background.color: "cornflowerblue"

    pressed.background.color: "cadetblue"
    hovered.background.color: "dodgerblue"
    highlighted.background.color: "lightblue"
    focused.background.color: "lightskyblue"
    checked.background.color: "darkseagreen"
    disabled.background.color: "gray"

    // hovered.checked takes precedence over both hovered and checked
    hovered.checked.background.color: "mediumseagreen"

    hovered.checked {
        // Nested states are grouped properties, so you can use the compact
        // per-property form above, or structure them hierarchically for
        // better readability. Both forms are functionally equivalent.
        pressed {
            // hovered.checked.pressed takes precedence over hovered.checked
            background {
                color: "mediumaquamarine"
                scale: 0.95
            }
            text {
                bold: true
            }
        }
    }
}

참고: Qt.labs 모듈의 유형은 향후 버전에서 호환성을 보장하지 않습니다.

ControlStyle, DelegateStyle, 및 대체 스타일 참조를참조하세요 .

속성 문서

checked : ControlStateStyle

컨트롤이 checked 일 때 스타일 오버라이드가 적용됩니다.

pressed, hovered, highlighted, focused, vertical, disabled, StyleReader.checked도 참조하세요 .

disabled : ControlStateStyle

컨트롤이 비활성화되면 스타일 오버라이드가 적용됩니다.

비활성화된 컨트롤은 상호 작용할 수 없으므로 pressed, hovered, highlighted, focused 은 비활성화와 동시에 적용되지 않습니다.

pressed, hovered, highlighted, focused, checked, vertical 및 StyleReader.disabled도 참조하세요 .

focused : ControlStateStyle

컨트롤이 focused 일 때 스타일 오버라이드가 적용됩니다.

pressed, hovered, highlighted, checked, vertical, disabled, StyleReader.focused도 참조하세요 .

highlighted : ControlStateStyle

컨트롤이 highlighted 일 때 스타일 오버라이드가 적용됩니다.

pressed, hovered, focused, checked, vertical, disabled, StyleReader.highlighted도 참조하세요 .

hovered : ControlStateStyle

컨트롤이 hovered 일 때 스타일 오버라이드가 적용됩니다.

pressed, highlighted, focused, checked, vertical, disabled, StyleReader.hovered도 참조하세요 .

pressed : ControlStateStyle

컨트롤이 pressed 일 때 스타일 오버라이드가 적용됩니다.

hovered, highlighted, focused, checked, vertical, disabled, StyleReader.pressed도 참조하세요 .

vertical : ControlStateStyle

컨트롤이 vertical (예: 세로형 Slider 또는 ScrollBar)일 때 스타일 오버라이드가 적용됩니다.

pressed, hovered, highlighted, focused, checked, disabled, StyleReader.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.