Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

QwtSlider Class Reference

The Slider Widget. More...

#include <qwt_slider.h>

Inheritance diagram for QwtSlider:

QwtSliderBase QwtScaleIf QwtDblRange List of all members.

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=Horizontal, ScalePos=None, int bgStyle=BgTrough)
virtual void setOrientation (Qt::Orientation)
void setBgStyle (BGSTYLE st)
BGSTYLE bgStyle () const
void setScalePos (ScalePos st)
ScalePos scalePos () 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

Private Attributes

QRect d_sliderRect
int d_thumbLength
int d_thumbWidth
int d_borderWidth
int d_scaleDist
int d_xMargin
int d_yMargin
ScalePos d_scalePos
int d_bgStyle

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 27 of file qwt_slider.h.


Member Enumeration Documentation

enum QwtSlider::BGSTYLE
 

Background style

See also:
QwtSlider::QwtSlider
Enumeration values:
BgTrough 
BgSlot 
BgBoth 

Definition at line 51 of file qwt_slider.h.

enum QwtSlider::ScalePos
 

Position of the scale

See also:
QwtSlider::QwtSlider
Enumeration values:
None 
Left 
Right 
Top 
Bottom 

Definition at line 45 of file qwt_slider.h.


Constructor & Destructor Documentation

QwtSlider::QwtSlider QWidget *  parent,
const char *  name = 0,
Qt::Orientation  orient = Horizontal,
ScalePos  scalePos = None,
int  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.

Definition at line 31 of file qwt_slider.cpp.

References BgSlot, bgStyle(), QwtScaleDraw::Bottom, Bottom, d_bgStyle, d_borderWidth, d_scaleDist, QwtScaleIf::d_scaleDraw, d_scalePos, d_sliderRect, d_thumbLength, d_thumbWidth, d_xMargin, d_yMargin, QwtScaleDraw::Left, QwtSliderBase::orientation(), QwtScaleDraw::Orientation, QwtScaleDraw::Right, Right, QwtScaleDraw::setGeometry(), and QwtScaleDraw::Top.


Member Function Documentation

BGSTYLE QwtSlider::bgStyle  )  const [inline]
 

Definition at line 60 of file qwt_slider.h.

Referenced by QwtSlider().

int QwtSlider::borderWidth  )  const [inline]
 

Definition at line 67 of file qwt_slider.h.

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

redraw the slider

Definition at line 344 of file qwt_slider.cpp.

References QwtScaleIf::d_scaleDraw, d_scalePos, d_sliderRect, QwtScaleDraw::draw(), drawSlider(), and None.

Referenced by paintEvent().

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

Draw the slider into the specified rectangle.

Definition at line 158 of file qwt_slider.cpp.

References BgSlot, BgTrough, d_bgStyle, d_borderWidth, d_thumbLength, drawThumb(), 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 212 of file qwt_slider.cpp.

References d_borderWidth, d_thumbLength, and QwtSliderBase::orientation().

Referenced by drawSlider().

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

Notify change in font.

Definition at line 151 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 305 of file qwt_slider.cpp.

References QwtScaleIf::d_scaleDraw, d_sliderRect, d_thumbLength, QwtDiMap::i1(), QwtDiMap::i2(), QwtSliderBase::orientation(), QwtSliderBase::ScrMouse, QwtSliderBase::ScrNone, QwtSliderBase::ScrPage, 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 268 of file qwt_slider.cpp.

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

void QwtSlider::layoutSlider bool  update = TRUE  )  [protected]
 

Recalculate the slider's geometry and layout based on.

Definition at line 374 of file qwt_slider.cpp.

References BgTrough, QwtScaleDraw::Bottom, Bottom, d_bgStyle, d_borderWidth, d_scaleDist, QwtScaleIf::d_scaleDraw, d_scalePos, d_sliderRect, d_thumbLength, d_thumbWidth, d_xMargin, d_yMargin, QwtScaleDraw::Left, Left, QwtScaleDraw::minBorderDist(), None, QwtSliderBase::orientation(), QwtScaleDraw::Right, Right, QwtScaleDraw::setGeometry(), QwtDiMap::setIntRange(), QwtScaleDraw::Top, and Top.

Referenced by fontChange(), rangeChange(), resizeEvent(), scaleChange(), setBorderWidth(), setMargins(), setOrientation(), 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 559 of file qwt_slider.cpp.

References BgTrough, d_bgStyle, d_borderWidth, d_scaleDist, QwtScaleIf::d_scaleDraw, d_scalePos, d_thumbLength, d_thumbWidth, d_xMargin, d_yMargin, QwtScaleDraw::minBorderDist(), QwtScaleDraw::minHeight(), QwtScaleDraw::minWidth(), None, and QwtSliderBase::orientation().

Referenced by sizeHint().

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

Qt paint event.

Definition at line 333 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 494 of file qwt_slider.cpp.

References QwtScaleIf::d_maxMajor, QwtScaleIf::d_maxMinor, QwtScaleIf::d_scaleDraw, QwtScaleIf::hasUserScale(), layoutSlider(), QwtScaleDiv::logScale(), QwtDblRange::maxValue(), QwtDblRange::minValue(), QwtDblRange::rangeChange(), QwtScaleDraw::scaleDiv(), and QwtScaleDraw::setScale().

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

