\section{KColor\-Dialog Class Reference}
\label{classKColorDialog}\index{KColorDialog@{KColorDialog}}
A color selection dialog.  


{\tt \#include $<$kcolordialog.h$>$}

Inheritance diagram for KColor\-Dialog:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=55pt]{classKColorDialog__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KColor\-Dialog:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=55pt]{classKColorDialog__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf set\-Color} (const {\bf QColor} \&col)
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf color\-Selected} (const {\bf QColor} \&col)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KColor\-Dialog} ({\bf QWidget} $\ast$parent=0L, const char $\ast$name=0L, bool modal=false)
\item 
{\bf $\sim$KColor\-Dialog} ()
\item 
{\bf QColor} {\bf color} () const 
\item 
void {\bf set\-Default\-Color} (const {\bf QColor} \&default\-Col)
\item 
{\bf QColor} {\bf default\-Color} () const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static int {\bf get\-Color} ({\bf QColor} \&the\-Color, {\bf QWidget} $\ast$parent=0L)
\item 
static int {\bf get\-Color} ({\bf QColor} \&the\-Color, const {\bf QColor} \&default\-Color, {\bf QWidget} $\ast$parent=0L)
\item 
static {\bf QColor} {\bf grab\-Color} (const {\bf QPoint} \&p)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf mouse\-Release\-Event} ({\bf QMouse\-Event} $\ast$)\label{classKColorDialog_b0}

\item 
virtual void {\bf key\-Press\-Event} ({\bf QKey\-Event} $\ast$)
\item 
virtual bool {\bf event\-Filter} ({\bf QObject} $\ast$obj, {\bf QEvent} $\ast$ev)\label{classKColorDialog_b2}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKColorDialog_b3}

\end{CompactItemize}


\subsection{Detailed Description}
A color selection dialog. 

{\bf Features:}\par


\begin{itemize}
\item Color selection from a wide range of palettes. \item Color selection from a palette of H vs S and V selectors (similar to windoze). \item Direct input of HSV or RGB values. \item Saving of custom colors\end{itemize}
In most cases, you will want to use the static method {\bf KColor\-Dialog::get\-Color()}{\rm (p.\,\pageref{classKColorDialog_e0})}. This pops up the dialog (with an initial selection provided by you), lets the user choose a color, and returns.

Example:



\footnotesize\begin{verbatim}    QColor myColor;
    int result = KColorDialog::getColor( myColor );
         if ( result == KColorDialog::Accepted )
            ...
\end{verbatim}
\normalsize


 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 {\bf KXYSelector}{\rm (p.\,\pageref{classKXYSelector})}. Right next to it is a {\bf KHSSelector}{\rm (p.\,\pageref{classKHSSelector})} for choosing hue/saturation.

On the right side of the dialog you see a {\bf KPalette\-Table}{\rm (p.\,\pageref{classKPaletteTable})} 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 {\bf KColor\-Patch}{\rm (p.\,\pageref{classKColorPatch})}. 



Definition at line 375 of file kcolordialog.h.

\subsection{Constructor \& Destructor Documentation}
\index{KColorDialog@{KColor\-Dialog}!KColorDialog@{KColorDialog}}
\index{KColorDialog@{KColorDialog}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KColor\-Dialog::KColor\-Dialog ({\bf QWidget} $\ast$ {\em parent} = {\tt 0L}, const char $\ast$ {\em name} = {\tt 0L}, bool {\em modal} = {\tt false})}\label{classKColorDialog_a0}


Constructs a color selection dialog. 



Definition at line 915 of file kcolordialog.cpp.

References QGrid\-Layout::add\-Layout(), QGrid\-Layout::add\-Multi\-Cell\-Widget(), QGrid\-Layout::add\-Widget(), KDialog\-Base::close\-Clicked(), color\-Selected(), KDialog\-Base::disable\-Resize(), KDialog\-Base::ok\-Clicked(), set\-Color(), QGrid\-Layout::set\-Col\-Stretch(), KDialog\-Base::set\-Help(), KColor::set\-Hsv(), KDialog\-Base::set\-Main\-Widget(), QWidget::set\-Minimum\-Size(), QPush\-Button::set\-Pixmap(), QPush\-Button::set\-Text(), QWidget::size\-Hint(), and KDialog::spacing\-Hint().\index{KColorDialog@{KColor\-Dialog}!~KColorDialog@{$\sim$KColorDialog}}
\index{~KColorDialog@{$\sim$KColorDialog}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KColor\-Dialog::$\sim${\bf KColor\-Dialog} ()}\label{classKColorDialog_a1}


Destroys the color selection dialog. 



Definition at line 1155 of file kcolordialog.cpp.

\subsection{Member Function Documentation}
\index{KColorDialog@{KColor\-Dialog}!color@{color}}
\index{color@{color}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KColor\-Dialog::color () const}\label{classKColorDialog_a2}


