Qwt User's Guide 6.0.0
|
The Slider Widget. More...
#include <qwt_slider.h>
Public Types | |
enum | ScalePos { NoScale, LeftScale, RightScale, TopScale, BottomScale } |
enum | BackgroundStyle { Trough = 0x01, Groove = 0x02 } |
typedef QFlags< BackgroundStyle > | BackgroundStyles |
Public Member Functions | |
QwtSlider (QWidget *parent, Qt::Orientation=Qt::Horizontal, ScalePos=NoScale, BackgroundStyles=Trough) | |
virtual void | setOrientation (Qt::Orientation) |
void | setBackgroundStyle (BackgroundStyles) |
BackgroundStyles | backgroundStyle () const |
void | setScalePosition (ScalePos s) |
ScalePos | scalePosition () const |
void | setHandleSize (int width, int height) |
void | setHandleSize (const QSize &) |
QSize | handleSize () const |
void | setBorderWidth (int bw) |
int | borderWidth () const |
void | setSpacing (int) |
int | spacing () const |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
void | setScaleDraw (QwtScaleDraw *) |
const QwtScaleDraw * | scaleDraw () const |
Protected Member Functions | |
virtual double | getValue (const QPoint &p) |
virtual void | getScrollMode (const QPoint &p, QwtAbstractSlider::ScrollMode &, int &direction) const |
virtual void | drawSlider (QPainter *, const QRect &) const |
virtual void | drawHandle (QPainter *, const QRect &, int pos) const |
virtual void | resizeEvent (QResizeEvent *) |
virtual void | paintEvent (QPaintEvent *) |
virtual void | changeEvent (QEvent *) |
virtual void | valueChange () |
virtual void | rangeChange () |
virtual void | scaleChange () |
int | transform (double v) const |
QwtScaleDraw * | scaleDraw () |
The Slider Widget.
QwtSlider is a slider widget which operates on an interval of type double. QwtSlider supports different layouts as well as a scale.
typedef QFlags<BackgroundStyle> QwtSlider::BackgroundStyles |
Background styles.
enum QwtSlider::ScalePos |
Scale position. QwtSlider tries to enforce valid combinations of its orientation and scale position:
QwtSlider::QwtSlider | ( | QWidget * | parent, |
Qt::Orientation | orientation = Qt::Horizontal , |
||
ScalePos | scalePos = NoScale , |
||
BackgroundStyles | bgStyle = Trough |
||
) | [explicit] |
Constructor.
parent | parent widget |
orientation | Orientation of the slider. Can be Qt::Horizontal or Qt::Vertical. Defaults to Qt::Horizontal. |
scalePos | Position of the scale. Defaults to QwtSlider::NoScale. |
bgStyle | Background style. QwtSlider::Trough draws the slider button in a trough, QwtSlider::Slot draws a slot underneath the button. An or-combination of both may also be used. The default is QwtSlider::Trough. |
QwtSlider enforces valid combinations of its orientation and scale position. If the combination is invalid, the scale position will be set to NoScale. Valid combinations are:
QwtSlider::BackgroundStyles QwtSlider::backgroundStyle | ( | ) | const |
int QwtSlider::borderWidth | ( | ) | const |
void QwtSlider::changeEvent | ( | QEvent * | event | ) | [protected, virtual] |
Qt change event handler.
void QwtSlider::drawHandle | ( | QPainter * | painter, |
const QRect & | sliderRect, | ||
int | pos | ||
) | const [protected, virtual] |
Draw the thumb at a position
painter | Painter |
sliderRect | Bounding rectangle of the slider |
pos | Position of the slider thumb |
void QwtSlider::drawSlider | ( | QPainter * | painter, |
const QRect & | sliderRect | ||
) | const [protected, virtual] |
Draw the slider into the specified rectangle.
painter | Painter |
sliderRect | Bounding rectangle of the slider |
void QwtSlider::getScrollMode | ( | const QPoint & | p, |
QwtAbstractSlider::ScrollMode & | scrollMode, | ||
int & | direction | ||
) | const [protected, virtual] |
Determine scrolling mode and direction.
p | point |
scrollMode | Scrolling mode |
direction | Direction |
Implements QwtAbstractSlider.
double QwtSlider::getValue | ( | const QPoint & | pos | ) | [protected, virtual] |
Determine the value corresponding to a specified mouse location.
pos | Mouse position |
Implements QwtAbstractSlider.
QSize QwtSlider::handleSize | ( | ) | const |
QSize QwtSlider::minimumSizeHint | ( | ) | const [virtual] |
Return a minimum size hint.
void QwtSlider::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
Qt paint event
event | Paint event |
void QwtSlider::rangeChange | ( | ) | [protected, virtual] |
Notify change of range.
Reimplemented from QwtDoubleRange.
void QwtSlider::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Qt resize event.
void QwtSlider::scaleChange | ( | ) | [protected, virtual] |
Notify changed scale.
Reimplemented from QwtAbstractScale.
const QwtScaleDraw * QwtSlider::scaleDraw | ( | ) | const |
QwtScaleDraw * QwtSlider::scaleDraw | ( | ) | [protected] |
QwtSlider::ScalePos QwtSlider::scalePosition | ( | ) | const |
Return the scale position.
void QwtSlider::setBackgroundStyle | ( | BackgroundStyles | style | ) |
Set the background style.
void QwtSlider::setBorderWidth | ( | int | width | ) |
Change the slider's border width.
width | Border width |
void QwtSlider::setHandleSize | ( | const QSize & | size | ) |
void QwtSlider::setHandleSize | ( | int | width, |
int | height | ||
) |
void QwtSlider::setOrientation | ( | Qt::Orientation | o | ) | [virtual] |
Set the orientation.
o | Orientation. Allowed values are Qt::Horizontal and Qt::Vertical. |
If the new orientation and the old scale position are an invalid combination, the scale position will be set to QwtSlider::NoScale.
Reimplemented from QwtAbstractSlider.
void QwtSlider::setScaleDraw | ( | QwtScaleDraw * | scaleDraw | ) |
Set a scale draw.
For changing the labels of the scales, it is necessary to derive from QwtScaleDraw and overload QwtScaleDraw::label().
scaleDraw | ScaleDraw object, that has to be created with new and will be deleted in ~QwtSlider or the next call of setScaleDraw(). |
void QwtSlider::setScalePosition | ( | ScalePos | scalePos | ) |
Change the scale position (and slider orientation).
scalePos | Position of the scale. |
A valid combination of scale position and orientation is enforced:
void QwtSlider::setSpacing | ( | int | spacing | ) |
Change the spacing between pipe and scale.
A spacing of 0 means, that the backbone of the scale is below the trough.
The default setting is 4 pixels.
spacing | Number of pixels |
QSize QwtSlider::sizeHint | ( | ) | const [virtual] |
int QwtSlider::spacing | ( | ) | const |
int QwtSlider::transform | ( | double | value | ) | const [protected] |
Map and round a value into widget coordinates
value | Value |
void QwtSlider::valueChange | ( | ) | [protected, virtual] |
Notify change of value.
Reimplemented from QwtAbstractSlider.