# class KDualColorButton | A widget for selecting two related colors. More...
Definition | `#include <kdualcolorbtn.h>`
Inherits | QWidget (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Slots

- void setForeground (const QColor &c)
- void setBackground (const QColor &c)
- void setCurrent (DualColor s)
- void setCurrentColor (const QColor &c)

#### Signals

- void fgChanged (const QColor &c)
- void bgChanged (const QColor &c)
- void currentChanged (KDualColorButton::DualColor s)

#### Protected Methods

- virtual void metrics (QRect &fgRect, QRect &bgRect)
- virtual void paintEvent (QPaintEvent *ev)
- virtual void mousePressEvent (QMouseEvent *ev)
- virtual void mouseMoveEvent (QMouseEvent *ev)
- virtual void mouseReleaseEvent (QMouseEvent *ev)
- virtual void dragEnterEvent (QDragEnterEvent *ev)
- virtual void dropEvent (QDropEvent *ev)

## Detailed Description

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.

void setForeground (const QColor &c) | ### setForeground

[slot]

Sets the foreground color.

void setBackground (const QColor &c) | ### setBackground

[slot]

Sets the background color.

void setCurrent (DualColor s) | ### setCurrent

[slot]

Sets the current selected color item.

void setCurrentColor (const QColor &c) | ### setCurrentColor

[slot]

Sets the color of the selected item.

void fgChanged (const QColor &c) | ### fgChanged

[signal]

Emitted when the foreground color is changed.

void bgChanged (const QColor &c) | ### bgChanged

[signal]

Emitted when the background color is changed.

void currentChanged (KDualColorButton::DualColor s) | ### currentChanged

[signal]

Emitted when the user changes the current color selection.

void metrics (QRect &fgRect, QRect &bgRect) | ### metrics

[protected virtual]

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.

void paintEvent (QPaintEvent *ev) | ### paintEvent

[protected virtual]

Reimplemented from QWidget.

void mousePressEvent (QMouseEvent *ev) | ### mousePressEvent

[protected virtual]

Reimplemented from QWidget.

void mouseMoveEvent (QMouseEvent *ev) | ### mouseMoveEvent

[protected virtual]

Reimplemented from QWidget.

void mouseReleaseEvent (QMouseEvent *ev) | ### mouseReleaseEvent

[protected virtual]

Reimplemented from QWidget.

void dragEnterEvent (QDragEnterEvent *ev) | ### dragEnterEvent

[protected virtual]

Reimplemented from QWidget.

void dropEvent (QDropEvent *ev) | ### dropEvent

[protected virtual]

Reimplemented from QWidget.

- Author: Daniel M. Duley <mosfet@kde.org>
- Generated: root@i386.ports.openbsd.org on Wed Apr 25 13:58:24 2001, using kdoc 2.0a53.