KDEUI
#include <kcolordialog.h>
Public Slots | |
void | setColor (const QColor &col) |
Public Slots inherited from KDialog | |
void | delayedDestruct () |
void | enableButton (ButtonCode id, bool state) |
void | enableButtonApply (bool state) |
void | enableButtonCancel (bool state) |
void | enableButtonOk (bool state) |
void | enableLinkedHelp (bool state) |
bool | isDetailsWidgetVisible () const |
virtual void | setCaption (const QString &caption) |
virtual void | setCaption (const QString &caption, bool modified) |
void | setDetailsWidget (QWidget *detailsWidget) |
void | setDetailsWidgetVisible (bool visible) |
void | setHelp (const QString &anchor, const QString &appname=QString()) |
void | setHelpLinkText (const QString &text) |
virtual void | setPlainCaption (const QString &caption) |
Signals | |
void | colorSelected (const QColor &col) |
Signals inherited from KDialog | |
void | aboutToShowDetails () |
void | applyClicked () |
void | buttonClicked (KDialog::ButtonCode button) |
void | cancelClicked () |
void | closeClicked () |
void | defaultClicked () |
void | finished () |
void | helpClicked () |
void | hidden () |
void | layoutHintChanged () |
void | noClicked () |
void | okClicked () |
void | resetClicked () |
void | tryClicked () |
void | user1Clicked () |
void | user2Clicked () |
void | user3Clicked () |
void | yesClicked () |
Static Public Member Functions | |
static int | getColor (QColor &theColor, QWidget *parent=0L) |
static int | getColor (QColor &theColor, const QColor &defaultColor, QWidget *parent=0L) |
static QColor | grabColor (const QPoint &p) |
Static Public Member Functions inherited from KDialog | |
static bool | avoidArea (QWidget *widget, const QRect &area, int screen=-1) |
static void | centerOnScreen (QWidget *widget, int screen=-1) |
static int | groupSpacingHint () |
static QString | makeStandardCaption (const QString &userCaption, QWidget *window=0, CaptionFlags flags=HIGCompliantCaption) |
static int | marginHint () |
static void | resizeLayout (QWidget *widget, int margin, int spacing) |
static void | resizeLayout (QLayout *lay, int margin, int spacing) |
static void | setAllowEmbeddingInGraphicsView (bool allowEmbedding) |
static int | spacingHint () |
Protected Member Functions | |
virtual bool | eventFilter (QObject *obj, QEvent *ev) |
virtual void | keyPressEvent (QKeyEvent *) |
virtual void | mouseMoveEvent (QMouseEvent *) |
virtual void | mouseReleaseEvent (QMouseEvent *) |
Protected Member Functions inherited from KDialog | |
KDialog (KDialogPrivate &dd, QWidget *parent, Qt::WindowFlags flags=0) | |
virtual void | closeEvent (QCloseEvent *e) |
virtual void | hideEvent (QHideEvent *) |
Properties | |
QColor | color |
QColor | defaultColor |
bool | isAlphaChannelEnabled |
Additional Inherited Members | |
Public Types inherited from KDialog | |
enum | ButtonCode { None = 0x00000000, Help = 0x00000001, Default = 0x00000002, Ok = 0x00000004, Apply = 0x00000008, Try = 0x00000010, Cancel = 0x00000020, Close = 0x00000040, No = 0x00000080, Yes = 0x00000100, Reset = 0x00000200, Details = 0x00000400, User1 = 0x00001000, User2 = 0x00002000, User3 = 0x00004000, NoDefault = 0x00008000 } |
enum | ButtonPopupMode { InstantPopup = 0, DelayedPopup = 1 } |
enum | CaptionFlag { NoCaptionFlags = 0, AppNameCaption = 1, ModifiedCaption = 2, HIGCompliantCaption = AppNameCaption } |
Protected Slots inherited from KDialog | |
virtual void | slotButtonClicked (int button) |
void | updateGeometry () |
Protected Attributes inherited from KDialog | |
KDialogPrivate *const | d_ptr |
Detailed Description
A color selection dialog.
Features:
- Color selection from a wide range of palettes.
- Color selection from a palette of H vs S and V selectors.
- Direct input of HSV or RGB values.
- Saving of custom colors
In most cases, you will want to use the static method KColorDialog::getColor(). This pops up the dialog (with an initial selection provided by you), lets the user choose a color, and returns.
Example:
To react to the color selection as it is being selected, the colorSelected() signal can be used. This can be used still in a modal way, for example:
The color dialog is really a collection of several widgets which can you can also use separately: the quadratic plane in the top left of the dialog is a KXYSelector. Right next to it is a KHSSelector for choosing hue/saturation.
On the right side of the dialog you see a KColorTable showing a number of colors with a combo box which offers several predefined palettes or a palette configured by the user. The small field showing the currently selected color is a KColorPatch.
Definition at line 210 of file kcolordialog.h.
Constructor & Destructor Documentation
Constructs a color selection dialog.
Definition at line 1021 of file kcolordialog.cpp.
KColorDialog::~KColorDialog | ( | ) |
Destroys the color selection dialog.
Definition at line 1315 of file kcolordialog.cpp.
Member Function Documentation
QColor KColorDialog::color | ( | ) | const |
Returns the currently selected color.
|
signal |
Emitted when a color is selected.
Connect to this to monitor the color as it as selected if you are not running modal.
QColor KColorDialog::defaultColor | ( | ) | const |
- Returns
- the value passed to setDefaultColor
Definition at line 1325 of file kcolordialog.cpp.
Creates a modal color dialog, let the user choose a color, and returns when the dialog is closed.
The selected color is returned in the argument theColor
.
- Parameters
-
theColor if valid, specifies the color to be initially selected. On return, holds the selected color.
- Returns
- QDialog::result().
Definition at line 1492 of file kcolordialog.cpp.
|
static |
Creates a modal color dialog, lets the user choose a color, and returns when the dialog is closed.
The selected color is returned in the argument theColor
.
This version takes a defaultColor
argument, which sets the color selected by the "default color" checkbox. When this checkbox is checked, the invalid color (QColor()) is returned into theColor
.
- Parameters
-
theColor if valid, specifies the color to be initially selected. On return, holds the selected color. defaultColor color selected by the "default color" checkbox
- Returns
- QDialog::result().
Definition at line 1510 of file kcolordialog.cpp.
Gets the color from the pixel at point p on the screen.
Definition at line 1759 of file kcolordialog.cpp.
bool KColorDialog::isAlphaChannelEnabled | ( | ) | const |
Returns true when the user can change the alpha channel.
- Since
- 4.5
|
protectedvirtual |
Reimplemented from KDialog.
Definition at line 1787 of file kcolordialog.cpp.
|
protectedvirtual |
Definition at line 1731 of file kcolordialog.cpp.
|
protectedvirtual |
Definition at line 1742 of file kcolordialog.cpp.
void KColorDialog::setAlphaChannelEnabled | ( | bool | alpha | ) |
When set to true, the user is allowed to change the alpha component of the color.
The default value is false.
- Since
- 4.5
Definition at line 1376 of file kcolordialog.cpp.
|
slot |
Preselects a color.
Definition at line 1484 of file kcolordialog.cpp.
void KColorDialog::setDefaultColor | ( | const QColor & | defaultCol | ) |
Call this to make the dialog show a "Default Color" checkbox.
If this checkbox is selected, the dialog will return an "invalid" color (QColor()). This can be used to mean "the default text color", for instance, the one with the KDE text color on screen, but black when printing.
Definition at line 1343 of file kcolordialog.cpp.
Property Documentation
|
readwrite |
Definition at line 215 of file kcolordialog.h.
|
readwrite |
Definition at line 214 of file kcolordialog.h.
|
readwrite |
Definition at line 213 of file kcolordialog.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.