com.trolltech.qt.gui
Class QAbstractSlider

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QObject
                  extended by com.trolltech.qt.gui.QWidget
                      extended by com.trolltech.qt.gui.QAbstractSlider
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface
Direct Known Subclasses:
QDial, QScrollBar, QSlider

public class QAbstractSlider
extends QWidget

The QAbstractSlider class provides an integer value within a range. 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.
  2. minimum: The lowest possible value.
  3. maximum: The highest possible value.
  4. singleStep: The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.
  5. pageStep: The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.
  6. tracking: Whether slider tracking is enabled.
  7. 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.

See also:
QAbstractSpinBox, QSlider, QDial, QScrollBar, and Sliders Example.


Nested Class Summary
static class QAbstractSlider.SliderAction
           
static class QAbstractSlider.SliderChange
           
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 QSignalEmitter.Signal1 actionTriggered
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal2 rangeChanged
          This signal takes 2 generic argument(s).
 QSignalEmitter.Signal1 sliderMoved
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal0 sliderPressed
          This signal is emitted when the user presses the slider with the mouse, or programmatically when setSliderDown(true) is called.
 QSignalEmitter.Signal0 sliderReleased
          This signal is emitted when the user releases the slider with the mouse, or programmatically when setSliderDown(false) is called.
 QSignalEmitter.Signal1 valueChanged
          This signal takes 1 generic argument(s).
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QAbstractSlider()
          Constructs an abstract slider.
QAbstractSlider(QWidget parent)
          Constructs an abstract slider.
 
Method Summary
 boolean hasTracking()
          This property holds whether slider tracking is enabled.
 boolean invertedAppearance()
          This property holds whether or not a slider shows its values inverted.
 boolean invertedControls()
          This property holds whether or not the slider inverts its wheel and key events.
 boolean isSliderDown()
          This property holds whether the slider is pressed down.
 int maximum()
          This property holds the slider's maximum value.
 int minimum()
          This property holds the sliders's minimum value.
 Qt.Orientation orientation()
          This property holds the orientation of the slider.
 int pageStep()
          This property holds the page step.
protected  QAbstractSlider.SliderAction repeatAction()
          Returns the current repeat action.
 void setInvertedAppearance(boolean arg__1)
          This property holds whether or not a slider shows its values inverted.
 void setInvertedControls(boolean arg__1)
          This property holds whether or not the slider inverts its wheel and key events.
 void setMaximum(int arg__1)
          This property holds the slider's maximum value.
 void setMinimum(int arg__1)
          This property holds the sliders's minimum value.
 void setOrientation(Qt.Orientation arg__1)
          This property holds the orientation of the slider.
 void setPageStep(int arg__1)
          This property holds the page step.
 void setRange(int min, int max)
          Sets the slider's minimum to min and its maximum to max.
protected  void setRepeatAction(QAbstractSlider.SliderAction action)
          Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of thresholdTime.
protected  void setRepeatAction(QAbstractSlider.SliderAction action, int thresholdTime)
          Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of thresholdTime.
protected  void setRepeatAction(QAbstractSlider.SliderAction action, int thresholdTime, int repeatTime)
          Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of thresholdTime.
 void setSingleStep(int arg__1)
          This property holds the single step.
 void setSliderDown(boolean arg__1)
          This property holds whether the slider is pressed down.
 void setSliderPosition(int arg__1)
          This property holds the current slider position.
 void setTracking(boolean enable)
          This property holds whether slider tracking is enabled.
 void setValue(int arg__1)
          This property holds the slider's current value.
 int singleStep()
          This property holds the single step.
protected  void sliderChange(QAbstractSlider.SliderChange change)
          Reimplement this virtual function to track slider changes such as SliderRangeChange , SliderOrientationChange , SliderStepsChange , or SliderValueChange .
 int sliderPosition()
          This property holds the current slider position.
 void triggerAction(QAbstractSlider.SliderAction action)
          Triggers a slider action.
 int value()
          This property holds the slider's current value.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, graphicsProxyWidget, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

actionTriggered

public final QSignalEmitter.Signal1 actionTriggered

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: action)>:

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.

See also:
triggerAction().


rangeChanged

public final QSignalEmitter.Signal2 rangeChanged

This signal takes 2 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: min), java.lang.Integer(named: max)>:

This signal is emitted when the slider range has changed, with min being the new minimum, and max being the new maximum.

See also:
minimum, and maximum.


sliderMoved

public final QSignalEmitter.Signal1 sliderMoved

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: value)>:

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.

See also:
setTracking(), valueChanged() , isSliderDown(), sliderPressed() , and sliderReleased() .


sliderPressed

public final QSignalEmitter.Signal0 sliderPressed
This signal is emitted when the user presses the slider with the mouse, or programmatically when setSliderDown(true) is called.

See also:
sliderReleased() , sliderMoved() , and isSliderDown().


sliderReleased

public final QSignalEmitter.Signal0 sliderReleased
This signal is emitted when the user releases the slider with the mouse, or programmatically when setSliderDown(false) is called.

See also:
sliderPressed() , sliderMoved() , and sliderDown.


valueChanged

public final QSignalEmitter.Signal1 valueChanged

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: value)>:

This signal is emitted when the slider value has changed, with the new slider value as argument.

Constructor Detail

QAbstractSlider

public QAbstractSlider()
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.


QAbstractSlider

public QAbstractSlider(QWidget parent)
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.

Method Detail

hasTracking

public final boolean hasTracking()
This property holds whether slider tracking is enabled. If tracking is enabled (the default), the slider emits the valueChanged() signal while the slider is being dragged. If tracking is disabled, the slider emits the valueChanged() signal only when the user releases the slider.

See also:
sliderDown.


