• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdeui
 

kdeui

Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions
KColorDialog Class Reference

#include <kcolordialog.h>

Inheritance diagram for KColorDialog:
KDialogBase KDialog

List of all members.

Public Slots

void setColor (const TQColor &col)

Signals

void colorSelected (const TQColor &col)

Public Member Functions

 KColorDialog (TQWidget *parent=0L, const char *name=0L, bool modal=false)
 ~KColorDialog ()
TQColor color () const
void setDefaultColor (const TQColor &defaultCol)
TQColor defaultColor () const

Static Public Member Functions

static int getColor (TQColor &theColor, TQWidget *parent=0L)
static int getColor (TQColor &theColor, const TQColor &defaultColor, TQWidget *parent=0L)
static TQColor grabColor (const TQPoint &p)

Protected Member Functions

virtual void mouseReleaseEvent (TQMouseEvent *)
virtual void keyPressEvent (TQKeyEvent *)
virtual bool eventFilter (TQObject *obj, TQEvent *ev)
virtual void virtual_hook (int id, void *data)

Detailed Description

A color selection dialog.

Features:

  • Color selection from a wide range of palettes.
  • Color selection from a palette of H vs S and V selectors.
  • 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:

    TQColor 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 choosing 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 377 of file kcolordialog.h.


Constructor & Destructor Documentation

KColorDialog::KColorDialog ( TQWidget *  parent = 0L,
const char *  name = 0L,
bool  modal = false 
)

Constructs a color selection dialog.

Definition at line 939 of file kcolordialog.cpp.

KColorDialog::~KColorDialog ( )

Destroys the color selection dialog.

Definition at line 1178 of file kcolordialog.cpp.


Member Function Documentation

TQColor KColorDialog::color ( ) const

Returns the currently selected color.

Definition at line 1281 of file kcolordialog.cpp.

void KColorDialog::colorSelected ( const TQColor &  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.

TQColor KColorDialog::defaultColor ( ) const
Returns:
the value passed to setDefaultColor

Definition at line 1237 of file kcolordialog.cpp.

int KColorDialog::getColor ( TQColor &  theColor,
TQWidget *  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:
TQDialog::result().

Definition at line 1298 of file kcolordialog.cpp.

int KColorDialog::getColor ( TQColor &  theColor,
const TQColor &  defaultColor,
TQWidget *  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 (TQColor()) is returned into theColor.

Returns:
TQDialog::result().

Definition at line 1316 of file kcolordialog.cpp.

TQColor KColorDialog::grabColor ( const TQPoint &  p) [static]

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

Definition at line 1533 of file kcolordialog.cpp.

void KColorDialog::keyPressEvent ( TQKeyEvent *  e) [protected, virtual]

Maps some keys to the actions buttons.

F1 is mapped to the Help button if present and Escape to the Cancel or Close if present. The button action event is animated.

Reimplemented from KDialogBase.

Definition at line 1542 of file kcolordialog.cpp.

void KColorDialog::setColor ( const TQColor &  col) [slot]

Preselects a color.

Definition at line 1290 of file kcolordialog.cpp.

void KColorDialog::setDefaultColor ( const TQColor &  defaultCol)

Call this to make the dialog show a "Default Color" checkbox.

If this checkbox is selected, the dialog will return an "invalid" color (TQColor()). 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.

Definition at line 1207 of file kcolordialog.cpp.


The documentation for this class was generated from the following files:
  • kcolordialog.h
  • kcolordialog.cpp

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |