このページでは

ControlStyle QML Type

normal 状態のコントロールのスタイルを定義します。詳細

Import Statement: import Qt.labs.StyleKit
Inherits:

ControlStateStyle

Inherited By:

CustomControl

プロパティ

詳細説明

ControlStyle は、Control のスタイルを記述します。ControlStyleのAPIは、Qt Quick コントロールのAPIとほぼ同じです。backgroundindicatorhandletext などのデリゲート用のグループ化されたプロパティと、paddingspacing などのレイアウトプロパティを提供します。Qt Quick ControlsControl のAPIに慣れていれば、ControlStyleのAPIは簡単に理解できるはずです。

ControlStyleがControlStateStyle を継承しているのは、それが通常の状態を表しているからです。ControlStyleに直接設定されたプロパティは、他の状態がアクティブでないときにコントロールがどのように見えるかを記述します。状態固有のオーバーライドは、hovered pressedchecked などのネストされた状態を通して設定されます。

Each stylable control Style 、 、 は ControlStyle です。例えば、以下のスニペットでは、 、 、 はすべてControlStyleです:Theme StyleVariation control button radioButton

Style {
    control {
        padding: 6
        text {
            color: "white"
        }
        background {
            radius: 4
            border.color: "gray"
        }
        indicator {
            implicitWidth: 20
            implicitHeight: 20
            border.width: 1
        }
        handle {
            implicitWidth: 20
            implicitHeight: 20
            radius: 10
        }
    }

    button {
        background {
            implicitWidth: 120
            shadow.opacity: 0.6
            shadow.verticalOffset: 2
            shadow.horizontalOffset: 2
            shadow.color: "gray"
            color: "lightsteelblue"
            gradient: Gradient {
                GradientStop { position: 0.0; color: Qt.alpha("black", 0.0)}
                GradientStop { position: 1.0; color: Qt.alpha("black", 0.2)}
            }
        }
        hovered {
            background.color: "lightslategrey"
        }
        pressed {
            background.scale: 0.95
        }
    }

    radioButton {
    }

    checkBox {
    }

    slider {
    }

    // etc...
}

All stylable controls,Style,Theme,StyleVariation,ControlStateStyle,DelegateStyleも参照してください

プロパティ・ドキュメント

variations : list<StyleVariation>

このコントロール・タイプのtype variations のリスト。

タイプバリエーションは、このコントロールタイプの子(または子孫)であるコントロールの代替スタイルを提供します。例えば、frame 内のすべてのbuttons を、他のボタンとは異なるスタイルにすることができます:

Style {
    frame {
        variations: StyleVariation {
            button {
                text.color: "ghostwhite"
                background.border.width: 0
                background.color: "slategrey"
            }
        }
    }

    groupBox {
        // groupBox falls back to frame. Therefore, if the varations set on a
        // frame is not wanted on a groupBox, just override it and set it back to [].
        variations: []
    }
}

インスタンス・バリエーション(StyleVariation::variations 添付プロパティを介してアプリケーションから特定のコントロール・インスタンスに適用される)とは異なり、タイプ・バリエーションは、Style からコントロール・タイプのすべてのインスタンスに適用されます。

StyleVariationも参照してください

© 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.