Color selection dialog class. More...
This class can be used to allow user selection of the color using RGB or HSV color-model. For both of them there are both sliders and spinboxes for value selection. Additionally the HSV model is also represented in a well known form of separate HS chart and V slider.
This dialog may be used as any other in Qt, but it provides also the static function getColor() that can be conviniently used as follows:
#include "qcolordlg.h" ... QColor initial_color; // The color that dialog will start with QColor result; // The resulting user's selection result = QColorDlg::getColor( initial_color );
Constructor.
This method constructs the dialog with given parent and name asusually with classes derived from QDialog. Contrary to usual QDialog classes it creates the dialog that is modal.
The implementation of this method is rather long and boring. It contains a lot of geometry management made with ose of Qt layouts, so that the dialog should look OK even if the names of some of the labels are substituted with a very long (or very short) strings.
Destructor.
The destructor in fact does nothing, the Qt library kills all the children of the dialog, and those are the only dynamically allocated things here.
Returns currently selected color.
[slot]
Sets current color in the dialog.
This function sets the actual color in the dialog. It does it by updating at first the values of RGB sliders and then calling updateFromRGB() function.
[static]
Function that returns user's choice.
This function constructs a color selection dialog, runs it and returns the resulting user selection (or initial selection if Cancel was pressed).
[protected, slot]
Updates the dialog from RGB controls.
This function recalculates the HSV values from the current RGB values and updates the colorLabel to display appropriate color. As this function and updateFromHSV() shouldn't overlap, this one first checks for isHsvUpdating and returns silently if true. In the other case it sets isRgbUpdating so that updateFromHSV() will not interfere.
[protected, slot]
Updates the dialog from HSV controls.
This function updates the RGB values from current HSV values. It is complmentary to updateFromRGB().
[protected]
Currently selected color.
[protected]
The label on which the color is displayed.
[protected]
Red component slider.
[protected]
Green component slider.
[protected]
Blue component slider.
[protected]
Hue component slider.
[protected]
Saturation component slider.
[protected]
Value component slider.
[protected]
Flag for indicating that the dialog is within updating its state from RGB controls.
[protected]
Flag for indicating that the dialog is within updating its state from HSV controls.