Slider with Value-based gradient background. More...
This class provides a slider with the background changing from 0 to maximum Value of the specified color. It can be used together with QHSSelector to allow selection of a color in HSV color space.
It contains only one signal, as there is only one value that can be changed by user. Yet there are three 'set' signals which is neccessary as the control also needs information about Hue and Saturation to properly update its background. In the code it could be connected to the QHSSelector widget in the following manner:
QHSSelector* hsWidget; QValueSelector* vWidget; ... (set up the widgets appropriately within their parent) ... connect( hsWidget, SIGNAL( hueChanged( int ) ), vWidget, SLOT( setHue( int ) ) ); connect( hsWidget, SIGNAL( saturationChanged( int ) ), vWidget, SLOT( setSaturation( int ) ) ); ... QColor current_color = QColor( hsWidget->hue(), hsWidget->saturation(), vWidget->value() ,QColor::Hsv );
The Value can be in a range <0 ... 255>.
Constructor.
This method constructs the QValueSelector object. It passes the arguments parent and name to QLabel constructor. The widget that is constructed has a fixed size of 10x128 pixels. The dafault background is a gradient from black to white.
Destructor.
The destructor does nothing; the Qt framework takes care of cleaning up.
Returns current value.
[slot]
Sets the surrent Value.
After validation of passed value v this method sets iValue member to it. If the iValue has changed, appropriate updates are done on the widget's background and the signal valueChanged() is emited.
[slot]
Sets the surrent Hue.
This method updates the background image of the widget so that it contains only colors with given hue and changing value. In the end it calls update() so that the whole widget is redrawn.
[slot]
Sets the surrent Saturation.
This method updates the background image of the widget so that it contains only colors with given saturation and changing value. In the end it calls update() so that the whole widget is redrawn.
[signal]
Emited when value changed.
[protected, virtual]
Repaints gradient changing background together with the slider mark.
This method processes paint event by calling the paintEvent() so that the widget's background is updated and then drawing the slider in appropriate position.
[protected, virtual]
Used for user interaction.
This method simply calls setValue() function with appropriate value calculated from the mouse y-coordinate.
[protected, virtual]
Used for user interaction.
As the result of pressing the mouse button should be the same as dragging it, this method simply calls mouseMoveEvent() with the same argument.
[protected]
Current Hue.
[protected]
Current Saturation.
[protected]
Current Value.