com.trolltech.qt.gui
Class QAbstractSlider

java.lang.Object
  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:

SignalEmitted when
valueChangedthe value has changed. The tracking determines whether this signal is emitted during user interaction.
sliderPressedthe user starts to drag the slider.
sliderMovedthe user drags the slider.
sliderReleasedthe user releases the slider.
actionTriggereda slider action was triggerd.
rangeChangeda 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, Example

Nested Class Summary
static class QAbstractSlider.SliderAction
          Press link for info on QAbstractSlider.SliderAction
static class QAbstractSlider.SliderChange
          Press link for info on 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.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Field Summary
 QSignalEmitter.Signal1<java.lang.Integer> actionTriggered
          This signal is emitted when the slider action action is triggered.
 QSignalEmitter.Signal2<java.lang.Integer,java.lang.Integer> rangeChanged
          This signal is emitted when the slider range has changed, with min being the new minimum, and max being the new maximum.
 QSignalEmitter.Signal1<java.lang.Integer> sliderMoved
          This signal is emitted when sliderDown is true and the slider moves.
 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<java.lang.Integer> valueChanged
          This signal is emitted when the slider value has changed, with the new slider value as argument.
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Constructor Summary
QAbstractSlider()
          Equivalent to QAbstractSlider(0).
QAbstractSlider(QWidget parent)
          Constructs an abstract slider.
 
Method Summary
protected  void changeEvent(QEvent e)
          This function is reimplemented for internal reasons.
 boolean event(QEvent e)
          This function is reimplemented for internal reasons.
static QAbstractSlider fromNativePointer(QNativePointer nativePointer)
          This function returns the QAbstractSlider instance pointed to by nativePointer
 boolean hasTracking()
          Returns whether slider tracking is enabled.
 boolean invertedAppearance()
          Returns whether or not a slider shows its values inverted..
 boolean invertedControls()
          Returns whether or not the slider inverts its wheel and key events..
 boolean isSliderDown()
          Returns whether the slider is pressed down..
protected  void keyPressEvent(QKeyEvent ev)
          This function is reimplemented for internal reasons.
 int maximum()
          Returns the slider's maximum value.
 int minimum()
          Returns the sliders's minimum value.
 Qt.Orientation orientation()
          Returns the orientation of the slider.
 int pageStep()
          Returns the page step..
protected  QAbstractSlider.SliderAction repeatAction()
          Returns the current repeat action.
 void setInvertedAppearance(boolean arg__1)
          Sets whether or not a slider shows its values inverted.
 void setInvertedControls(boolean arg__1)
          Sets whether or not the slider inverts its wheel and key events.
 void setMaximum(int arg__1)
          Sets the slider's maximum value to arg__1.
 void setMinimum(int arg__1)
          Sets the sliders's minimum value to arg__1.
 void setOrientation(Qt.Orientation arg__1)
          Sets the orientation of the slider to arg__1.
 void setPageStep(int arg__1)
          Sets 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)
          Equivalent to setRepeatAction(action, 500, 50).
protected  void setRepeatAction(QAbstractSlider.SliderAction action, int thresholdTime)
          Equivalent to setRepeatAction(action, thresholdTime, 50).
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)
          Sets the single step.
 void setSliderDown(boolean arg__1)
          Sets whether the slider is pressed down.
 void setSliderPosition(int arg__1)
          Sets the current slider position to arg__1.
 void setTracking(boolean enable)
          Sets whether slider tracking is enabled to enable.
 void setValue(int arg__1)
          Sets the slider's current value to arg__1.
 int singleStep()
          Returns 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()
          Returns the current slider position.
protected  void timerEvent(QTimerEvent arg__1)
          This function is reimplemented for internal reasons.
 void triggerAction(QAbstractSlider.SliderAction action)
          Triggers a slider action.
 int value()
          Returns the slider's current value.
protected  void wheelEvent(QWheelEvent e)
          This function is reimplemented for internal reasons.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyReleaseEvent, 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, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, 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, 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, width, widthMM, window, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

actionTriggered

public final QSignalEmitter.Signal1<java.lang.Integer> actionTriggered

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.

Compatible Slot Signatures:
void mySlot(int action)
void mySlot()
See Also:
triggerAction


rangeChanged

public final QSignalEmitter.Signal2<java.lang.Integer,java.lang.Integer> rangeChanged

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

Compatible Slot Signatures:
void mySlot(int min, int max)
void mySlot(int min)
void mySlot()
See Also:
minimum, maximum


sliderMoved

public final QSignalEmitter.Signal1<java.lang.Integer> sliderMoved

This signal is emitted when sliderDown is true and the slider moves. This usually happens when the user is dragging the slider. The position is the new slider position.

This signal is emitted even when tracking is turned off.

Compatible Slot Signatures:
void mySlot(int position)
void mySlot()
See Also:
setTracking, valueChanged, isSliderDown, sliderPressed, 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.

Compatible Slot Signature:
void mySlot()
See Also:
sliderReleased, sliderMoved, 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.

Compatible Slot Signature:
void mySlot()
See Also:
sliderPressed, sliderMoved, sliderDown


