QwtSlider(3)

NAME
QwtSlider -

SYNOPSIS

Inherits QwtSliderBase, and QwtScaleIf.

Detailed Description

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.

See also:
    QwtSliderBase and QwtScaleIf for the descriptions of the inherited members.

Definition at line 29 of file qwt_slider.h.

  Public Types
enum ScalePos { None, Left, Right, Top, Bottom }
enum BGSTYLE { BgTrough = 0x1, BgSlot = 0x2, BgBoth = BgTrough | BgSlot }

  Public Member Functions
QwtSlider (QWidget *parent, const char *name=0, Qt::Orientation=Qt::Horizontal, ScalePos=None, BGSTYLE bgStyle=BgTrough)
virtual void setOrientation (Qt::Orientation)
void setBgStyle (BGSTYLE st)
BGSTYLE bgStyle () const
void setScalePos (ScalePos s)
ScalePos scalePos () const
void setScalePosition (ScalePos s)
ScalePos scalePosition () const
int thumbLength () const
int thumbWidth () const
int borderWidth () const
void setThumbLength (int l)
void setThumbWidth (int w)
void setBorderWidth (int bw)
void setMargins (int x, int y)
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
virtual QSizePolicy sizePolicy () const

  Protected Member Functions
virtual double getValue (const QPoint &p)
virtual void getScrollMode (const QPoint &p, int &scrollMode, int &direction)
void draw (QPainter *p, const QRect &update_rect)
virtual void drawSlider (QPainter *p, const QRect &r)
virtual void drawThumb (QPainter *p, const QRect &, int pos)
virtual void resizeEvent (QResizeEvent *e)
virtual void paintEvent (QPaintEvent *e)
virtual void valueChange ()
virtual void rangeChange ()
virtual void scaleChange ()
virtual void fontChange (const QFont &oldFont)
void layoutSlider (bool update=TRUE)
int xyPosition (double v) const

Member Enumeration Documentation

  enum QwtSlider::BGSTYLE

Background style.

See also:
    QwtSlider::QwtSlider

Definition at line 57 of file qwt_slider.h.

  enum QwtSlider::ScalePos

Scale position. QwtSlider tries to enforce valid combinations of its orientation and scale position:

•   Qt::Horizonal combines with None, Top and Bottom

•   Qt::Vertical combines with None, Left and Right

See also:
    QwtSlider::QwtSlider

Definition at line 51 of file qwt_slider.h.

Referenced by scalePosition().

Constructor & Destructor Documentation

  QwtSlider::QwtSlider (QWidget * parent, const char * name = 0, Qt::Orientation orient = Qt::Horizontal, ScalePos scalePos = None, BGSTYLE bgStyle = BgTrough)

Constructor.

Parameters:
    parent parent widget
    name The Widget's name. Default = 0.
    orient Orientation of the slider. Can be Qt::Horizontal or Qt::Vertical. Defaults to Horizontal.
    scalePos Position of the scale. Can be QwtSlider::None, QwtSlider::Left, QwtSlider::Right, QwtSlider::Top, or QwtSlider::Bottom. Defaults to QwtSlider::None.
    bgStyle Background style. QwtSlider::BgTrough draws the slider button in a trough, QwtSlider::BgSlot draws a slot underneath the button. An or-combination of both may also be used. The default is QwtSlider::BgTrough.

QwtSlider enforces valid combinations of its orientation and scale position. If the combination is invalid, the scale position will be set to None. Valid combinations are:

•   Qt::Horizonal with None, Top, or Bottom;

•   Qt::Vertical with None, Left, or Right.

Definition at line 40 of file qwt_slider.cpp.

References QwtSliderBase::orientation(), QwtScaleIf::scaleDraw(), and QwtScaleDraw::setGeometry().

Member Function Documentation

  BGSTYLE QwtSlider::bgStyle () const

Returns:
    the background style.

Definition at line 72 of file qwt_slider.h.

  int QwtSlider::borderWidth () const

Returns:
    the border width.

Definition at line 97 of file qwt_slider.h.

  void QwtSlider::draw (QPainter * p, const QRect & update_rect) [protected]

Draw the QwtSlider.

Definition at line 402 of file qwt_slider.cpp.

