![]() |
Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions |
The QColorDialog class provides a dialog widget for specifying colors. More...
#include <QColorDialog>
Inherits QDialog.
The QColorDialog class provides a dialog widget for specifying colors.
The color dialog's function is to allow users to choose colors. For example, you might use this in a drawing program to allow the user to set the brush color.
The static functions provide modal color dialogs.
The static getColor() function shows the dialog, and allows the user to specify a color. The getRgba() function does the same, but also allows the user to specify a color with an alpha channel (transparency) value.
The user can store customCount() different custom colors. The custom colors are shared by all color dialogs, and remembered during the execution of the program. Use setCustomColor() to set the custom colors, and use customColor() to get them.
Additional widgets that allow users to pick colors are available as Qt Solutions.
The Standard Dialogs example shows how to use QColorDialog as well as other built-in Qt dialogs.
See also QColor, QFileDialog, QPrintDialog, QFontDialog, and Standard Dialogs Example.
This enum specifies various options that affect the look and feel of a color dialog.
Constant | Value | Description |
---|---|---|
QColorDialog::ShowAlphaChannel | 0x00000001 | Allow the user to select the alpha component of a color. |
QColorDialog::NoButtons | 0x00000002 | Don't display OK and Cancel buttons. (Useful for "live dialogs".) |
QColorDialog::UseSheet | ? | Try to use a sheet on the Mac, even if the dialog is application modal. |
QColorDialog::DontUseSheet | ? | Never use a sheet on the Mac, even if the dialog is window modal. |
QColorDialog::DontUseNativeDialog | 0x00000004 | Use Qt's standard color dialog on the Mac instead of Apple's native color panel. |
This enum was introduced in Qt 4.5.
The ColorDialogOptions type is a typedef for QFlags<ColorDialogOption>. It stores an OR combination of ColorDialogOption values.
See also options, setOption(), testOption(), and windowModality().
Access functions:
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).
Access functions:
See also setOption() and testOption().
###
This function was introduced in Qt 4.5.
###
This function was introduced in Qt 4.5.
Destroys the color dialog.
This signal is emitted just after the user has clicked OK to select a color.
See also color and currentColorChanged().
This signal is emitted whenever the current color changes in the dialog.
See also color and colorSelected().
Returns the custom color at the given index as a QRgb value.
See also setCustomColor().
Returns the number of custom colors supported by QColorDialog. All color dialogs share the same custom colors.
Pops up a modal color dialog with the given window title (or "Select Color" if none is specified), lets the user choose a color, and returns that color. The color is initially set to initial. The dialog is a child of parent. It returns an invalid (see QColor::isValid()) color if the user cancels the dialog.
The options argument allows you to customize the dialog.
This function was introduced in Qt 4.5.
This is an overloaded member function, provided for convenience.
Pops up a modal color dialog, lets the user choose a color, and returns that color. The color is initially set to initial. The dialog is a child of parent. It returns an invalid (see QColor::isValid()) color if the user cancels the dialog.
This is an overloaded member function, provided for convenience.
###
###
Sets the custom color at index to the QRgb color value.
See also customColor().
Sets the given option to be enabled if on is true; otherwise, clears the given option.
See also options and testOption().
Sets the standard color at index to the QRgb color value.
Returns true if the given option is enabled; otherwise, returns false.
See also options and setOption().
Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt 4.5.0-tp1 |