valueChanged

public final QSignalEmitter.Signal1<java.lang.Integer> valueChanged

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

Compatible Slot Signatures:
void mySlot(int value)
void mySlot()

Constructor Detail

QAbstractSlider

public QAbstractSlider()

Equivalent to QAbstractSlider(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()

Returns 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()

Returns 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.

See Also:
setInvertedAppearance

invertedControls

public final boolean invertedControls()

Returns 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.

See Also:
setInvertedControls

isSliderDown

public final boolean isSliderDown()

Returns 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()

Returns 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.

See Also:
setMaximum

minimum

public final int minimum()

Returns 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.

See Also:
setMinimum

orientation

public final Qt.Orientation orientation()

Returns the orientation of the slider.

The orientation must be Qt::Vertical (the default) or Qt::Horizontal.

See Also:
setOrientation

pageStep

public final int pageStep()

Returns 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:
setPageStep, singleStep

repeatAction

protected final QAbstractSlider.SliderAction repeatAction()

Returns the current repeat action.

See Also:
setRepeatAction

setInvertedAppearance

public final void setInvertedAppearance(boolean arg__1)

Sets whether or not a slider shows its values inverted. to arg__1.

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.

See Also:
invertedAppearance

setInvertedControls

public final void setInvertedControls(boolean arg__1)

Sets whether or not the slider inverts its wheel and key events. to arg__1.

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.

See Also:
invertedControls

setMaximum

public final void setMaximum(int arg__1)

Sets the slider's maximum value to arg__1.

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.

See Also:
maximum

setMinimum

public final void setMinimum(int arg__1)

Sets the sliders's minimum value to arg__1.

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.

See Also:
minimum

setOrientation

public final void setOrientation(Qt.Orientation arg__1)

Sets the orientation of the slider to arg__1.

The orientation must be Qt::Vertical (the default) or Qt::Horizontal.

See Also:
orientation

setPageStep

public final void setPageStep(int arg__1)

Sets the page step. to arg__1.

The larger of two natural steps that an abstract slider provides and typically corresponds to the user pressing PageUp or PageDown.

See Also:
pageStep, 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, maximum

setRepeatAction

protected final void setRepeatAction(QAbstractSlider.SliderAction action,
                                     int thresholdTime)

Equivalent to setRepeatAction(action, thresholdTime, 50).


setRepeatAction

protected final void setRepeatAction(QAbstractSlider.SliderAction action)

Equivalent to setRepeatAction(action, 500, 50).


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, repeatAction

setSingleStep

public final void setSingleStep(int arg__1)

Sets the single step. to arg__1.

The smaller of two natural steps that an abstract sliders provides and typically corresponds to the user pressing an arrow key.

See Also:
singleStep, pageStep

setSliderDown

public final void setSliderDown(boolean arg__1)

Sets whether the slider is pressed down. to arg__1.

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.

See Also:
isSliderDown

setSliderPosition

public final void setSliderPosition(int arg__1)

Sets the current slider position to arg__1.

If tracking is enabled (the default), this is identical to value.

See Also:
sliderPosition

setTracking

public final void setTracking(boolean enable)

Sets whether slider tracking is enabled to enable.

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:
hasTracking, sliderDown

setValue

public final void setValue(int arg__1)

Sets the slider's current value to arg__1.

The slider forces the value to be within the legal range: minimum <= value <= maximum.

Changing the value also changes the sliderPosition.

See Also:
value

singleStep

public final int singleStep()

Returns 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:
setSingleStep, pageStep

sliderPosition

public final int sliderPosition()

Returns the current slider position.

If tracking is enabled (the default), this is identical to value.

See Also:
setSliderPosition

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()

Returns 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.

See Also:
setValue

changeEvent

protected void changeEvent(QEvent e)

This function is reimplemented for internal reasons.

Overrides:
changeEvent in class QWidget

event

public boolean event(QEvent e)

This function is reimplemented for internal reasons.

Overrides:
event in class QWidget
See Also:
closeEvent, focusInEvent, focusOutEvent, enterEvent, keyPressEvent, keyReleaseEvent, leaveEvent, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, moveEvent, paintEvent, resizeEvent, QObject::event, QObject::timerEvent

keyPressEvent

protected void keyPressEvent(QKeyEvent ev)

This function is reimplemented for internal reasons.

Overrides:
keyPressEvent in class QWidget
See Also:
keyReleaseEvent, QKeyEvent::ignore, setFocusPolicy, focusInEvent, focusOutEvent, event, QKeyEvent, Tetrix Example

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.


timerEvent

protected void timerEvent(QTimerEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
timerEvent in class QObject
See Also:
startTimer, killTimer, event

wheelEvent

protected void wheelEvent(QWheelEvent e)

This function is reimplemented for internal reasons.

Overrides:
wheelEvent in class QWidget
See Also:
QWheelEvent::ignore, QWheelEvent::accept, event, QWheelEvent

fromNativePointer

public static QAbstractSlider fromNativePointer(QNativePointer nativePointer)
This function returns the QAbstractSlider instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.