class KColorDialog

# class KColorDialog | A color selection dialog. More...
Definition | `#include <kcolordialog.h>`
Inherits | KDialogBase [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KColorDialog ( QWidget *parent = 0L, const char *name = 0L, bool modal = FALSE )
- ~KColorDialog ()
- QColor color () const
- void setDefaultColor ( const QColor& defaultCol )
- QColor defaultColor () const

#### Public Slots

- void setColor ( const QColor &col )

#### Signals

- void colorSelected ( const QColor &col )

#### Public Static Methods

- 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)

#### Protected Methods

- virtual void virtual_hook ( int id, void* data )

## Detailed Description

The KColorDialog provides a dialog for color selection.

### Features:

- Colour selection from a wide range of palettes.
- Colour selection from a palette of H vs S and V selectors (similar to windoze).
- 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:

     	QColor myColor;
     	int result = KColorDialog::getColor( myColor );
             if ( result == KColorDialog::Accepted )
                ...

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 chosing hue/saturation.

On the right side of the dialog you see a KPaletteTable showing up to 40 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.

KColorDialog ( QWidget *parent = 0L, const char *name = 0L, bool modal = FALSE ) | ### KColorDialog

Constructs a color selection dialog.

~KColorDialog () | ### ~KColorDialog

Destroys the color selection dialog.

QColor color () | ### color

[const]

Returns the currently selected color.

int getColor ( QColor &theColor, QWidget *parent=0L ) | ### getColor

[static]

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`.

Returns: QDialog::result().

int getColor ( QColor &theColor, const QColor& defaultColor, QWidget *parent=0L ) | ### getColor

[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`.

Returns: QDialog::result().

QColor grabColor (const QPoint &p) | ### grabColor

[static]

Gets the color from the pixel at point p on the screen.

void setDefaultColor ( const QColor& defaultCol ) | ### setDefaultColor

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.

QColor defaultColor () | ### defaultColor

[const]

Returns: the value passed to setDefaultColor

void setColor ( const QColor &col ) | ### setColor

[slot]

Preselects a color.

void colorSelected ( const QColor &col ) | ### colorSelected

[signal]

Emitted when a color is selected. Connect to this to monitor the color as it as selected if you are not running modal.

void mouseReleaseEvent ( QMouseEvent * ) | ### mouseReleaseEvent

[protected virtual]

void keyPressEvent ( QKeyEvent * ) | ### keyPressEvent

[protected virtual]

Reimplemented from KDialogBase for internal purposes..

void virtual_hook ( int id, void* data ) | ### virtual_hook

[protected virtual]

Reimplemented from KDialogBase.

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:37 2003, using kdoc 2.0a54.