KColorButton Class
A pushbutton to display or allow user selection of a color. More...
- Header:
#include <KColorButton> - CMake:
find_package(KF6 REQUIRED COMPONENTS WidgetsAddons)
target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons) - Inherits: QPushButton
List of all members, including inherited members
Properties
Public Functions
- KColorButton(QWidget *parent = nullptr)
- KColorButton(const QColor &c, QWidget *parent = nullptr)
- KColorButton(const QColor &c, const QColor &defaultColor, QWidget *parent = nullptr)
- QColor color() const
- QColor defaultColor() const
- bool isAlphaChannelEnabled() const
- void setAlphaChannelEnabled(bool alpha)
- void setColor(const QColor &c)
- void setDefaultColor(const QColor &c)
Signals
Detailed Description
This widget can be used to display or allow user selection of a color.
See also QColorDialog
Property Documentation
alphaChannelEnabled : bool
Access functions:
boolisAlphaChannelEnabled() constvoidsetAlphaChannelEnabled(boolalpha)
color : QColor
Access functions:
Notifier signal:
voidchanged(constQColor&newColor)
defaultColor : QColor
Access functions:
QColordefaultColor() constvoidsetDefaultColor(constQColor&c)
Member Function Documentation
[explicit] KColorButton::KColorButton(QWidget *parent = nullptr)
Creates a color button.
[explicit] KColorButton::KColorButton(const QColor &c, QWidget *parent = nullptr)
Creates a color button with an initial color c.
KColorButton::KColorButton(const QColor &c, const QColor &defaultColor, QWidget *parent = nullptr)
Creates a color button with an initial color c and default color defaultColor.
[signal] void KColorButton::changed(const QColor &newColor)
Emitted when the color of the widget is changed, either with setColor() or via user selection.
Note: Notifier signal for property color.
QColor KColorButton::color() const
Returns the currently chosen color.
Note: Getter function for property color.
See also setColor()
QColor KColorButton::defaultColor() const
Returns the default color or an invalid color if no default color is set.
Note: Getter function for property defaultColor.
See also setDefaultColor()
bool KColorButton::isAlphaChannelEnabled() const
Returns true if the user is allowed to change the alpha component.
Note: Getter function for property alphaChannelEnabled.
void KColorButton::setAlphaChannelEnabled(bool alpha)
When set to true, allow the user to change the alpha component of the color. The default value is false.
Note: Setter function for property alphaChannelEnabled.
See also isAlphaChannelEnabled()
void KColorButton::setColor(const QColor &c)
Sets the current color to c.
Note: Setter function for property color.
See also color()
void KColorButton::setDefaultColor(const QColor &c)
Sets the default color to c.
Note: Setter function for property defaultColor.
See also defaultColor()