Returns the currently selected color. 



Definition at line 1262 of file kcolordialog.cpp.

Referenced by get\-Color().\index{KColorDialog@{KColor\-Dialog}!getColor@{getColor}}
\index{getColor@{getColor}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KColor\-Dialog::get\-Color ({\bf QColor} \& {\em the\-Color}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0L})\hspace{0.3cm}{\tt  [static]}}\label{classKColorDialog_e0}


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 {\tt the\-Color}.

\begin{Desc}
\item[Returns:]{\bf QDialog::result()}. \end{Desc}


Definition at line 1279 of file kcolordialog.cpp.

References color(), QDialog::exec(), and set\-Color().\index{KColorDialog@{KColor\-Dialog}!getColor@{getColor}}
\index{getColor@{getColor}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KColor\-Dialog::get\-Color ({\bf QColor} \& {\em the\-Color}, const {\bf QColor} \& {\em default\-Color}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0L})\hspace{0.3cm}{\tt  [static]}}\label{classKColorDialog_e1}


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 {\tt the\-Color}.

This version takes a {\tt default\-Color} argument, which sets the color selected by the \char`\"{}default color\char`\"{} checkbox. When this checkbox is checked, the invalid color (QColor()) is returned into {\tt the\-Color}.

\begin{Desc}
\item[Returns:]{\bf QDialog::result()}. \end{Desc}


Definition at line 1297 of file kcolordialog.cpp.

References color(), QDialog::exec(), set\-Color(), and set\-Default\-Color().\index{KColorDialog@{KColor\-Dialog}!grabColor@{grabColor}}
\index{grabColor@{grabColor}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KColor\-Dialog::grab\-Color (const {\bf QPoint} \& {\em p})\hspace{0.3cm}{\tt  [static]}}\label{classKColorDialog_e2}


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



Definition at line 1514 of file kcolordialog.cpp.

References QPixmap::convert\-To\-Image(), QApplication::desktop(), QPixmap::grab\-Window(), QImage::pixel(), QWidget::win\-Id(), QWidget::x(), and QWidget::y().\index{KColorDialog@{KColor\-Dialog}!setDefaultColor@{setDefaultColor}}
\index{setDefaultColor@{setDefaultColor}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KColor\-Dialog::set\-Default\-Color (const {\bf QColor} \& {\em default\-Col})}\label{classKColorDialog_a3}


Call this to make the dialog show a \char`\"{}Default Color\char`\"{} checkbox. 

If this checkbox is selected, the dialog will return an \char`\"{}invalid\char`\"{} color (QColor()). This can be used to mean \char`\"{}the default text color\char`\"{}, for instance, the one with the {\bf KDE} text color on screen, but black when printing. 

Definition at line 1184 of file kcolordialog.cpp.

References KDialog\-Base::disable\-Resize(), KDialog\-Base::main\-Widget(), QWidget::set\-Maximum\-Size(), and QWidget::set\-Minimum\-Size().

Referenced by get\-Color().\index{KColorDialog@{KColor\-Dialog}!defaultColor@{defaultColor}}
\index{defaultColor@{defaultColor}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KColor\-Dialog::default\-Color () const}\label{classKColorDialog_a4}


\begin{Desc}
\item[Returns:]the value passed to set\-Default\-Color \end{Desc}


Definition at line 1214 of file kcolordialog.cpp.\index{KColorDialog@{KColor\-Dialog}!setColor@{setColor}}
\index{setColor@{setColor}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KColor\-Dialog::set\-Color (const {\bf QColor} \& {\em col})\hspace{0.3cm}{\tt  [slot]}}\label{classKColorDialog_i0}


Preselects a color. 



Definition at line 1271 of file kcolordialog.cpp.

Referenced by get\-Color(), and KColor\-Dialog().\index{KColorDialog@{KColor\-Dialog}!colorSelected@{colorSelected}}
\index{colorSelected@{colorSelected}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KColor\-Dialog::color\-Selected (const {\bf QColor} \& {\em col})\hspace{0.3cm}{\tt  [signal]}}\label{classKColorDialog_l0}


Emitted when a color is selected. 

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

Referenced by KColor\-Dialog().\index{KColorDialog@{KColor\-Dialog}!keyPressEvent@{keyPressEvent}}
\index{keyPressEvent@{keyPressEvent}!KColorDialog@{KColor\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KColor\-Dialog::key\-Press\-Event ({\bf QKey\-Event} $\ast$)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKColorDialog_b1}


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 {\bf KDialog\-Base} {\rm (p.\,\pageref{classKDialogBase_b0})}.

Definition at line 1523 of file kcolordialog.cpp.

References KDialog\-Base::key\-Press\-Event().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kcolordialog.h\item 
kcolordialog.cpp\end{CompactItemize}