References QwtScaleDraw::draw(), drawSlider(), and QwtScaleIf::scaleDraw().

Referenced by paintEvent().

  void QwtSlider::drawSlider (QPainter * p, const QRect & r) [protected, virtual]

Draw the slider into the specified rectangle.

Definition at line 215 of file qwt_slider.cpp.

References drawThumb(), QwtSliderBase::isValid(), QwtSliderBase::orientation(), QwtDblRange::value(), and xyPosition().

Referenced by draw().

  void QwtSlider::drawThumb (QPainter * p, const QRect &, int pos) [protected, virtual]

Draw the thumb at a position.

Definition at line 270 of file qwt_slider.cpp.

References QwtSliderBase::orientation().

Referenced by drawSlider().

  void QwtSlider::fontChange (const QFont & oldFont) [protected, virtual]

Notify change in font.

Definition at line 208 of file qwt_slider.cpp.

References layoutSlider().

  void QwtSlider::getScrollMode (const QPoint & p, int & scrollMode, int & direction) [protected, virtual]

Determine scrolling mode and direction.

Parameters:
    p point
    scrollMode Scrolling mode
    direction Direction

Implements QwtSliderBase.

Definition at line 363 of file qwt_slider.cpp.

References QwtDiMap::i1(), QwtDiMap::i2(), QwtSliderBase::orientation(), QwtScaleIf::scaleDraw(), QwtDblRange::value(), and xyPosition().

  double QwtSlider::getValue (const QPoint & p) [protected, virtual]

Determine the value corresponding to a specified mouse location.

Implements QwtSliderBase.

Definition at line 326 of file qwt_slider.cpp.

References QwtDiMap::d1(), QwtDiMap::d2(), QwtDiMap::i1(), QwtDiMap::i2(), QwtDiMap::invTransform(), QwtDblRange::maxValue(), QwtDblRange::minValue(), QwtSliderBase::orientation(), and QwtScaleIf::scaleDraw().

  void QwtSlider::layoutSlider (bool update_geometry = TRUE) [protected]

Recalculate the slider's geometry and layout based on the current rect and fonts.

Parameters:
    update_geometry notify the layout system and call update to redraw the scale

Definition at line 433 of file qwt_slider.cpp.

References QwtScaleDraw::minBorderDist(), QwtSliderBase::orientation(), QwtScaleIf::scaleDraw(), QwtScaleDraw::setGeometry(), and QwtDiMap::setIntRange().

Referenced by fontChange(), rangeChange(), resizeEvent(), scaleChange(), setBorderWidth(), setMargins(), setOrientation(), setScalePosition(), setThumbLength(), and setThumbWidth().

  QSize QwtSlider::minimumSizeHint () const [virtual]

Return a minimum size hint.

Warning:
    The return value of QwtSlider::minimumSizeHint() depends on the font and the scale.

Definition at line 632 of file qwt_slider.cpp.

References QwtScaleDraw::minBorderDist(), QwtScaleDraw::minHeight(), QwtScaleDraw::minWidth(), QwtSliderBase::orientation(), and QwtScaleIf::scaleDraw().

Referenced by sizeHint().

  void QwtSlider::paintEvent (QPaintEvent * e) [protected, virtual]

Qt paint event.

Definition at line 391 of file qwt_slider.cpp.

References draw(), and QwtPaintBuffer::painter().

  void QwtSlider::rangeChange () [protected, virtual]

Notify change of range.

Reimplemented from QwtDblRange.

Definition at line 566 of file qwt_slider.cpp.

References QwtScaleIf::hasUserScale(), layoutSlider(), QwtDblRange::maxValue(), QwtDblRange::minValue(), QwtDblRange::rangeChange(), QwtScaleIf::scaleDraw(), QwtScaleIf::scaleMaxMajor(), QwtScaleIf::scaleMaxMinor(), and QwtScaleDraw::setScale().

  void QwtSlider::resizeEvent (QResizeEvent * e) [protected, virtual]

Qt resize event.

Definition at line 422 of file qwt_slider.cpp.

References layoutSlider().

  void QwtSlider::scaleChange () [protected, virtual]

Notify changed scale.

Implements QwtScaleIf.