Qt resize event.

Definition at line 364 of file qwt_slider.cpp.

References layoutSlider().

void QwtSlider::scaleChange  )  [protected, virtual]
 

Notify changed scale.

Implements QwtScaleIf.

Definition at line 138 of file qwt_slider.cpp.

References QwtScaleIf::d_maxMajor, QwtScaleIf::d_maxMinor, QwtScaleIf::d_scaleDraw, QwtScaleIf::hasUserScale(), layoutSlider(), QwtScaleDiv::logScale(), QwtDblRange::maxValue(), QwtDblRange::minValue(), QwtScaleDraw::scaleDiv(), and QwtScaleDraw::setScale().

ScalePos QwtSlider::scalePos  )  const [inline]
 

Definition at line 63 of file qwt_slider.h.

void QwtSlider::setBgStyle BGSTYLE  st  )  [inline]
 

Definition at line 59 of file qwt_slider.h.

void QwtSlider::setBorderWidth int  bd  ) 
 

Change the slider's border width.

Parameters:
bd border width

Definition at line 92 of file qwt_slider.cpp.

References d_borderWidth, and 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 511 of file qwt_slider.cpp.

References d_xMargin, d_yMargin, and layoutSlider().

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

Set the orientation.

Parameters:
o Orientation. Allowed values are Qt::Horizontal and Qt::Vertical. Defaults to Qt::Horizontal.
See also:
QwtSliderBase::orientation()

Definition at line 82 of file qwt_slider.cpp.

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

void QwtSlider::setScalePos ScalePos  st  )  [inline]
 

Definition at line 62 of file qwt_slider.h.

void QwtSlider::setThumbLength int  thumbLength  ) 
 

Set the slider's thumb length.

Parameters:
thumbLength new length

Definition at line 108 of file qwt_slider.cpp.

References d_thumbLength, and layoutSlider().

void QwtSlider::setThumbWidth int  w  ) 
 

Change the width of the thumb.

Parameters:
w new width

Definition at line 124 of file qwt_slider.cpp.

References d_thumbWidth, and layoutSlider().

QSize QwtSlider::sizeHint  )  const [virtual]
 

Returns:
QwtSlider::minimumSizeHint()

Definition at line 549 of file qwt_slider.cpp.

References minimumSizeHint().

QSizePolicy QwtSlider::sizePolicy  )  const [virtual]
 

Returns:
Horizontal: MinimumExpanding/Fixed, Vertical: Fixed/MinimumExpanding

Definition at line 530 of file qwt_slider.cpp.

References QwtSliderBase::orientation().

int QwtSlider::thumbLength  )  const [inline]
 

Definition at line 65 of file qwt_slider.h.

int QwtSlider::thumbWidth  )  const [inline]
 

Definition at line 66 of file qwt_slider.h.

void QwtSlider::valueChange  )  [protected, virtual]
 

Notify change of value.

Reimplemented from QwtSliderBase.

Definition at line 486 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 240 of file qwt_slider.cpp.

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

Referenced by drawSlider(), and getScrollMode().


Member Data Documentation

int QwtSlider::d_bgStyle [private]
 

Definition at line 109 of file qwt_slider.h.

Referenced by drawSlider(), layoutSlider(), minimumSizeHint(), and QwtSlider().

int QwtSlider::d_borderWidth [private]
 

Definition at line 103 of file qwt_slider.h.

Referenced by drawSlider(), drawThumb(), layoutSlider(), minimumSizeHint(), QwtSlider(), and setBorderWidth().

int QwtSlider::d_scaleDist [private]
 

Definition at line 104 of file qwt_slider.h.

Referenced by layoutSlider(), minimumSizeHint(), and QwtSlider().

ScalePos QwtSlider::d_scalePos [private]
 

Definition at line 108 of file qwt_slider.h.

Referenced by draw(), layoutSlider(), minimumSizeHint(), and QwtSlider().

QRect QwtSlider::d_sliderRect [private]
 

Definition at line 99 of file qwt_slider.h.

Referenced by draw(), getScrollMode(), layoutSlider(), and QwtSlider().

int QwtSlider::d_thumbLength [private]
 

Definition at line 101 of file qwt_slider.h.

Referenced by drawSlider(), drawThumb(), getScrollMode(), layoutSlider(), minimumSizeHint(), QwtSlider(), and setThumbLength().

int QwtSlider::d_thumbWidth [private]
 

Definition at line 102 of file qwt_slider.h.

Referenced by layoutSlider(), minimumSizeHint(), QwtSlider(), and setThumbWidth().

int QwtSlider::d_xMargin [private]
 

Definition at line 105 of file qwt_slider.h.

Referenced by layoutSlider(), minimumSizeHint(), QwtSlider(), and setMargins().

int QwtSlider::d_yMargin [private]
 

Definition at line 106 of file qwt_slider.h.

Referenced by layoutSlider(), minimumSizeHint(), QwtSlider(), and setMargins().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 14:11:49 2003 for Qwt Developer's Guide by doxygen 1.3.2