kdeui
KDualColorButton Class Reference
A widget for selecting two related colors. More...
#include <kdualcolorbutton.h>
Public Types | |
enum | DualColor { Foreground, Background } |
Public Slots | |
void | setBackground (const QColor &c) |
void | setCurrent (DualColor s) |
void | setCurrentColor (const QColor &c) |
void | setForeground (const QColor &c) |
Signals | |
void | bgChanged (const QColor &c) |
void | currentChanged (KDualColorButton::DualColor s) |
void | fgChanged (const QColor &c) |
Public Member Functions | |
QColor | background () const |
DualColor | current () const |
QColor | currentColor () const |
QColor | foreground () const |
KDualColorButton (const QColor &fgColor, const QColor &bgColor, QWidget *parent=0, const char *name=0, QWidget *dialogParent=0) | |
KDualColorButton (QWidget *parent=0, const char *name=0, QWidget *dialogParent=0) | |
virtual QSize | sizeHint () const |
~KDualColorButton () | |
Protected Member Functions | |
virtual void | dragEnterEvent (QDragEnterEvent *ev) |
virtual void | dropEvent (QDropEvent *ev) |
virtual void | metrics (QRect &fgRect, QRect &bgRect) |
virtual void | mouseMoveEvent (QMouseEvent *ev) |
virtual void | mousePressEvent (QMouseEvent *ev) |
virtual void | mouseReleaseEvent (QMouseEvent *ev) |
virtual void | paintEvent (QPaintEvent *ev) |
virtual void | virtual_hook (int id, void *data) |
Properties | |
QColor | background |
DualColor | current |
QColor | currentColor |
QColor | foreground |
Detailed Description
A widget for selecting two related colors.KDualColorButton allows the user to select two cascaded colors (usually a foreground and background color). Other features include drag and drop from other KDE color widgets, a reset to black and white control, and a swap colors control.
When the user clicks on the foreground or background rectangle the rectangle is first sunken and the currentChanged() signal is emitted. Further clicks will present a color dialog and emit either the fgChanged() or bgChanged() if a new color is selected.
Note: With drag and drop when dropping a color the current selected color will be set, while when dragging a color it will use whatever color rectangle the mouse was pressed inside.
KDE Dual Color Button
Definition at line 48 of file kdualcolorbutton.h.
Member Enumeration Documentation
Constructor & Destructor Documentation
KDualColorButton::KDualColorButton | ( | QWidget * | parent = 0 , |
|
const char * | name = 0 , |
|||
QWidget * | dialogParent = 0 | |||
) |
Constructs a new KDualColorButton using the default black and white colors.
As of KDE 3.5.1, sets the dialog parent to the same as "parent" if that argument is non-null and the dialogParent argument is null.
Definition at line 35 of file kdualcolorbutton.cpp.
KDualColorButton::KDualColorButton | ( | const QColor & | fgColor, | |
const QColor & | bgColor, | |||
QWidget * | parent = 0 , |
|||
const char * | name = 0 , |
|||
QWidget * | dialogParent = 0 | |||
) |
Constructs a new KDualColorButton with the supplied foreground and background colors.
Definition at line 59 of file kdualcolorbutton.cpp.
KDualColorButton::~KDualColorButton | ( | ) |
Definition at line 80 of file kdualcolorbutton.cpp.
Member Function Documentation
QColor KDualColorButton::background | ( | ) | const |
Returns the current background color.
void KDualColorButton::bgChanged | ( | const QColor & | c | ) | [signal] |
Emitted when the background color is changed.
DualColor KDualColorButton::current | ( | ) | const |
Returns the current color item selected by the user.
void KDualColorButton::currentChanged | ( | KDualColorButton::DualColor | s | ) | [signal] |
Emitted when the user changes the current color selection.
QColor KDualColorButton::currentColor | ( | ) | const |
Returns the color of the selected item.
void KDualColorButton::dragEnterEvent | ( | QDragEnterEvent * | ev | ) | [protected, virtual] |
void KDualColorButton::dropEvent | ( | QDropEvent * | ev | ) | [protected, virtual] |
void KDualColorButton::fgChanged | ( | const QColor & | c | ) | [signal] |
Emitted when the foreground color is changed.
QColor KDualColorButton::foreground | ( | ) | const |
Returns the current foreground color.
Sets the supplied rectangles to the proper size and position for the current widget size.
You can reimplement this to change the layout of the widget. Restrictions are that the swap control will always be at the top right, the reset control will always be at the bottom left, and you must leave at least a 14x14 space in those corners.
Definition at line 143 of file kdualcolorbutton.cpp.
void KDualColorButton::mouseMoveEvent | ( | QMouseEvent * | ev | ) | [protected, virtual] |
void KDualColorButton::mousePressEvent | ( | QMouseEvent * | ev | ) | [protected, virtual] |
void KDualColorButton::mouseReleaseEvent | ( | QMouseEvent * | ev | ) | [protected, virtual] |
void KDualColorButton::paintEvent | ( | QPaintEvent * | ev | ) | [protected, virtual] |
void KDualColorButton::setBackground | ( | const QColor & | c | ) | [slot] |
void KDualColorButton::setCurrent | ( | DualColor | s | ) | [slot] |
void KDualColorButton::setCurrentColor | ( | const QColor & | c | ) | [slot] |
void KDualColorButton::setForeground | ( | const QColor & | c | ) | [slot] |
QSize KDualColorButton::sizeHint | ( | void | ) | const [virtual] |
Returns the minimum size needed to display the widget and all its controls.
Reimplemented from QWidget.
Definition at line 107 of file kdualcolorbutton.cpp.
void KDualColorButton::virtual_hook | ( | int | id, | |
void * | data | |||
) | [protected, virtual] |
Definition at line 280 of file kdualcolorbutton.cpp.
Property Documentation
QColor KDualColorButton::background [read, write] |
Definition at line 53 of file kdualcolorbutton.h.
KDualColorButton::DualColor KDualColorButton::current [read, write] |
Definition at line 55 of file kdualcolorbutton.h.
QColor KDualColorButton::currentColor [read, write] |
Definition at line 54 of file kdualcolorbutton.h.
QColor KDualColorButton::foreground [read, write] |
Definition at line 52 of file kdualcolorbutton.h.
The documentation for this class was generated from the following files: