このページでは

Palette QML Type

各QML項目の状態に対応するカラーグループが含まれています。詳細...

Import Statement: import QtQuick
Inherits:

ColorGroup

プロパティ

詳細説明

パレットは、active 、disabled 、inactive の3つの色グループで構成されています。active 色グループはデフォルトのグループであり、他のグループで色が明示的に指定されていない場合、このグループの色が使用されます。

次の例では、すべてのカラーグループに色が適用されています:

ApplicationWindow {
    palette.buttonText: "salmon"

    ColumnLayout {
        Button {
            text: qsTr("Disabled button")
            enabled: false
        }

        Button {
            text: qsTr("Enabled button")
        }
    }
}

これは、両方のボタンのテキスト色が同じになることを意味します。

次の例では、有効状態と無効状態で色が異なります:

ApplicationWindow {
    palette.buttonText: "salmon"
    palette.disabled.buttonText: "lavender"

    ColumnLayout {
        Button {
            text: qsTr("Disabled button")
            enabled: false
        }

        Button {
            text: qsTr("Enabled button")
        }
    }
}

次のように色を指定することも可能です:

palette {
    buttonText: "red"
    button: "khaki"

    disabled {
        buttonText: "lavender"
        button: "coral"
    }
}

この方法は、すべてのカラーグループを含むパレット全体を指定する必要がある場合に特に便利です。ただし、上記の他のケースと同様、指定されていない色は `SystemPalette` から初期化されます。また、Qt Quick のコントロールスタイルが使用されている場合は、そこから初期化される可能性もあります。

注:一部の 「Controls」スタイルではパレットの色が使用されますが、多くのスタイルでは独立した色が使用されます。

関連項目: Window::palette 、Item::palette 、Popup::palette 、およびSystemPalette 。

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

active : ColorGroup

「Active」グループは、フォーカスされているウィンドウに使用されます。

QPalette::Activeも参照してください 。

disabled : ColorGroup

「Disabled」グループは、何らかの理由で無効化されている要素に使用されます。

「QPalette::Disabled」も参照してください 。

inactive : ColorGroup

「Inactive」グループは、キーボードのフォーカスがないウィンドウに使用されます。

「QPalette::Inactive」も参照してください 。

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