#include <colorPickerButton.h>
|
enum | ColorDialogOption { ShowAlphaChannel = 0x00000001
, NoButtons = 0x00000002
, DontUseNativeDialog = 0x00000004
, UseColorDialog = 0x0000000C
} |
|
|
void | colorChanged (QColor) |
|
void | colorNameChanged (QString) |
| This signaled is fired anytime a new color name is set.
|
|
|
| ColorPickerButton (QWidget *parent=0) |
| By default, the color is black.
|
|
| ColorPickerButton (const QString &text, QWidget *parent=0) |
|
| ColorPickerButton (const QColor &color, const QString &text, QWidget *parent=0) |
|
QColor | color () const |
| Current selected color.
|
|
QString | colorName () const |
|
void | setColorName (const QString &name) |
|
bool | displayColorName () const |
| Display the color name after color selection.
|
|
void | setDialogOptions (const ColorDialogOptions &options) |
|
const ColorDialogOptions & | dialogOptions () const |
|
virtual QSize | sizeHint () const |
|
|
void | onToggled (bool change=true) |
|
|
virtual void | paintEvent (QPaintEvent *event) |
|
|
QColor | color |
|
QString | colorName |
|
bool | displayColorName |
|
ColorDialogOptions | dialogOptions |
| This property controls the properties of the dialog used in changeColor.
|
|
ColorPickerButton is a QPushButton that refers to a color. The color and the name of the color (i.e. #FFFFFF) are displayed on the button. When clicked, a color dialog pops up to select a new color for the QPushButton.
◆ ColorPickerButton() [1/2]
ColorPickerButton::ColorPickerButton |
( |
const QString & | text, |
|
|
QWidget * | parent = 0 ) |
|
explicit |
By default, the color is black. The text will be shown on the button if displayColorName is false, otherwise the color name is shown.
- See also
- QPushButton::setText
◆ ColorPickerButton() [2/2]
ColorPickerButton::ColorPickerButton |
( |
const QColor & | color, |
|
|
const QString & | text, |
|
|
QWidget * | parent = 0 ) |
|
explicit |
The text will be shown on the button if displayColorName is false, otherwise the color name is shown.
- See also
- setColor, QPushButton::setText
◆ changeColor
void ColorPickerButton::changeColor |
( |
| ) |
|
|
slot |
Opens a color dialog to select a new current color. If the CTK color dialog (UseColorDialog) is used, then the color name is also set if the user selects a named color.
- See also
- ColorDialog, color, colorName
◆ colorChanged
void ColorPickerButton::colorChanged |
( |
QColor | | ) |
|
|
signal |
colorChanged is fired anytime a new color is set. Programmatically or by the user when choosing a color from the color dialog
◆ colorName()
QString ColorPickerButton::colorName |
( |
| ) |
const |
◆ setColorName()
void ColorPickerButton::setColorName |
( |
const QString & | name | ) |
|
Set the current color name. This allows you to give name other than the default "#RRGGBB" Set an invalid QString to restore the default color names
◆ setDialogOptions()
void ColorPickerButton::setDialogOptions |
( |
const ColorDialogOptions & | options | ) |
|
Set the color dialog options to configure the color dialog.
- See also
- QColorDialog::setOptions QColorDialog::ColorDialogOption
◆ setDisplayColorName
void ColorPickerButton::setDisplayColorName |
( |
bool | displayColorName | ) |
|
|
slot |
Toggle the display of the color name after color selection. By default, this is activated.
◆ sizeHint()
QSize ColorPickerButton::sizeHint |
( |
| ) |
const |
|
virtual |
Reimplemented to return a toolbutton sizehint when no text is displayed in the button.
◆ color
QColor ColorPickerButton::color |
|
readwrite |
This property controls the name of the color. Black (0,0,0) by default.
◆ colorName
QString ColorPickerButton::colorName |
|
readwrite |
This property controls the name of the color. If empty (default), the color in the format "#RRGGBB" is displayed in the button if displayColorName is true, otherwise, the color name is used.
◆ displayColorName
bool ColorPickerButton::displayColorName |
|
readwrite |
This properties controls whether the name of the color is shown on the button if true or the button text instead. True by default.
- See also
- colorName, QPushButton::text
The documentation for this class was generated from the following files:
- C:/Workspace/itom_development_VS2019_Qt5.15.2_x64/itomProject/itom/itomWidgets/colorPickerButton.h
- C:/Workspace/itom_development_VS2019_Qt5.15.2_x64/itomProject/itom/itomWidgets/colorPickerButton.cpp