# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KColorButton Class Reference

This widget can be used to display or allow user selection of a colour. A pushbutton to display or allow user selection of a colour. More...

`#include <kcolorbutton.h>`

Inheritance diagram for KColorButton:

[legend]
Collaboration diagram for KColorButton:

[legend]
List of all members.

## Signals

void | changed (const QColor &newColor)
| Emitted when the color of the widget is changed, either with setColor() or via user selection.

## Public Member Functions

| KColorButton (QWidget *parent, const char *name=0L)
| Creates a color button.
| KColorButton (const QColor &c, QWidget *parent, const char *name=0L)
| Creates a color button with an initial color `c`.
| KColorButton (const QColor &c, const QColor &defaultColor, QWidget *parent, const char *name=0L)

Since:
  3.1

virtual | ~KColorButton ()
| Destructor.
QColor | color () const
| Returns the currently chosen color.
void | setColor (const QColor &c)
| Sets the current color to `c`.

## Protected Slots

void | chooseColor ()

## Protected Member Functions

virtual void | drawButtonLabel (QPainter *p)
virtual void | dragEnterEvent (QDragEnterEvent *)
virtual void | dropEvent (QDropEvent *)
virtual void | mousePressEvent (QMouseEvent *e)
virtual void | mouseMoveEvent (QMouseEvent *e)
virtual void | virtual_hook (int id, void *data)

## Detailed Description

This widget can be used to display or allow user selection of a colour. A pushbutton to display or allow user selection of a colour.

See also:
  KColorDialog

Version:
  Id
    kcolorbutton.h,v 1.6 2002/09/28 15:16:22 tjansen Exp

Definition at line 34 of file kcolorbutton.h.

## Constructor & Destructor Documentation

KColorButton::KColorButton | ( | QWidget * | parent,
|  | const char * | name = 0L
| ) |

| Creates a color button. Definition at line 39 of file kcolorbutton.cpp. References QPushButton::clicked(), and KStdAccel::name().

KColorButton::KColorButton | ( | const QColor & | c,
|  | QWidget * | parent,
|  | const char * | name = 0L
| ) |

| Creates a color button with an initial color `c`. Definition at line 51 of file kcolorbutton.cpp. References QPushButton::clicked(), and KStdAccel::name().

KColorButton::KColorButton | ( | const QColor & | c,
|  | const QColor & | defaultColor,
|  | QWidget * | parent,
|  | const char * | name = 0L
| ) |

Since:
  3.1

Definition at line 64 of file kcolorbutton.cpp.

References QPushButton::clicked(), and KStdAccel::name().

KColorButton::~KColorButton | ( |  | ) | `[virtual]`

| Destructor. Definition at line 77 of file kcolorbutton.cpp.

## Member Function Documentation

QColor KColorButton::color | ( |  | ) | const`[inline]`

| Returns the currently chosen color. Definition at line 60 of file kcolorbutton.h.

void KColorButton::setColor | ( | const QColor & | c | ) |

| Sets the current color to `c`. Definition at line 82 of file kcolorbutton.cpp. References changed().

void KColorButton::changed | ( | const QColor & | newColor | ) | `[signal]`

| Emitted when the color of the widget is changed, either with setColor() or via user selection. Referenced by setColor().

The documentation for this class was generated from the following files:

- kcolorbutton.h
- kcolorbutton.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:59:10 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001