Definition at line 194 of file qwt_slider.cpp.

References QwtScaleIf::hasUserScale(), layoutSlider(), QwtDblRange::maxValue(), QwtDblRange::minValue(), QwtScaleIf::scaleDraw(), QwtScaleIf::scaleMaxMajor(), QwtScaleIf::scaleMaxMinor(), and QwtScaleDraw::setScale().

  ScalePos QwtSlider::scalePos () const

Deprecated. Use QwtSlider::scalePosition. Definition at line 81 of file qwt_slider.h.

  QwtSlider::ScalePos QwtSlider::scalePosition () const

Return the scale position.

Definition at line 139 of file qwt_slider.cpp.

References ScalePos.

  void QwtSlider::setBgStyle (BGSTYLE st)

Set the background style. Definition at line 68 of file qwt_slider.h.

  void QwtSlider::setBorderWidth (int bd)

Change the slider's border width.

Parameters:
    bd border width

Definition at line 148 of file qwt_slider.cpp.

References layoutSlider().

  void QwtSlider::setMargins (int xMargin, int yMargin)

Set distances between the widget's border and internals.

Parameters:
    xMargin Horizontal margin
    yMargin Vertical margin

Definition at line 584 of file qwt_slider.cpp.

References layoutSlider().

  void QwtSlider::setOrientation (Qt::Orientation o) [virtual]

Set the orientation.

Parameters:
    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 None.

See also:
    QwtSliderBase::orientation()

Definition at line 99 of file qwt_slider.cpp.

References layoutSlider(), and QwtSliderBase::setOrientation().

Referenced by setScalePosition().

  void QwtSlider::setScalePos (ScalePos s)

Deprecated. Use QwtSlider::setScalePosition. Definition at line 77 of file qwt_slider.h.

  void QwtSlider::setScalePosition (ScalePos s)

Change the scale position (and slider orientation).

Parameters:
    s Position of the scale.

A valid combination of scale position and orientation is enforced:

•   if the new scale position is Left or Right, the scale orientation will become Qt::Vertical;

•   if the new scale position is Bottom or Top the scale orientation will become Qt::Horizontal;

•   if the new scale position is None, the scale orientation will not change.

Definition at line 127 of file qwt_slider.cpp.

References layoutSlider(), and setOrientation().

  void QwtSlider::setThumbLength (int thumbLength)

Set the slider's thumb length.

Parameters:
    thumbLength new length

Definition at line 164 of file qwt_slider.cpp.

References layoutSlider().

  void QwtSlider::setThumbWidth (int w)

Change the width of the thumb.

Parameters:
    w new width

Definition at line 180 of file qwt_slider.cpp.

References layoutSlider().

  QSize QwtSlider::sizeHint () const [virtual]

Returns:
    QwtSlider::minimumSizeHint()

Definition at line 622 of file qwt_slider.cpp.

References minimumSizeHint().

  QSizePolicy QwtSlider::sizePolicy () const [virtual]

Returns:
    MinimumExpanding/Fixed for a horizontal orientation; Fixed/MinimumExpanding for a vertical orientation.

Definition at line 603 of file qwt_slider.cpp.

References QwtSliderBase::orientation().

  int QwtSlider::thumbLength () const

Returns:
    the thumb length.

Definition at line 89 of file qwt_slider.h.

  int QwtSlider::thumbWidth () const

Returns:
    the thumb width.

Definition at line 93 of file qwt_slider.h.

  void QwtSlider::valueChange () [protected, virtual]

Notify change of value.

Reimplemented from QwtSliderBase.

Definition at line 558 of file qwt_slider.cpp.

References QwtSliderBase::valueChange().

  int QwtSlider::xyPosition (double v) const [protected]

Find the x/y position for a given value v.

Definition at line 298 of file qwt_slider.cpp.

References QwtDiMap::d1(), QwtDiMap::d2(), QwtDiMap::i1(), QwtDiMap::i2(), QwtDblRange::maxValue(), QwtDblRange::minValue(), QwtSliderBase::orientation(), QwtScaleIf::scaleDraw(), and QwtDiMap::transform().

Referenced by drawSlider(), and getScrollMode().

Author

Generated automatically by Doxygen for Qwt User's Guide from the source code.