#include <qabstractslider.h>
Inheritance diagram for QAbstractSlider:


The class is designed as a common super class for widgets like QScrollBar, QSlider and QDial.
Here are the main properties of the class:
1
value: The bounded integer that QAbstractSlider maintains.
minimum: The lowest possible value.
maximum: The highest possible value.
singleStep: The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.
pageStep: The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.
tracking: Whether slider tracking is enabled.
sliderPosition: The current position of the slider. If tracking is enabled (the default), this is identical to value.
Unity (1) may be viewed as a third step size. setValue() lets you set the current value to any integer in the allowed range, not just minimum() + n * singleStep() for integer values of n. Some widgets may allow the user to set any value at all; others may just provide multiples of singleStep() or pageStep().
QAbstractSlider emits a comprehensive set of signals:
Signal Emitted when valueChanged() the value has changed. The tracking determines whether this signal is emitted during user interaction. sliderPressed() the user starts to drag the slider. sliderMoved() the user drags the slider. sliderReleased() the user releases the slider. actionTriggered() a slider action was triggerd. rangeChanged() a the range has changed.
QAbstractSlider provides a virtual sliderChange() function that is well suited for updating the on-screen representation of sliders. By calling triggerAction(), subclasses trigger slider actions. Two helper functions QStyle::sliderPositionFromValue() and QStyle::sliderValueFromPosition() help subclasses and styles to map screen coordinates to logical range values.
Definition at line 35 of file qabstractslider.h.
Public Types | |
| enum | SliderAction |
Public Slots | |
| void | setValue (int) |
| void | setOrientation (Qt::Orientation) |
Signals | |
| void | valueChanged (int value) |
| void | sliderPressed () |
| void | sliderMoved (int position) |
| void | sliderReleased () |
| void | rangeChanged (int min, int max) |
| void | actionTriggered (int action) |
Public Member Functions | |
| QAbstractSlider (QWidget *parent=0) | |
| ~QAbstractSlider () | |
| Qt::Orientation | orientation () const |
| void | setMinimum (int) |
| int | minimum () const |
| void | setMaximum (int) |
| int | maximum () const |
| void | setRange (int min, int max) |
| void | setSingleStep (int) |
| int | singleStep () const |
| void | setPageStep (int) |
| int | pageStep () const |
| void | setTracking (bool enable) |
| bool | hasTracking () const |
| void | setSliderDown (bool) |
| bool | isSliderDown () const |
| void | setSliderPosition (int) |
| int | sliderPosition () const |
| void | setInvertedAppearance (bool) |
| bool | invertedAppearance () const |
| void | setInvertedControls (bool) |
| bool | invertedControls () const |
| int | value () const |
| void | triggerAction (SliderAction action) |
Protected Types | |
| enum | SliderChange |
Protected Member Functions | |
| bool | event (QEvent *e) |
| void | setRepeatAction (SliderAction action, int thresholdTime=500, int repeatTime=50) |
| SliderAction | repeatAction () const |
| virtual void | sliderChange (SliderChange change) |
| void | keyPressEvent (QKeyEvent *ev) |
| void | timerEvent (QTimerEvent *) |
| void | wheelEvent (QWheelEvent *e) |
| void | changeEvent (QEvent *e) |
| QAbstractSlider (QAbstractSliderPrivate &dd, QWidget *parent=0) | |
SliderNoAction SliderSingleStepAdd SliderSingleStepSub SliderPageStepAdd SliderPageStepSub SliderToMinimum SliderToMaximum SliderMove
Definition at line 86 of file qabstractslider.h.
00086 { 00087 SliderNoAction, 00088 SliderSingleStepAdd, 00089 SliderSingleStepSub, 00090 SliderPageStepAdd, 00091 SliderPageStepSub, 00092 SliderToMinimum, 00093 SliderToMaximum, 00094 SliderMove 00095 };
enum QAbstractSlider::SliderChange [protected] |
SliderRangeChange SliderOrientationChange SliderStepsChange SliderValueChange
Definition at line 122 of file qabstractslider.h.
00122 { 00123 SliderRangeChange, 00124 SliderOrientationChange, 00125 SliderStepsChange, 00126 SliderValueChange 00127 };
| QAbstractSlider::QAbstractSlider | ( | QWidget * | parent = 0 |
) | [explicit] |
Constructs an abstract slider.
The parent arguments is sent to the QWidget constructor.
The minimum defaults to 0, the maximum to 99, with a singleStep size of 1 and a pageStep size of 10, and an initial value of 0.
Definition at line 245 of file qabstractslider.cpp.
00246 :QWidget(*new QAbstractSliderPrivate, parent, 0) 00247 { 00248 }
| QAbstractSlider::~QAbstractSlider | ( | ) |
| QAbstractSlider::QAbstractSlider | ( | QAbstractSliderPrivate & | dd, | |
| QWidget * | parent = 0 | |||
| ) | [protected] |
| Qt::Orientation QAbstractSlider::orientation | ( | ) | const |
Definition at line 287 of file qabstractslider.cpp.
References d.
Referenced by QWindowsXPStyle::drawComplexControl(), QAbstractScrollAreaPrivate::replaceScrollBar(), Q3IconView::sizeHint(), and QAccessibleSlider::text().
00288 { 00289 Q_D(const QAbstractSlider); 00290 return d->orientation; 00291 }
| void QAbstractSlider::setMinimum | ( | int | ) |
Definition at line 304 of file qabstractslider.cpp.
References d, qMax(), and setRange().
Referenced by QVFbRateDialog::QVFbRateDialog(), SlidersGroup::setMinimum(), QWorkspacePrivate::updateWorkspace(), View::View(), and Zoomer::Zoomer().
00305 { 00306 Q_D(QAbstractSlider); 00307 setRange(min, qMax(d->maximum, min)); 00308 }
Here is the call graph for this function:

