|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QAbstractSlider
public class QAbstractSlider
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:
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.
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.AbstractSignal, 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.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 |
---|
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.
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.
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.
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.
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.
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.
Constructor Detail |
---|
public QAbstractSlider()
Equivalent to QAbstractSlider(0).
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 |
---|
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.
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.
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.
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.
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.
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.
public final Qt.Orientation orientation()
Returns the orientation of the slider.
The orientation must be Qt::Vertical (the default) or Qt::Horizontal.
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.
protected final QAbstractSlider.SliderAction repeatAction()
Returns the current repeat action.
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.
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.
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.
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.
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.
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.
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.
protected final void setRepeatAction(QAbstractSlider.SliderAction action, int thresholdTime)
Equivalent to setRepeatAction(action, thresholdTime, 50).
protected final void setRepeatAction(QAbstractSlider.SliderAction action)
Equivalent to setRepeatAction(action, 500, 50).
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.
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.
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.
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.
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.
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.
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.
public final int sliderPosition()
Returns the current slider position.
If tracking is enabled (the default), this is identical to value.
public final void triggerAction(QAbstractSlider.SliderAction action)
Triggers a slider action. Possible actions are SliderSingleStepAdd, SliderSingleStepSub, SliderPageStepAdd, SliderPageStepSub, SliderToMinimum, SliderToMaximum, and SliderMove.
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.
protected void changeEvent(QEvent e)
This function is reimplemented for internal reasons.
changeEvent
in class QWidget
public boolean event(QEvent e)
This function is reimplemented for internal reasons.
event
in class QWidget
protected void keyPressEvent(QKeyEvent ev)
This function is reimplemented for internal reasons.
keyPressEvent
in class QWidget
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.
protected void timerEvent(QTimerEvent arg__1)
This function is reimplemented for internal reasons.
timerEvent
in class QObject
protected void wheelEvent(QWheelEvent e)
This function is reimplemented for internal reasons.
wheelEvent
in class QWidget
public static QAbstractSlider fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |