The PySide.QtGui.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 PySide.QtGui.QColorDialog.getColor() function shows the dialog, and allows the user to specify a color. This function can also be used to let users choose a color with a level of transparency: pass the ShowAlphaChannel option as an additional argument.
The user can store PySide.QtGui.QColorDialog.customCount() different custom colors. The custom colors are shared by all color dialogs, and remembered during the execution of the program. Use PySide.QtGui.QColorDialog.setCustomColor() to set the custom colors, and use PySide.QtGui.QColorDialog.customColor() to get them.
The Standard Dialogs example shows how to use PySide.QtGui.QColorDialog as well as other built-in Qt dialogs.
See also
PySide.QtGui.QColor PySide.QtGui.QFileDialog PySide.QtGui.QPrintDialog PySide.QtGui.QFontDialog Standard Dialogs Example
Parameters: |
|
---|
Constructs a color dialog with the given parent .
Constructs a color dialog with the given parent and specified initial color.
This enum specifies various options that affect the look and feel of a color dialog.
Constant | Description |
---|---|
QColorDialog.ShowAlphaChannel | Allow the user to select the alpha component of a color. |
QColorDialog.NoButtons | Don’t display OK and Cancel buttons. (Useful for “live dialogs”.) |
QColorDialog.DontUseNativeDialog | Use Qt’s standard color dialog on the Mac instead of Apple’s native color panel. |
Parameters: | color – PySide.QtGui.QColor |
---|
Return type: | PySide.QtGui.QColor |
---|
This property holds the currently selected color in the dialog.
Parameters: | color – PySide.QtGui.QColor |
---|
Parameters: | index – PySide.QtCore.int |
---|---|
Return type: | long |
Returns the custom color at the given index as a QRgb value.
Return type: | PySide.QtCore.int |
---|
Returns the number of custom colors supported by PySide.QtGui.QColorDialog . All color dialogs share the same custom colors.
Parameters: |
|
---|---|
Return type: |
Parameters: |
|
---|---|
Return type: |
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.
On Symbian, this static function will use the native color dialog and not a PySide.QtGui.QColorDialog .
Parameters: |
|
---|
This is an overloaded function.
Opens the dialog and connects its PySide.QtGui.QColorDialog.colorSelected() signal to the slot specified by receiver and member .
The signal will be disconnected from the slot when the dialog is closed.
Return type: | PySide.QtGui.QColorDialog.ColorDialogOptions |
---|
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).
Return type: | PySide.QtGui.QColor |
---|
Returns the color that the user selected by clicking the OK or equivalent button.
Note
This color is not always the same as the color held by the PySide.QtGui.QColorDialog.currentColor() property since the user can choose different colors before finally selecting the one to use.
Parameters: | color – PySide.QtGui.QColor |
---|
Parameters: |
|
---|
Parameters: |
|
---|
Sets the given option to be enabled if on is true; otherwise, clears the given option .
Parameters: | options – PySide.QtGui.QColorDialog.ColorDialogOptions |
---|
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).
Parameters: |
|
---|
Parameters: | option – PySide.QtGui.QColorDialog.ColorDialogOption |
---|---|
Return type: | PySide.QtCore.bool |
Returns true if the given option is enabled; otherwise, returns false.