The Slider Widget. More...
#include <qwt_slider.h>
Classes | |
class | PrivateData |
Public Types | |
enum | ScalePos { NoScale, LeftScale, RightScale, TopScale, BottomScale } |
enum | BGSTYLE { BgTrough = 0x1, BgSlot = 0x2, BgBoth = BgTrough | BgSlot } |
Public Member Functions | |
QwtSlider (QWidget *parent, Qt::Orientation=Qt::Horizontal, ScalePos=NoScale, BGSTYLE bgStyle=BgTrough) | |
Constructor. | |
QwtSlider (QWidget *parent, const char *name) | |
Constructor. | |
virtual | ~QwtSlider () |
virtual void | setOrientation (Qt::Orientation) |
Set the orientation. | |
void | setBgStyle (BGSTYLE) |
BGSTYLE | bgStyle () const |
void | setScalePosition (ScalePos s) |
Change the scale position (and slider orientation). | |
ScalePos | scalePosition () const |
int | thumbLength () const |
int | thumbWidth () const |
int | borderWidth () const |
void | setThumbLength (int l) |
Set the slider's thumb length. | |
void | setThumbWidth (int w) |
Change the width of the thumb. | |
void | setBorderWidth (int bw) |
Change the slider's border width. | |
void | setMargins (int x, int y) |
Set distances between the widget's border and internals. | |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
Return a minimum size hint. | |
void | setScaleDraw (QwtScaleDraw *) |
Set a scale draw. | |
const QwtScaleDraw * | scaleDraw () const |
Protected Member Functions | |
virtual double | getValue (const QPoint &p) |
virtual void | getScrollMode (const QPoint &p, int &scrollMode, int &direction) |
Determine scrolling mode and direction. | |
void | draw (QPainter *p, const QRect &update_rect) |
Draw the QwtSlider. | |
virtual void | drawSlider (QPainter *p, const QRect &r) |
virtual void | drawThumb (QPainter *p, const QRect &, int pos) |
virtual void | resizeEvent (QResizeEvent *e) |
Qt resize event. | |
virtual void | paintEvent (QPaintEvent *e) |
virtual void | valueChange () |
Notify change of value. | |
virtual void | rangeChange () |
Notify change of range. | |
virtual void | scaleChange () |
Notify changed scale. | |
virtual void | fontChange (const QFont &oldFont) |
Notify change in font. | |
void | layoutSlider (bool update=true) |
int | xyPosition (double v) const |
QwtScaleDraw * | scaleDraw () |
Properties | |
ScalePos | scalePosition |
Return the scale position. | |
BGSTYLE | bgStyle |
int | thumbLength |
int | thumbWidth |
int | borderWidth |
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.
Definition at line 34 of file qwt_slider.h.
enum QwtSlider::BGSTYLE |
enum QwtSlider::ScalePos |
Scale position. QwtSlider tries to enforce valid combinations of its orientation and scale position:
Definition at line 56 of file qwt_slider.h.
{ NoScale, LeftScale, RightScale, TopScale, BottomScale };
QwtSlider::QwtSlider | ( | QWidget * | parent, |
Qt::Orientation | orientation = Qt::Horizontal , |
||
ScalePos | scalePos = NoScale , |
||
BGSTYLE | bgStyle = BgTrough |
||
) | [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::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 NoScale. Valid combinations are:
Definition at line 64 of file qwt_slider.cpp.
: QwtAbstractSlider(orientation, parent) { initSlider(orientation, scalePos, bgStyle); }
QwtSlider::QwtSlider | ( | QWidget * | parent, |
const char * | name | ||
) | [explicit] |
Constructor.
Build a horizontal slider with no scale and BgTrough as background style
parent | parent widget |
name | Object name |
Definition at line 81 of file qwt_slider.cpp.
References BgTrough, and NoScale.
: QwtAbstractSlider(Qt::Horizontal, parent) { setName(name); initSlider(Qt::Horizontal, NoScale, BgTrough); }
QwtSlider::~QwtSlider | ( | ) | [virtual] |
Definition at line 161 of file qwt_slider.cpp.
{
delete d_data;
}
BGSTYLE QwtSlider::bgStyle | ( | ) | const |
int QwtSlider::borderWidth | ( | ) | const |
void QwtSlider::draw | ( | QPainter * | p, |
const QRect & | update_rect | ||
) | [protected] |
Draw the QwtSlider.
Definition at line 594 of file qwt_slider.cpp.
References QwtAbstractScaleDraw::draw(), QwtPainter::drawFocusRect(), drawSlider(), NoScale, scaleDraw(), QwtSlider::PrivateData::scalePos, and QwtSlider::PrivateData::sliderRect.
Referenced by paintEvent().
{ if (d_data->scalePos != NoScale) { #if QT_VERSION < 0x040000 scaleDraw()->draw(painter, colorGroup()); #else scaleDraw()->draw(painter, palette()); #endif } drawSlider(painter, d_data->sliderRect); if ( hasFocus() ) QwtPainter::drawFocusRect(painter, this, d_data->sliderRect); }
void QwtSlider::drawSlider | ( | QPainter * | painter, |
const QRect & | r | ||
) | [protected, virtual] |
Draw the slider into the specified rectangle.
painter | Painter |
r | Rectangle |
Definition at line 382 of file qwt_slider.cpp.
References BgSlot, QwtSlider::PrivateData::bgStyle, BgTrough, QwtSlider::PrivateData::borderWidth, drawThumb(), QwtAbstractSlider::isValid(), QwtAbstractSlider::orientation(), QwtSlider::PrivateData::thumbLength, QwtDoubleRange::value(), and xyPosition().
Referenced by draw().
{ QRect cr(r); if (d_data->bgStyle & BgTrough) { qDrawShadePanel(painter, r.x(), r.y(), r.width(), r.height(), #if QT_VERSION < 0x040000 colorGroup(), #else palette(), #endif true, d_data->borderWidth,0); cr.setRect(r.x() + d_data->borderWidth, r.y() + d_data->borderWidth, r.width() - 2 * d_data->borderWidth, r.height() - 2 * d_data->borderWidth); painter->fillRect(cr.x(), cr.y(), cr.width(), cr.height(), #if QT_VERSION < 0x040000 colorGroup().brush(QColorGroup::Mid) #else palette().brush(QPalette::Mid) #endif ); } if ( d_data->bgStyle & BgSlot) { int ws = 4; int ds = d_data->thumbLength / 2 - 4; if ( ds < 1 ) ds = 1; QRect rSlot; if (orientation() == Qt::Horizontal) { if ( cr.height() & 1 ) ws++; rSlot = QRect(cr.x() + ds, cr.y() + (cr.height() - ws) / 2, cr.width() - 2 * ds, ws); } else { if ( cr.width() & 1 ) ws++; rSlot = QRect(cr.x() + (cr.width() - ws) / 2, cr.y() + ds, ws, cr.height() - 2 * ds); } painter->fillRect(rSlot.x(), rSlot.y(), rSlot.width(), rSlot.height(), #if QT_VERSION < 0x040000 colorGroup().brush(QColorGroup::Dark) #else palette().brush(QPalette::Dark) #endif ); qDrawShadePanel(painter, rSlot.x(), rSlot.y(), rSlot.width(), rSlot.height(), #if QT_VERSION < 0x040000 colorGroup(), #else palette(), #endif true, 1 ,0); } if ( isValid() ) drawThumb(painter, cr, xyPosition(value())); }
void QwtSlider::drawThumb | ( | QPainter * | painter, |
const QRect & | sliderRect, | ||
int | pos | ||
) | [protected, virtual] |
Draw the thumb at a position
painter | Painter |
sliderRect | Bounding rectangle of the slider |
pos | Position of the slider thumb |
Definition at line 464 of file qwt_slider.cpp.
References QwtSlider::PrivateData::borderWidth, QwtAbstractSlider::orientation(), and QwtSlider::PrivateData::thumbLength.
Referenced by drawSlider().
{ pos++; // shade line points one pixel below if (orientation() == Qt::Horizontal) { qDrawShadePanel(painter, pos - d_data->thumbLength / 2, sliderRect.y(), d_data->thumbLength, sliderRect.height(), #if QT_VERSION < 0x040000 colorGroup(), #else palette(), #endif false, d_data->borderWidth, #if QT_VERSION < 0x040000 &colorGroup().brush(QColorGroup::Button) #else &palette().brush(QPalette::Button) #endif ); qDrawShadeLine(painter, pos, sliderRect.y(), pos, sliderRect.y() + sliderRect.height() - 2, #if QT_VERSION < 0x040000 colorGroup(), #else palette(), #endif true, 1); } else // Vertical { qDrawShadePanel(painter, sliderRect.x(), pos - d_data->thumbLength / 2, sliderRect.width(), d_data->thumbLength, #if QT_VERSION < 0x040000 colorGroup(), #else palette(), #endif false, d_data->borderWidth, #if QT_VERSION < 0x040000 &colorGroup().brush(QColorGroup::Button) #else &palette().brush(QPalette::Button) #endif ); qDrawShadeLine(painter, sliderRect.x(), pos, sliderRect.x() + sliderRect.width() - 2, pos, #if QT_VERSION < 0x040000 colorGroup(), #else palette(), #endif true, 1); } }
void QwtSlider::fontChange | ( | const QFont & | oldFont ) | [protected, virtual] |
Notify change in font.
Definition at line 370 of file qwt_slider.cpp.
References layoutSlider().
{ QwtAbstractSlider::fontChange( f ); layoutSlider(); }
void QwtSlider::getScrollMode | ( | const QPoint & | p, |
int & | scrollMode, | ||
int & | direction | ||
) | [protected, virtual] |
Determine scrolling mode and direction.
p | point |
scrollMode | Scrolling mode |
direction | Direction |
Implements QwtAbstractSlider.
Definition at line 546 of file qwt_slider.cpp.
References QwtAbstractScaleDraw::map(), QwtAbstractSlider::orientation(), QwtScaleMap::p1(), QwtScaleMap::p2(), scaleDraw(), QwtAbstractSlider::ScrMouse, QwtAbstractSlider::ScrNone, QwtAbstractSlider::ScrPage, QwtSlider::PrivateData::sliderRect, thumbLength(), QwtSlider::PrivateData::thumbLength, QwtDoubleRange::value(), and xyPosition().
{ if (!d_data->sliderRect.contains(p)) { scrollMode = ScrNone; direction = 0; return; } const int pos = ( orientation() == Qt::Horizontal ) ? p.x() : p.y(); const int markerPos = xyPosition(value()); if ((pos > markerPos - d_data->thumbLength / 2) && (pos < markerPos + d_data->thumbLength / 2)) { scrollMode = ScrMouse; direction = 0; return; } scrollMode = ScrPage; direction = (pos > markerPos) ? 1 : -1; if ( scaleDraw()->map().p1() > scaleDraw()->map().p2() ) direction = -direction; }
double QwtSlider::getValue | ( | const QPoint & | pos ) | [protected, virtual] |
Determine the value corresponding to a specified mouse location.
pos | Mouse position |
Implements QwtAbstractSlider.
Definition at line 534 of file qwt_slider.cpp.
References QwtScaleMap::invTransform(), QwtSlider::PrivateData::map, and QwtAbstractSlider::orientation().
{ return d_data->map.invTransform( orientation() == Qt::Horizontal ? pos.x() : pos.y()); }
void QwtSlider::layoutSlider | ( | bool | update_geometry = true ) |
[protected] |
Recalculate the slider's geometry and layout based on the current rect and fonts.
update_geometry | notify the layout system and call update to redraw the scale |
Definition at line 623 of file qwt_slider.cpp.
References QwtSlider::PrivateData::bgStyle, BgTrough, QwtSlider::PrivateData::borderWidth, BottomScale, QwtScaleDraw::getBorderDistHint(), LeftScale, QwtSlider::PrivateData::map, QwtScaleDraw::move(), NoScale, QwtAbstractSlider::orientation(), qwtMax, RightScale, QwtSlider::PrivateData::scaleDist, scaleDraw(), QwtSlider::PrivateData::scalePos, QwtScaleDraw::setLength(), QwtScaleMap::setPaintXInterval(), QwtSlider::PrivateData::sizeHintCache, QwtSlider::PrivateData::sliderRect, QwtSlider::PrivateData::thumbLength, QwtSlider::PrivateData::thumbWidth, TopScale, QwtSlider::PrivateData::xMargin, and QwtSlider::PrivateData::yMargin.
Referenced by fontChange(), rangeChange(), resizeEvent(), scaleChange(), setBgStyle(), setBorderWidth(), setMargins(), setOrientation(), setScaleDraw(), setScalePosition(), setThumbLength(), and setThumbWidth().
{ int sliderWidth = d_data->thumbWidth; int sld1 = d_data->thumbLength / 2 - 1; int sld2 = d_data->thumbLength / 2 + d_data->thumbLength % 2; if ( d_data->bgStyle & BgTrough ) { sliderWidth += 2 * d_data->borderWidth; sld1 += d_data->borderWidth; sld2 += d_data->borderWidth; } int scd = 0; if ( d_data->scalePos != NoScale ) { int d1, d2; scaleDraw()->getBorderDistHint(font(), d1, d2); scd = qwtMax(d1, d2); } int slo = scd - sld1; if ( slo < 0 ) slo = 0; int x, y, length; const QRect r = rect(); if (orientation() == Qt::Horizontal) { switch (d_data->scalePos) { case TopScale: { d_data->sliderRect.setRect( r.x() + d_data->xMargin + slo, r.y() + r.height() - d_data->yMargin - sliderWidth, r.width() - 2 * d_data->xMargin - 2 * slo, sliderWidth); x = d_data->sliderRect.x() + sld1; y = d_data->sliderRect.y() - d_data->scaleDist; break; } case BottomScale: { d_data->sliderRect.setRect( r.x() + d_data->xMargin + slo, r.y() + d_data->yMargin, r.width() - 2 * d_data->xMargin - 2 * slo, sliderWidth); x = d_data->sliderRect.x() + sld1; y = d_data->sliderRect.y() + d_data->sliderRect.height() + d_data->scaleDist; break; } case NoScale: // like Bottom, but no scale. See QwtSlider(). default: // inconsistent orientation and scale position { d_data->sliderRect.setRect( r.x() + d_data->xMargin + slo, r.y() + d_data->yMargin, r.width() - 2 * d_data->xMargin - 2 * slo, sliderWidth); x = d_data->sliderRect.x() + sld1; y = 0; break; } } length = d_data->sliderRect.width() - (sld1 + sld2); } else // if (orientation() == Qt::Vertical { switch (d_data->scalePos) { case RightScale: d_data->sliderRect.setRect( r.x() + d_data->xMargin, r.y() + d_data->yMargin + slo, sliderWidth, r.height() - 2 * d_data->yMargin - 2 * slo); x = d_data->sliderRect.x() + d_data->sliderRect.width() + d_data->scaleDist; y = d_data->sliderRect.y() + sld1; break; case LeftScale: d_data->sliderRect.setRect( r.x() + r.width() - sliderWidth - d_data->xMargin, r.y() + d_data->yMargin + slo, sliderWidth, r.height() - 2 * d_data->yMargin - 2 * slo); x = d_data->sliderRect.x() - d_data->scaleDist; y = d_data->sliderRect.y() + sld1; break; case NoScale: // like Left, but no scale. See QwtSlider(). default: // inconsistent orientation and scale position d_data->sliderRect.setRect( r.x() + r.width() - sliderWidth - d_data->xMargin, r.y() + d_data->yMargin + slo, sliderWidth, r.height() - 2 * d_data->yMargin - 2 * slo); x = 0; y = d_data->sliderRect.y() + sld1; break; } length = d_data->sliderRect.height() - (sld1 + sld2); } scaleDraw()->move(x, y); scaleDraw()->setLength(length); d_data->map.setPaintXInterval(scaleDraw()->map().p1(), scaleDraw()->map().p2()); if ( update_geometry ) { d_data->sizeHintCache = QSize(); // invalidate updateGeometry(); update(); } }
QSize QwtSlider::minimumSizeHint | ( | ) | const [virtual] |
Return a minimum size hint.
Definition at line 854 of file qwt_slider.cpp.
References QwtSlider::PrivateData::bgStyle, BgTrough, QwtSlider::PrivateData::borderWidth, QwtScaleDraw::extent(), QwtScaleDraw::getBorderDistHint(), QwtScaleDraw::minLength(), NoScale, QwtAbstractSlider::orientation(), qwtMax, QwtSlider::PrivateData::scaleDist, scaleDraw(), QwtSlider::PrivateData::scalePos, QwtSlider::PrivateData::sizeHintCache, QwtSlider::PrivateData::thumbLength, QwtSlider::PrivateData::thumbWidth, QwtSlider::PrivateData::xMargin, and QwtSlider::PrivateData::yMargin.
Referenced by sizeHint().
{ if (!d_data->sizeHintCache.isEmpty()) return d_data->sizeHintCache; int sliderWidth = d_data->thumbWidth; if (d_data->bgStyle & BgTrough) sliderWidth += 2 * d_data->borderWidth; int w = 0, h = 0; if (d_data->scalePos != NoScale) { int d1, d2; scaleDraw()->getBorderDistHint(font(), d1, d2); int msMbd = qwtMax(d1, d2); int mbd = d_data->thumbLength / 2; if (d_data->bgStyle & BgTrough) mbd += d_data->borderWidth; if ( mbd < msMbd ) mbd = msMbd; const int sdExtent = scaleDraw()->extent( QPen(), font() ); const int sdLength = scaleDraw()->minLength( QPen(), font() ); h = sliderWidth + sdExtent + d_data->scaleDist; w = sdLength - 2 * msMbd + 2 * mbd; } else // no scale { w = 200; h = sliderWidth; } if ( orientation() == Qt::Vertical ) qSwap(w, h); w += 2 * d_data->xMargin; h += 2 * d_data->yMargin; d_data->sizeHintCache = QSize(w, h); return d_data->sizeHintCache; }
void QwtSlider::paintEvent | ( | QPaintEvent * | event ) | [protected, virtual] |
Qt paint event
event | Paint event |
Definition at line 578 of file qwt_slider.cpp.
References draw(), and QwtPaintBuffer::painter().
{ const QRect &ur = event->rect(); if ( ur.isValid() ) { #if QT_VERSION < 0x040000 QwtPaintBuffer paintBuffer(this, ur); draw(paintBuffer.painter(), ur); #else QPainter painter(this); draw(&painter, ur); #endif } }
void QwtSlider::rangeChange | ( | ) | [protected, virtual] |
Notify change of range.
Reimplemented from QwtDoubleRange.
Definition at line 769 of file qwt_slider.cpp.
References QwtAbstractScale::autoScale(), layoutSlider(), QwtSlider::PrivateData::map, QwtDoubleRange::maxValue(), QwtDoubleRange::minValue(), QwtAbstractScale::rescale(), and QwtScaleMap::setScaleInterval().
{ d_data->map.setScaleInterval(minValue(), maxValue()); if (autoScale()) rescale(minValue(), maxValue()); QwtAbstractSlider::rangeChange(); layoutSlider(); }
void QwtSlider::resizeEvent | ( | QResizeEvent * | e ) | [protected, virtual] |
Qt resize event.
Definition at line 612 of file qwt_slider.cpp.
References layoutSlider().
{ layoutSlider( false ); }
void QwtSlider::scaleChange | ( | ) | [protected, virtual] |
Notify changed scale.
Reimplemented from QwtAbstractScale.
Definition at line 363 of file qwt_slider.cpp.
References layoutSlider().
{ layoutSlider(); }
const QwtScaleDraw * QwtSlider::scaleDraw | ( | ) | const |
Definition at line 348 of file qwt_slider.cpp.
References QwtAbstractScale::abstractScaleDraw().
Referenced by draw(), getScrollMode(), layoutSlider(), minimumSizeHint(), setScaleDraw(), and setScalePosition().
{ return (QwtScaleDraw *)abstractScaleDraw(); }
QwtScaleDraw * QwtSlider::scaleDraw | ( | ) | [protected] |
Definition at line 357 of file qwt_slider.cpp.
References QwtAbstractScale::abstractScaleDraw().
{ return (QwtScaleDraw *)abstractScaleDraw(); }
ScalePos QwtSlider::scalePosition | ( | ) | const |
void QwtSlider::setBgStyle | ( | BGSTYLE | st ) |
Set the background style.
Definition at line 803 of file qwt_slider.cpp.
References QwtSlider::PrivateData::bgStyle, and layoutSlider().
{ d_data->bgStyle = st; layoutSlider(); }
void QwtSlider::setBorderWidth | ( | int | bd ) |
Change the slider's border width.
bd | border width |
Definition at line 276 of file qwt_slider.cpp.
References QwtSlider::PrivateData::borderWidth, and layoutSlider().
{ if ( bd < 0 ) bd = 0; if ( bd != d_data->borderWidth ) { d_data->borderWidth = bd; layoutSlider(); } }
void QwtSlider::setMargins | ( | int | xMargin, |
int | yMargin | ||
) |
Set distances between the widget's border and internals.
xMargin | Horizontal margin |
yMargin | Vertical margin |
Definition at line 785 of file qwt_slider.cpp.
References layoutSlider(), QwtSlider::PrivateData::xMargin, and QwtSlider::PrivateData::yMargin.
{ if ( xMargin < 0 ) xMargin = 0; if ( yMargin < 0 ) yMargin = 0; if ( xMargin != d_data->xMargin || yMargin != d_data->yMargin ) { d_data->xMargin = xMargin; d_data->yMargin = yMargin; layoutSlider(); } }
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.
Definition at line 174 of file qwt_slider.cpp.
References BottomScale, layoutSlider(), LeftScale, NoScale, QwtAbstractSlider::orientation(), RightScale, QwtSlider::PrivateData::scalePos, and TopScale.
Referenced by setScalePosition().
{ if ( o == orientation() ) return; if (o == Qt::Horizontal) { if ((d_data->scalePos == LeftScale) || (d_data->scalePos == RightScale)) d_data->scalePos = NoScale; } else // if (o == Qt::Vertical) { if ((d_data->scalePos == BottomScale) || (d_data->scalePos == TopScale)) d_data->scalePos = NoScale; } #if QT_VERSION >= 0x040000 if ( !testAttribute(Qt::WA_WState_OwnSizePolicy) ) #else if ( !testWState( WState_OwnSizePolicy ) ) #endif { QSizePolicy sp = sizePolicy(); sp.transpose(); setSizePolicy(sp); #if QT_VERSION >= 0x040000 setAttribute(Qt::WA_WState_OwnSizePolicy, false); #else clearWState( WState_OwnSizePolicy ); #endif } QwtAbstractSlider::setOrientation(o); layoutSlider(); }
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(). |
Definition at line 331 of file qwt_slider.cpp.
References QwtScaleDraw::alignment(), layoutSlider(), scaleDraw(), QwtAbstractScale::setAbstractScaleDraw(), and QwtScaleDraw::setAlignment().
{ const QwtScaleDraw *previousScaleDraw = this->scaleDraw(); if ( scaleDraw == NULL || scaleDraw == previousScaleDraw ) return; if ( previousScaleDraw ) scaleDraw->setAlignment(previousScaleDraw->alignment()); setAbstractScaleDraw(scaleDraw); layoutSlider(); }
void QwtSlider::setScalePosition | ( | ScalePos | s ) |
Change the scale position (and slider orientation).
s | Position of the scale. |
A valid combination of scale position and orientation is enforced:
Definition at line 224 of file qwt_slider.cpp.
References QwtScaleDraw::BottomScale, BottomScale, layoutSlider(), QwtScaleDraw::LeftScale, LeftScale, QwtScaleDraw::RightScale, RightScale, scaleDraw(), QwtSlider::PrivateData::scalePos, QwtScaleDraw::setAlignment(), setOrientation(), QwtScaleDraw::TopScale, and TopScale.
{ if ( d_data->scalePos == s ) return; d_data->scalePos = s; switch(d_data->scalePos) { case BottomScale: { setOrientation(Qt::Horizontal); scaleDraw()->setAlignment(QwtScaleDraw::BottomScale); break; } case TopScale: { setOrientation(Qt::Horizontal); scaleDraw()->setAlignment(QwtScaleDraw::TopScale); break; } case LeftScale: { setOrientation(Qt::Vertical); scaleDraw()->setAlignment(QwtScaleDraw::LeftScale); break; } case RightScale: { setOrientation(Qt::Vertical); scaleDraw()->setAlignment(QwtScaleDraw::RightScale); break; } default: { // nothing } } layoutSlider(); }
void QwtSlider::setThumbLength | ( | int | thumbLength ) |
Set the slider's thumb length.
thumbLength | new length |
Definition at line 292 of file qwt_slider.cpp.
References layoutSlider(), thumbLength(), and QwtSlider::PrivateData::thumbLength.
{ if ( thumbLength < 8 ) thumbLength = 8; if ( thumbLength != d_data->thumbLength ) { d_data->thumbLength = thumbLength; layoutSlider(); } }
void QwtSlider::setThumbWidth | ( | int | w ) |
Change the width of the thumb.
w | new width |
Definition at line 308 of file qwt_slider.cpp.
References layoutSlider(), and QwtSlider::PrivateData::thumbWidth.
{ if ( w < 4 ) w = 4; if ( d_data->thumbWidth != w ) { d_data->thumbWidth = w; layoutSlider(); } }
QSize QwtSlider::sizeHint | ( | ) | const [virtual] |
Definition at line 844 of file qwt_slider.cpp.
References minimumSizeHint().
{ return minimumSizeHint(); }
int QwtSlider::thumbLength | ( | ) | const |
Referenced by getScrollMode(), and setThumbLength().
int QwtSlider::thumbWidth | ( | ) | const |
void QwtSlider::valueChange | ( | ) | [protected, virtual] |
Notify change of value.
Reimplemented from QwtAbstractSlider.
Definition at line 761 of file qwt_slider.cpp.
{ QwtAbstractSlider::valueChange(); update(); }
int QwtSlider::xyPosition | ( | double | value ) | const [protected] |
Find the x/y position for a given value v
value | Value |
Definition at line 525 of file qwt_slider.cpp.
References QwtSlider::PrivateData::map, and QwtScaleMap::transform().
Referenced by drawSlider(), and getScrollMode().
QwtSlider::BGSTYLE QwtSlider::bgStyle [read, write] |
Definition at line 41 of file qwt_slider.h.
int QwtSlider::borderWidth [read, write] |
Definition at line 44 of file qwt_slider.h.
QwtSlider::ScalePos QwtSlider::scalePosition [read, write] |
Return the scale position.
Definition at line 40 of file qwt_slider.h.
int QwtSlider::thumbLength [read, write] |
Definition at line 42 of file qwt_slider.h.
int QwtSlider::thumbWidth [read, write] |
Definition at line 43 of file qwt_slider.h.