invertedAppearance

public final boolean invertedAppearance()
This property holds whether or not a slider shows its values inverted. If this property is false (the default), the minimum and maximum will be shown in its classic position for the inherited widget. If the value is true, the minimum and maximum appear at their opposite location.

Note: This property makes most sense for sliders and dials. For scroll bars, the visual effect of the scroll bar subcontrols depends on whether or not the styles understand inverted appearance; most styles ignore this property for scroll bars.


invertedControls

public final boolean invertedControls()
This property holds whether or not the slider inverts its wheel and key events. If this property is false, scrolling the mouse wheel "up" and using keys like page up will increase the slider's value towards its maximum. Otherwise pressing page up will move value towards the slider's minimum.


isSliderDown

public final boolean isSliderDown()
This property holds whether the slider is pressed down. The property is set by subclasses in order to let the abstract slider know whether or not tracking has any effect.

Changing the slider down property emits the sliderPressed() and sliderReleased() signals.


maximum

public final int maximum()
This property holds the slider's maximum value. When setting this property, the minimum is adjusted if necessary to ensure that the range remains valid. Also the slider's current value is adjusted to be within the new range.


minimum

public final int minimum()
This property holds the sliders's minimum value. When setting this property, the maximum is adjusted if necessary to ensure that the range remains valid. Also the slider's current value is adjusted to be within the new range.


orientation

public final Qt.Orientation orientation()
This property holds the orientation of the slider. The orientation must be Qt::Vertical (the default) or Qt::Horizontal .


pageStep

public final int pageStep()
This property holds the page step. The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.

See also:
singleStep.


repeatAction

protected final QAbstractSlider.SliderAction repeatAction()
Returns the current repeat action.

See also:
setRepeatAction().


setInvertedAppearance

public final void setInvertedAppearance(boolean arg__1)
This property holds whether or not a slider shows its values inverted. If this property is false (the default), the minimum and maximum will be shown in its classic position for the inherited widget. If the value is true, the minimum and maximum appear at their opposite location.

Note: This property makes most sense for sliders and dials. For scroll bars, the visual effect of the scroll bar subcontrols depends on whether or not the styles understand inverted appearance; most styles ignore this property for scroll bars.


setInvertedControls

public final void setInvertedControls(boolean arg__1)
This property holds whether or not the slider inverts its wheel and key events. If this property is false, scrolling the mouse wheel "up" and using keys like page up will increase the slider's value towards its maximum. Otherwise pressing page up will move value towards the slider's minimum.


setMaximum

public final void setMaximum(int arg__1)
This property holds the slider's maximum value. When setting this property, the minimum is adjusted if necessary to ensure that the range remains valid. Also the slider's current value is adjusted to be within the new range.


setMinimum

public final void setMinimum(int arg__1)
This property holds the sliders's minimum value. When setting this property, the maximum is adjusted if necessary to ensure that the range remains valid. Also the slider's current value is adjusted to be within the new range.


setOrientation

public final void setOrientation(Qt.Orientation arg__1)
This property holds the orientation of the slider. The orientation must be Qt::Vertical (the default) or Qt::Horizontal .


setPageStep

public final void setPageStep(int arg__1)
This property holds the page step. The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.

See also:
singleStep.


setRange

public final void 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.

See also:
minimum, and maximum.


setRepeatAction

protected final void setRepeatAction(QAbstractSlider.SliderAction action,
                                     int thresholdTime)
Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of thresholdTime.

See also:
triggerAction(), and repeatAction().


setRepeatAction

protected final void setRepeatAction(QAbstractSlider.SliderAction action)
Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of thresholdTime.

See also:
triggerAction(), and repeatAction().


setRepeatAction

protected final void setRepeatAction(QAbstractSlider.SliderAction action,
                                     int thresholdTime,
                                     int repeatTime)
Sets action action to be triggered repetitively in intervals of repeatTime, after an initial delay of thresholdTime.

See also:
triggerAction(), and repeatAction().


setSingleStep

public final void setSingleStep(int arg__1)
This property holds the single step. The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.

See also:
pageStep.


setSliderDown

public final void setSliderDown(boolean arg__1)
This property holds whether the slider is pressed down. The property is set by subclasses in order to let the abstract slider know whether or not tracking has any effect.

Changing the slider down property emits the sliderPressed() and sliderReleased() signals.


setSliderPosition

public final void setSliderPosition(int arg__1)
This property holds the current slider position. If tracking is enabled (the default), this is identical to value.


setTracking

public final void setTracking(boolean enable)
This property holds whether slider tracking is enabled. If tracking is enabled (the default), the slider emits the valueChanged() signal while the slider is being dragged. If tracking is disabled, the slider emits the valueChanged() signal only when the user releases the slider.

See also:
sliderDown.


setValue

public final void setValue(int arg__1)
This property holds the slider's current value. The slider forces the value to be within the legal range: minimum <= value <= maximum.

Changing the value also changes the sliderPosition.


singleStep

public final int singleStep()
This property holds the single step. The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.

See also:
pageStep.


sliderPosition

public final int sliderPosition()
This property holds the current slider position. If tracking is enabled (the default), this is identical to value.


triggerAction

public final void triggerAction(QAbstractSlider.SliderAction action)
Triggers a slider action. Possible actions are SliderSingleStepAdd , SliderSingleStepSub , SliderPageStepAdd , SliderPageStepSub , SliderToMinimum , SliderToMaximum , and SliderMove .

See also:
actionTriggered() .


value

public final int value()
This property holds the slider's current value. The slider forces the value to be within the legal range: minimum <= value <= maximum.

Changing the value also changes the sliderPosition.


sliderChange

protected void sliderChange(QAbstractSlider.SliderChange change)
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.