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

ColorDialog QML Type

A color dialog.

This type was introduced in Qt 6.4.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

ColorDialog QML Type

  • Import Statement: import QtQuick.Dialogs

  • Since:: Qt 6.4

  • Inherits:: Dialog

Detailed Description

The ColorDialog type provides a QML API for color dialogs.

Image non disponible

To show a color dialog, construct an instance of ColorDialog, set the desired properties, and call open(). The selectedColor property can be used to determine the initially selected color in the dialog.

 
Sélectionnez
MenuItem {
    text: qsTr("Color")
    onTriggered: colorDialog.open()
}

ColorDialog {
    id: colorDialog
    selectedColor: document.color
    onAccepted: document.color = selectedColor
}

MyDocument {
    id: document
}

Availability

A native platform color dialog is currently available on the following platforms:

  • macOS

  • Linux (when running with the GTK+ platform theme)

Qt Quick Dialogs uses a Qt Quick implementation as a fallback on platforms that do not have a native implementation available.

Property Documentation

 

options : flags

This property holds the various options that affect the look and feel of the dialog.

By default, all options are disabled.

Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).

Available options:

Constant

Description

ColorDialog.ShowAlphaChannel

Show a slider and additional input fields for the alpha value.

ColorDialog.NoButtons

Don't display Open and Cancel buttons (useful for "live dialogs").

ColorDialog.DontUseNativeDialog

Forces the dialog to use a non-native quick implementation.

selectedColor : color

This property holds the currently selected color in the dialog.

The accepted() signal can be handled to get the final selection. When the user has clicked Open to accept a color, a signal handler for the accepted() signal can query the selectedColor property to get the final color that was selected by the user.

See Also

See also accepted()

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