IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Palette QML Type

The QQuickPalette class contains color groups for each QML item state.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

Palette QML Type

  • Import Statement: import QtQuick

  • Group: Palette is part of qtquick-visual

Detailed Description

A palette consists of three color groups: Active, Disabled, and Inactive. Active color group is the default group, its colors are used for other groups if colors of these groups aren't explicitly specified.

In the following example, color is applied for all color groups:

 
Sélectionnez
ApplicationWindow {
    palette.buttonText: "salmon"

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

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

It means that text color will be the same for both buttons.

In the following example, colors will be different for enabled and disabled states:

 
Sélectionnez
ApplicationWindow {
    palette.buttonText: "salmon"
    palette.disabled.buttonText: "lavender"

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

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

It is also possible to specify colors like this:

 
Sélectionnez
palette {
    buttonText: "azure"
    button: "khaki"

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

This approach is convenient when you need to specify a whole palette with all color groups.

Property Documentation

 

active : QQuickColorGroup

The Active group is used for windows that are in focus.

See Also

See also QPalette::Active

disabled : QQuickColorGroup

The Disabled group is used for elements that are disabled for some reason.

See Also

inactive : QQuickColorGroup

The Inactive group is used for windows that have no keyboard focus.

See Also

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+