The QColorDialog class provides a dialog widget for specifying colors. 更多...
继承 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.
静态 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 customCount () different custom colors. The custom colors are shared by all color dialogs, and remembered during the execution of the program. Use setCustomColor () 去设置 custom colors, and use customColor () to get them.
标准对话框 example shows how to use QColorDialog as well as other built-in Qt dialogs.
This enum specifies various options that affect the look and feel of a color dialog.
| 常量 | 值 | 描述 |
|---|---|---|
| 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.DontUseNativeDialog | 0x00000004 | Use Qt's standard color dialog on the Mac instead of the operating system native color dialog. |
该枚举在 Qt 4.5 引入或被修改。
The ColorDialogOptions type is a typedef for QFlags <ColorDialogOption>. It stores an OR combination of ColorDialogOption values.
另请参阅 options , setOption (), testOption (),和 windowModality ().
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
Constructs a color dialog with the given parent .
该函数在 Qt 4.5 引入。
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
Constructs a color dialog with the given parent and specified initial color.
该函数在 Qt 4.5 引入。
重实现自 QWidget.changeEvent ().
Returns the custom color at the given index 作为 QRgb 值。
该函数在 Qt 4.5 引入。
另请参阅 setCustomColor ().
Returns the number of custom colors supported by QColorDialog . All color dialogs share the same custom colors.
重实现自 QDialog.done ().
关闭对话框并将其结果代码设为 result 。若 this dialog is shown with exec_ (), done() causes the local event loop to finish, and exec_ () to return result .
另请参阅 QDialog.done ().
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.
options argument allows you to customize the 对话框。
On Symbian, this static function will use the native color dialog and not a QColorDialog . On Symbian the parameters title and parent has no relevance and the options parameter is only used to define if the native color dialog is used or not.
该函数在 Qt 4.5 引入。
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 QColorDialog .
把对话框展示成 窗口模态对话框 , returning immediately.
该函数在 Qt 4.5 引入。
另请参阅 QDialog.open ().
这是重载函数。
打开对话框并连接其 colorSelected () 信号到 slot specified by receiver and member .
The signal will be disconnected from the slot when the dialog is closed.
该函数在 Qt 4.5 引入。
Returns the color that the user selected by clicking the OK or equivalent button.
注意: This color is not always the same as the color held by the currentColor property since the user can choose different colors before finally selecting the one to use.
Sets the custom color at index 到 QRgb color 值。
注意: This function does not apply to the Native Color Dialog on the Mac OS X platform. If you still require this function, use the QColorDialog.DontUseNativeDialog 选项。
另请参阅 customColor ().
设置给定 option to be enabled if on is true; otherwise, clears the given option .
另请参阅 options and testOption ().
Sets the standard color at index 到 QRgb color 值。
注意: This function does not apply to the Native Color Dialog on the Mac OS X platform. If you still require this function, use the QColorDialog.DontUseNativeDialog 选项。
重实现自 QWidget.setVisible ().
Changes the visibility of the dialog. If visible is true, the dialog is shown; otherwise, it is hidden.
Returns true if the given option is enabled; otherwise, returns false.
该函数在 Qt 4.5 引入。
另请参阅 options and setOption ().
This is the default overload of this signal.
This signal is emitted just after the user has clicked OK to select a color to use. The chosen color is specified by color .
另请参阅 color and currentColorChanged ().
This is the default overload of this signal.
This signal is emitted whenever the current color changes in the dialog. The current color is specified by color .
另请参阅 color and colorSelected ().