Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

KColorDialog Class Reference

A color selection dialog. More...

#include <kcolordialog.h>

Inheritance diagram for KColorDialog:

KDialogBase KDialog List of all members.

Public Slots

void setColor (const QColor &col)

Signals

void colorSelected (const QColor &col)

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

Static Public Methods

int getColor (QColor &theColor, QWidget *parent=0L)
int getColor (QColor &theColor, const QColor &defaultColor, QWidget *parent=0L)
QColor grabColor (const QPoint &p)

Protected Methods

virtual void mouseReleaseEvent (QMouseEvent *)
virtual void keyPressEvent (QKeyEvent *)
virtual void virtual_hook (int id, void *data)

Detailed Description

A color selection dialog.

The KColorDialog provides a dialog for color selection.

@sect Features:

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

kcolordialog.png

KDE Color Dialog

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.

Definition at line 405 of file kcolordialog.h.


Constructor & Destructor Documentation

KColorDialog::KColorDialog QWidget *    parent = 0L,
const char *    name = 0L,
bool    modal = FALSE
 

Constructs a color selection dialog.

KColorDialog::~KColorDialog  
 

Destroys the color selection dialog.


Member Function Documentation

QColor KColorDialog::color  
 

Returns the currently selected color.

void KColorDialog::colorSelected const QColor &    col [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  
 

Returns:
the value passed to setDefaultColor

int KColorDialog::getColor QColor &    theColor,
const QColor &    defaultColor,
QWidget *    parent = 0L
[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().

int KColorDialog::getColor QColor &    theColor,
QWidget *    parent = 0L
[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().

QColor KColorDialog::grabColor const QPoint &    p [static]
 

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

virtual void KColorDialog::keyPressEvent QKeyEvent *    [protected, virtual]
 

@reimplemented

Reimplemented from KDialogBase.

virtual void KColorDialog::mouseReleaseEvent QMouseEvent *    [protected, virtual]
 

@reimplemented

void KColorDialog::setColor const QColor &    col [slot]
 

Preselects a color.

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.


The documentation for this class was generated from the following file:
Generated on Wed Aug 13 23:30:06 2003 for kdelibs by doxygen1.2.18