| int QAbstractSlider::minimum | ( | ) | const |
Definition at line 310 of file qabstractslider.cpp.
References d.
Referenced by QGraphicsView::centerOn(), QWindowsXPStyle::drawComplexControl(), QAbstractScrollAreaPrivate::layoutChildren(), QTreeView::moveCursor(), QAbstractScrollAreaPrivate::replaceScrollBar(), QComboBox::showPopup(), QAccessibleSlider::state(), QAccessibleScrollBar::state(), and QComboBoxPrivateContainer::updateScrollers().
00311 { 00312 Q_D(const QAbstractSlider); 00313 return d->minimum; 00314 }
| void QAbstractSlider::setMaximum | ( | int | ) |
Definition at line 328 of file qabstractslider.cpp.
References d, qMin(), and setRange().
Referenced by QVFbRateDialog::QVFbRateDialog(), SlidersGroup::setMaximum(), MoviePlayer::updateFrameSlider(), QWorkspacePrivate::updateWorkspace(), View::View(), and Zoomer::Zoomer().
00329 { 00330 Q_D(QAbstractSlider); 00331 setRange(qMin(d->minimum, max), max); 00332 }
Here is the call graph for this function:

| int QAbstractSlider::maximum | ( | ) | const |
Definition at line 334 of file qabstractslider.cpp.
References d.
Referenced by QTextEditPrivate::_q_ensureVisible(), ChatDialog::appendMessage(), QGraphicsView::centerOn(), QAbstractScrollAreaPrivate::contentsOffset(), QWindowsXPStyle::drawComplexControl(), qdesigner_internal::QtGradientStopsWidgetPrivate::ensureVisible(), qdesigner_internal::QtGradientStopsWidgetPrivate::fromViewport(), QTextEditPrivate::horizontalOffset(), QAbstractScrollAreaPrivate::layoutChildren(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), QAbstractScrollAreaPrivate::replaceScrollBar(), qdesigner_internal::QtGradientStopsWidget::setZoom(), QComboBox::showPopup(), QAccessibleSlider::state(), QAccessibleScrollBar::state(), qdesigner_internal::QtGradientStopsWidgetPrivate::toViewport(), MoviePlayer::updateFrameSlider(), and QComboBoxPrivateContainer::updateScrollers().
00335 { 00336 Q_D(const QAbstractSlider); 00337 return d->maximum; 00338 }
| void QAbstractSlider::setRange | ( | int | min, | |
| int | max | |||
| ) |
Sets the slider's minimum to min and its maximum to max.
If max is smaller than min, min becomes the only legal value.
Definition at line 213 of file qabstractslider.cpp.
References d, emit, qMax(), rangeChanged(), setValue(), sliderChange(), and SliderRangeChange.
Referenced by QTextEditPrivate::_q_adjustScrollbars(), CompositionWidget::CompositionWidget(), Window::createSlider(), MainWindow::createSlider(), QAbstractScrollAreaPrivate::init(), LCDRange::init(), LCDRange::LCDRange(), PathDeformWidget::PathDeformWidget(), PathStrokeWidget::PathStrokeWidget(), PieView::PieView(), qdesigner_internal::QtGradientStopsWidget::QtGradientStopsWidget(), QAbstractScrollAreaPrivate::replaceScrollBar(), PreviewView::resizeEvent(), setMaximum(), setMinimum(), LCDRange::setRange(), qdesigner_internal::QtGradientStopsWidget::setZoom(), QListView::updateGeometries(), PieView::updateGeometries(), QTableView::updateGeometries(), QScrollAreaPrivate::updateScrollBars(), Q3ScrollView::updateScrollBars(), and XFormWidget::XFormWidget().
00214 { 00215 Q_D(QAbstractSlider); 00216 int oldMin = d->minimum; 00217 int oldMax = d->maximum; 00218 d->minimum = min; 00219 d->maximum = qMax(min, max); 00220 if (oldMin != d->minimum || oldMax != d->maximum) { 00221 sliderChange(SliderRangeChange); 00222 emit rangeChanged(d->minimum, d->maximum); 00223 setValue(d->value); // re-bound 00224 } 00225 }
Here is the call graph for this function:

| void QAbstractSlider::setSingleStep | ( | int | ) |
Definition at line 353 of file qabstractslider.cpp.
References d.
Referenced by Window::createSlider(), MainWindow::createSlider(), QTextEditPrivate::init(), PreviewView::PreviewView(), qdesigner_internal::QtGradientStopsWidget::QtGradientStopsWidget(), QAbstractScrollAreaPrivate::replaceScrollBar(), SlidersGroup::SlidersGroup(), QListView::updateGeometries(), and QWorkspacePrivate::updateWorkspace().
00354 { 00355 Q_D(QAbstractSlider); 00356 d->setSteps(step, d->pageStep); 00357 }
| int QAbstractSlider::singleStep | ( | ) | const |
Definition at line 359 of file qabstractslider.cpp.
References d.
Referenced by Q3ListBox::doAutoScroll(), QTreeView::moveCursor(), and QAbstractScrollAreaPrivate::replaceScrollBar().
00360 { 00361 Q_D(const QAbstractSlider); 00362 return d->singleStep; 00363 }
| void QAbstractSlider::setPageStep | ( | int | ) |
Definition at line 376 of file qabstractslider.cpp.
References d.
Referenced by QTextEditPrivate::_q_adjustScrollbars(), Window::createSlider(), MainWindow::createSlider(), qdesigner_internal::QtGradientStopsWidget::QtGradientStopsWidget(), QVFbRateDialog::QVFbRateDialog(), QAbstractScrollAreaPrivate::replaceScrollBar(), PreviewView::resizeEvent(), QListView::updateGeometries(), PieView::updateGeometries(), QTableView::updateGeometries(), QScrollAreaPrivate::updateScrollBars(), QWorkspacePrivate::updateWorkspace(), and Zoomer::Zoomer().
00377 { 00378 Q_D(QAbstractSlider); 00379 d->setSteps(d->singleStep, step); 00380 }
| int QAbstractSlider::pageStep | ( | ) | const |
Definition at line 382 of file qabstractslider.cpp.
References d.
Referenced by ImageViewer::adjustScrollBar(), QAbstractItemView::doAutoScroll(), and QAbstractScrollAreaPrivate::replaceScrollBar().
00383 { 00384 Q_D(const QAbstractSlider); 00385 return d->pageStep; 00386 }
| void QAbstractSlider::setTracking | ( | bool | enable | ) |
Definition at line 399 of file qabstractslider.cpp.
References d.
Referenced by QAbstractScrollAreaPrivate::replaceScrollBar().
00400 { 00401 Q_D(QAbstractSlider); 00402 d->tracking = enable; 00403 }
| bool QAbstractSlider::hasTracking | ( | ) | const |
Definition at line 405 of file qabstractslider.cpp.
References d.
Referenced by QAbstractScrollAreaPrivate::replaceScrollBar().
00406 { 00407 Q_D(const QAbstractSlider); 00408 return d->tracking; 00409 }
| void QAbstractSlider::setSliderDown | ( | bool | ) |
Definition at line 423 of file qabstractslider.cpp.
References d, emit, SliderMove, sliderPressed(), sliderReleased(), and triggerAction().
Referenced by changeEvent(), QDial::mousePressEvent(), QScrollBar::mousePressEvent(), QSlider::mousePressEvent(), QDial::mouseReleaseEvent(), QScrollBar::mouseReleaseEvent(), QSlider::mouseReleaseEvent(), and QAbstractScrollAreaPrivate::replaceScrollBar().
00424 { 00425 Q_D(QAbstractSlider); 00426 bool doEmit = d->pressed != down; 00427 00428 d->pressed = down; 00429 00430 if (doEmit) { 00431 if (down) 00432 emit sliderPressed(); 00433 else 00434 emit sliderReleased(); 00435 } 00436 00437 if (!down && d->position != d->value) 00438 triggerAction(SliderMove); 00439 }
Here is the call graph for this function:

| bool QAbstractSlider::isSliderDown | ( | ) | const |
Definition at line 441 of file qabstractslider.cpp.
References d.
Referenced by QAbstractScrollAreaPrivate::replaceScrollBar().
00442 { 00443 Q_D(const QAbstractSlider); 00444 return d->pressed; 00445 }
| void QAbstractSlider::setSliderPosition | ( | int | ) |
Definition at line 454 of file qabstractslider.cpp.
References d, emit, SliderMove, sliderMoved(), triggerAction(), and QWidget::update().
Referenced by QSlider::mouseMoveEvent(), QDial::mouseMoveEvent(), QScrollBar::mouseMoveEvent(), QDial::mousePressEvent(), QScrollBar::mousePressEvent(), QSlider::mousePressEvent(), QAbstractScrollAreaPrivate::replaceScrollBar(), and triggerAction().
00455 { 00456 Q_D(QAbstractSlider); 00457 position = d->bound(position); 00458 if (position == d->position) 00459 return; 00460 d->position = position; 00461 if (!d->tracking) 00462 update(); 00463 if (d->pressed) 00464 emit sliderMoved(position); 00465 if (d->tracking && !d->blocktracking) 00466 triggerAction(SliderMove); 00467 }
Here is the call graph for this function:

| int QAbstractSlider::sliderPosition | ( | ) | const |
Definition at line 469 of file qabstractslider.cpp.
References d.
Referenced by QAbstractScrollAreaPrivate::replaceScrollBar().
00470 { 00471 Q_D(const QAbstractSlider); 00472 return d->position; 00473 }
| void QAbstractSlider::setInvertedAppearance | ( | bool | ) |
Definition at line 527 of file qabstractslider.cpp.
References d, and QWidget::update().
Referenced by SlidersGroup::invertAppearance(), and QAbstractScrollAreaPrivate::replaceScrollBar().
00528 { 00529 Q_D(QAbstractSlider); 00530 d->invertedAppearance = invert; 00531 update(); 00532 }
| bool QAbstractSlider::invertedAppearance | ( | ) | const |
Definition at line 521 of file qabstractslider.cpp.
References d.
Referenced by QAbstractScrollAreaPrivate::replaceScrollBar().
00522 { 00523 Q_D(const QAbstractSlider); 00524 return d->invertedAppearance; 00525 }
| void QAbstractSlider::setInvertedControls | ( | bool | ) |
Definition at line 551 of file qabstractslider.cpp.
References d.
Referenced by SlidersGroup::invertKeyBindings(), and QAbstractScrollAreaPrivate::replaceScrollBar().
00552 { 00553 Q_D(QAbstractSlider); 00554 d->invertedControls = invert; 00555 }
| bool QAbstractSlider::invertedControls | ( | ) | const |
Definition at line 545 of file qabstractslider.cpp.
References d.
Referenced by QAbstractScrollAreaPrivate::replaceScrollBar().
00546 { 00547 Q_D(const QAbstractSlider); 00548 return d->invertedControls; 00549 }
| int QAbstractSlider::value | ( | ) | const |
Definition at line 487 of file qabstractslider.cpp.
References d.
Referenced by QWorkspacePrivate::_q_scrollBarChanged(), ImageViewer::adjustScrollBar(), QAbstractScrollAreaPrivate::contentsOffset(), QAbstractItemView::doAutoScroll(), qdesigner_internal::QtGradientStopsWidgetPrivate::fromViewport(), Q3ListView::handleSizeChange(), QTextEditPrivate::horizontalOffset(), PieView::horizontalOffset(), PieView::indexAt(), Q3DataTable::loadNextPage(), QGraphicsView::mouseMoveEvent(), PreviewView::mousePressEvent(), SvgWindow::mousePressEvent(), QTreeView::moveCursor(), QVFbRateDialog::ok(), PieView::paintEvent(), qdesigner_internal::QtGradientStopsWidget::paintEvent(), QVFbRateDialog::rateChanged(), QAccessibleTextEdit::rect(), QAbstractScrollAreaPrivate::replaceScrollBar(), View::rotateLeft(), View::rotateRight(), QTreeView::scrollContentsBy(), QListView::scrollTo(), QTreeView::scrollTo(), qdesigner_internal::ObjectInspector::setFormWindow(), View::setupMatrix(), qdesigner_internal::QtGradientStopsWidget::setZoom(), QAccessibleSlider::state(), QAccessibleScrollBar::state(), qdesigner_internal::QtGradientStopsWidgetPrivate::toViewport(), Q3ListView::updateGeometries(), QComboBoxPrivateContainer::updateScrollers(), QScrollAreaPrivate::updateWidgetPosition(), LCDRange::value(), QTextEditPrivate::verticalOffset(), QTreeView::verticalOffset(), QListView::verticalOffset(), PieView::verticalOffset(), PieView::visualRect(), View::zoomIn(), and View::zoomOut().
00488 { 00489 Q_D(const QAbstractSlider); 00490 return d->value; 00491 }
| void QAbstractSlider::triggerAction | ( | SliderAction | action | ) |
Triggers a slider action. Possible actions are SliderSingleStepAdd, SliderSingleStepSub, SliderPageStepAdd, SliderPageStepSub, SliderToMinimum, SliderToMaximum, and SliderMove.
Definition at line 564 of file qabstractslider.cpp.
References actionTriggered(), d, emit, setSliderPosition(), setValue(), SliderMove, SliderNoAction, SliderPageStepAdd, SliderPageStepSub, SliderSingleStepAdd, SliderSingleStepSub, SliderToMaximum, and SliderToMinimum.
Referenced by QScrollBar::contextMenuEvent(), Q3ListView::keyPressEvent(), keyPressEvent(), QSlider::mousePressEvent(), QTextEditPrivate::pageUpDown(), QComboBoxPrivateContainer::scrollItemView(), setSliderDown(), setSliderPosition(), timerEvent(), and wheelEvent().
00565 { 00566 Q_D(QAbstractSlider); 00567 d->blocktracking = true; 00568 switch (action) { 00569 case SliderSingleStepAdd: 00570 setSliderPosition(d->value + d->singleStep); 00571 break; 00572 case SliderSingleStepSub: 00573 setSliderPosition(d->value - d->singleStep); 00574 break; 00575 case SliderPageStepAdd: 00576 setSliderPosition(d->value + d->pageStep); 00577 break; 00578 case SliderPageStepSub: 00579 setSliderPosition(d->value - d->pageStep); 00580 break; 00581 case SliderToMinimum: 00582 setSliderPosition(d->minimum); 00583 break; 00584 case SliderToMaximum: 00585 setSliderPosition(d->maximum); 00586 break; 00587 case SliderMove: 00588 case SliderNoAction: 00589 break; 00590 }; 00591 emit actionTriggered(action); 00592 d->blocktracking = false; 00593 setValue(d->position); 00594 }
Here is the call graph for this function:

| void QAbstractSlider::setValue | ( | int | ) | [slot] |
Definition at line 493 of file qabstractslider.cpp.
References d, emit, sliderChange(), sliderMoved(), SliderValueChange, QAccessible::updateAccessibility(), QAccessible::ValueChanged, and valueChanged().
Referenced by QTextEditPrivate::_q_ensureVisible(), ImageViewer::adjustScrollBar(), ChatDialog::appendMessage(), QGraphicsView::centerOn(), CompositionWidget::CompositionWidget(), QScrollBar::contextMenuEvent(), WidgetGallery::createBottomRightGroupBox(), QAbstractItemView::doAutoScroll(), QGraphicsView::ensureVisible(), qdesigner_internal::QtGradientStopsWidgetPrivate::ensureVisible(), LCDRange::init(), LCDRange::LCDRange(), MainWindow::loadSettings(), SvgWindow::mouseMoveEvent(), PreviewView::mouseMoveEvent(), QGraphicsView::mouseMoveEvent(), QDial::mouseReleaseEvent(), QTreeView::moveCursor(), PathDeformWidget::PathDeformWidget(), PathStrokeWidget::PathStrokeWidget(), QVFbRateDialog::QVFbRateDialog(), QVFbRateDialog::rateChanged(), QAbstractScrollAreaPrivate::replaceScrollBar(), Q3DataTable::reset(), View::resetView(), View::rotateLeft(), View::rotateRight(), QListView::scrollTo(), QTableView::scrollTo(), PieView::scrollTo(), QTreeView::scrollTo(), QAbstractItemView::scrollToBottom(), OublietteView::scrollToCharacter(), QAbstractItemView::scrollToTop(), Q3ScrollView::setContentsPos(), setRange(), QTextBrowserPrivate::setSource(), LCDRange::setValue(), SlidersGroup::setValue(), qdesigner_internal::QtGradientStopsWidget::setZoom(), triggerAction(), MoviePlayer::updateFrameSlider(), Q3ListView::updateGeometries(), Q3Table::updateGeometries(), Q3ScrollView::updateScrollBars(), QWorkspacePrivate::updateWorkspace(), View::View(), Zoomer::Zoomer(), View::zoomIn(), and View::zoomOut().
00494 { 00495 Q_D(QAbstractSlider); 00496 value = d->bound(value); 00497 if (d->value == value && d->position == value) 00498 return; 00499 d->value = value; 00500 if (d->position != value) { 00501 d->position = value; 00502 if (d->pressed) 00503 emit sliderMoved((d->position = value)); 00504 } 00505 #ifndef QT_NO_ACCESSIBILITY 00506 QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged); 00507 #endif 00508 sliderChange(SliderValueChange); 00509 emit valueChanged(value); 00510 }
| void QAbstractSlider::setOrientation | ( | Qt::Orientation | ) | [slot] |
Definition at line 270 of file qabstractslider.cpp.
References d, QWidget::setAttribute(), QWidget::setSizePolicy(), QWidget::sizePolicy(), QWidget::testAttribute(), QSizePolicy::transpose(), QWidget::update(), QWidget::updateGeometry(), and Qt::WA_WState_OwnSizePolicy.
Referenced by QAbstractScrollAreaPrivate::replaceScrollBar(), and View::View().
00271 { 00272 Q_D(QAbstractSlider); 00273 if (d->orientation == orientation) 00274 return; 00275 00276 d->orientation = orientation; 00277 if (!testAttribute(Qt::WA_WState_OwnSizePolicy)) { 00278 QSizePolicy sp = sizePolicy(); 00279 sp.transpose(); 00280 setSizePolicy(sp); 00281 setAttribute(Qt::WA_WState_OwnSizePolicy, false); 00282 } 00283 update(); 00284 updateGeometry(); 00285 }
| void QAbstractSlider::valueChanged | ( | int | value | ) | [signal] |
This signal is emitted when the slider value has changed, with the new slider value as argument.
Referenced by setValue().
| void QAbstractSlider::sliderPressed | ( | ) | [signal] |
This signal is emitted when the user presses the slider with the mouse, or programmatically when setSliderDown(true) is called.
Referenced by setSliderDown().
| void QAbstractSlider::sliderMoved | ( | int | value | ) | [signal] |
This signal is emitted when sliderDown is true and the slider moves. This usually happens when the user is dragging the slider. The value is the new slider position.
This signal is emitted even when tracking is turned off.
Referenced by QDial::mouseMoveEvent(), setSliderPosition(), and setValue().
| void QAbstractSlider::sliderReleased | ( | ) | [signal] |
This signal is emitted when the user releases the slider with the mouse, or programmatically when setSliderDown(false) is called.
Referenced by setSliderDown().
| void QAbstractSlider::rangeChanged | ( | int | min, | |
| int | max | |||
| ) | [signal] |
This signal is emitted when the slider range has changed, with min being the new minimum, and max being the new maximum.
Referenced by setRange().
| void QAbstractSlider::actionTriggered | ( | int | action | ) | [signal] |
This signal is emitted when the slider action action is triggered. Actions are SliderSingleStepAdd, SliderSingleStepSub, SliderPageStepAdd, SliderPageStepSub, SliderToMinimum, SliderToMaximum, and SliderMove.
When the signal is emitted, the sliderPosition has been adjusted according to the action, but the value has not yet been propagated (meaning the valueChanged() signal was not yet emitted), and the visual display has not been updated. In slots connected to this signal you can thus safely adjust any action by calling setSliderPosition() yourself, based on both the action and the slider's value.
Referenced by triggerAction().
| bool QAbstractSlider::event | ( | QEvent * | e | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 778 of file qabstractslider.cpp.
References QWidget::event().
Referenced by QDial::event().
00779 { 00780 return QWidget::event(e); 00781 }
Here is the call graph for this function:

| void QAbstractSlider::setRepeatAction | ( | SliderAction | action, | |
| int | thresholdTime = 500, |
|||
| int | repeatTime = 50 | |||
| ) | [protected] |
Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of thresholdTime.
Definition at line 601 of file qabstractslider.cpp.
References d, and SliderNoAction.
Referenced by QScrollBar::hideEvent(), QScrollBar::mouseMoveEvent(), QSlider::mousePressEvent(), QScrollBar::mouseReleaseEvent(), and QSlider::mouseReleaseEvent().
00602 { 00603 Q_D(QAbstractSlider); 00604 if ((d->repeatAction = action) == SliderNoAction) { 00605 d->repeatActionTimer.stop(); 00606 } else { 00607 d->repeatActionTime = repeatTime; 00608 d->repeatActionTimer.start(thresholdTime, this); 00609 } 00610 }
| QAbstractSlider::SliderAction QAbstractSlider::repeatAction | ( | ) | const [protected] |
Returns the current repeat action.
Definition at line 616 of file qabstractslider.cpp.
References d.
00617 { 00618 Q_D(const QAbstractSlider); 00619 return d->repeatAction; 00620 }
| void QAbstractSlider::sliderChange | ( | SliderChange | change | ) | [protected, virtual] |
Reimplement this virtual function to track slider changes such as SliderRangeChange, SliderOrientationChange, SliderStepsChange, or SliderValueChange. The default implementation only updates the display and ignores the change parameter.
Definition at line 648 of file qabstractslider.cpp.
References QWidget::update().
Referenced by setRange(), setValue(), QScrollBar::sliderChange(), and QDial::sliderChange().
00649 { 00650 update(); 00651 }
| void QAbstractSlider::keyPressEvent | ( | QKeyEvent * | ev | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 696 of file qabstractslider.cpp.
References d, QEvent::ignore(), QKeyEvent::key(), Qt::Key_Down, Qt::Key_End, Qt::Key_Home, Qt::Key_Left, Qt::Key_PageDown, Qt::Key_PageUp, Qt::Key_Right, Qt::Key_Up, SliderNoAction, SliderPageStepAdd, SliderPageStepSub, SliderSingleStepAdd, SliderSingleStepSub, SliderToMaximum, SliderToMinimum, triggerAction(), and Qt::Vertical.
00697 { 00698 Q_D(QAbstractSlider); 00699 SliderAction action = SliderNoAction; 00700 switch (ev->key()) { 00701 00702 // It seems we need to use invertedAppearance for Left and right, otherwise, things look weird. 00703 case Qt::Key_Left: 00704 #ifdef QT_KEYPAD_NAVIGATION 00705 if (QApplication::keypadNavigationEnabled() && d->orientation == Qt::Vertical) 00706 action = d->invertedControls ? SliderSingleStepSub : SliderSingleStepAdd; 00707 else 00708 #endif 00709 action = !d->invertedAppearance ? SliderSingleStepSub : SliderSingleStepAdd; 00710 break; 00711 case Qt::Key_Right: 00712 #ifdef QT_KEYPAD_NAVIGATION 00713 if (QApplication::keypadNavigationEnabled() && d->orientation == Qt::Vertical) 00714 action = d->invertedControls ? SliderSingleStepAdd : SliderSingleStepSub; 00715 else 00716 #endif 00717 action = !d->invertedAppearance ? SliderSingleStepAdd : SliderSingleStepSub; 00718 break; 00719 case Qt::Key_Up: 00720 #ifdef QT_KEYPAD_NAVIGATION 00721 if (QApplication::keypadNavigationEnabled()) { 00722 ev->ignore(); 00723 break; 00724 } 00725 #endif 00726 action = d->invertedControls ? SliderSingleStepSub : SliderSingleStepAdd; 00727 break; 00728 case Qt::Key_Down: 00729 #ifdef QT_KEYPAD_NAVIGATION 00730 if (QApplication::keypadNavigationEnabled()) { 00731 ev->ignore(); 00732 break; 00733 } 00734 #endif 00735 action = d->invertedControls ? SliderSingleStepAdd : SliderSingleStepSub; 00736 break; 00737 case Qt::Key_PageUp: 00738 action = d->invertedControls ? SliderPageStepSub : SliderPageStepAdd; 00739 break; 00740 case Qt::Key_PageDown: 00741 action = d->invertedControls ? SliderPageStepAdd : SliderPageStepSub; 00742 break; 00743 case Qt::Key_Home: 00744 action = SliderToMinimum; 00745 break; 00746 case Qt::Key_End: 00747 action = SliderToMaximum; 00748 break; 00749 default: 00750 ev->ignore(); 00751 break; 00752 } 00753 if (action) 00754 triggerAction(action); 00755 }
Here is the call graph for this function:

| void QAbstractSlider::timerEvent | ( | QTimerEvent * | e | ) | [protected, virtual] |
Reimplemented from QObject.
Definition at line 624 of file qabstractslider.cpp.
References d, SliderPageStepAdd, SliderPageStepSub, QTimerEvent::timerId(), and triggerAction().
00625 { 00626 Q_D(QAbstractSlider); 00627 if (e->timerId() == d->repeatActionTimer.timerId()) { 00628 if (d->repeatActionTime) { // was threshold time, use repeat time next time 00629 d->repeatActionTimer.start(d->repeatActionTime, this); 00630 d->repeatActionTime = 0; 00631 } 00632 if (d->repeatAction == SliderPageStepAdd) 00633 d->setAdjustedSliderPosition(d->value + d->pageStep); 00634 else if (d->repeatAction == SliderPageStepSub) 00635 d->setAdjustedSliderPosition(d->value - d->pageStep); 00636 else 00637 triggerAction(d->repeatAction); 00638 } 00639 }
Here is the call graph for this function:

| void QAbstractSlider::wheelEvent | ( | QWheelEvent * | e | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 658 of file qabstractslider.cpp.
References QEvent::accept(), QRect::contains(), Qt::ControlModifier, d, QWheelEvent::delta(), QEvent::ignore(), int, QInputEvent::modifiers(), QWheelEvent::orientation(), QWheelEvent::pos(), qMin(), QWidget::rect(), Qt::ShiftModifier, SliderMove, triggerAction(), and QApplication::wheelScrollLines().
00659 { 00660 Q_D(QAbstractSlider); 00661 e->ignore(); 00662 if (e->orientation() != d->orientation && !rect().contains(e->pos())) 00663 return; 00664 00665 static qreal offset = 0; 00666 static QAbstractSlider *offset_owner = 0; 00667 if (offset_owner != this){ 00668 offset_owner = this; 00669 offset = 0; 00670 } 00671 00672 int step = qMin(QApplication::wheelScrollLines() * d->singleStep, d->pageStep); 00673 if ((e->modifiers() & Qt::ControlModifier) || (e->modifiers() & Qt::ShiftModifier)) 00674 step = d->pageStep; 00675 offset += e->delta() * step / 120; 00676 if (d->invertedControls) 00677 offset = -offset; 00678 00679 if (qAbs(offset) < 1) 00680 return; 00681 00682 int prevValue = d->value; 00683 d->position = d->value + int(offset); // value will be updated by triggerAction() 00684 triggerAction(SliderMove); 00685 if (prevValue == d->value) { 00686 offset = 0; 00687 } else { 00688 offset -= int(offset); 00689 e->accept(); 00690 } 00691 }
Here is the call graph for this function:

| void QAbstractSlider::changeEvent | ( | QEvent * | ev | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 760 of file qabstractslider.cpp.
References QWidget::changeEvent(), d, QEvent::EnabledChange, QWidget::isEnabled(), setSliderDown(), and QEvent::type().
00761 { 00762 Q_D(QAbstractSlider); 00763 switch (ev->type()) { 00764 case QEvent::EnabledChange: 00765 if (!isEnabled()) { 00766 d->repeatActionTimer.stop(); 00767 setSliderDown(false); 00768 } 00769 // fall through... 00770 default: 00771 QWidget::changeEvent(ev); 00772 } 00773 }
Here is the call graph for this function:

1.5.1