|
|||||||||
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
com.trolltech.qt.gui.QDial
public class QDial
The QDial class provides a rounded range control (like a speedometer or potentiometer).
QDial is used when the user needs to control a value within a program-definable range, and the range either wraps around (for example, with angles measured from 0 to 359 degrees) or the dialog layout needs a square widget.
Since QDial inherits from QAbstractSlider, the dial behaves in a similar way to a slider. When wrapping is false (the default setting) there is no real difference between a slider and a dial. They both share the same signals, slots and member functions. Which one you use depends on the expectations of your users and on the type of application.
The dial initially emits valueChanged signals continuously while the slider is being moved; you can make it emit the signal less often by disabling the tracking property. The sliderMoved signal is emitted continuously even when tracking is disabled.
The dial also emits sliderPressed and sliderReleased signals when the mouse button is pressed and released. Note that the dial's value can change without these signals being emitted since the keyboard and wheel can also be used to change the value.
Unlike the slider, QDial attempts to draw a "nice" number of notches rather than one per line step. If possible, the number of notches drawn is one per line step, but if there aren't enough pixels to draw every one, QDial will skip notches to try and draw a uniform set (e.g. by drawing every second or third notch).
Like the slider, the dial makes the QAbstractSlider functions setValue, addLine(), subtractLine(), addPage() and subtractPage() available as slots.
The dial's keyboard interface is fairly simple: The left/up and right/down arrow keys adjust the dial's value by the defined singleStep, Page Up and Page Down by the defined pageStep, and the Home and End keys set the value to the defined minimum and maximum values.
![]() | ![]() | ![]() |
Dials shown in various widget styles (from left to right): Plastique, Windows XP, Macintosh. |
Example
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QAbstractSlider |
---|
QAbstractSlider.SliderAction, 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 |
---|
Fields inherited from class com.trolltech.qt.gui.QAbstractSlider |
---|
actionTriggered, rangeChanged, sliderMoved, sliderPressed, sliderReleased, valueChanged |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QDial()
Equivalent to QDial(0). |
|
QDial(QWidget parent)
Constructs a dial. |
Method Summary | |
---|---|
boolean |
event(QEvent e)
This function is reimplemented for internal reasons. |
static QDial |
fromNativePointer(QNativePointer nativePointer)
This function returns the QDial instance pointed to by nativePointer |
protected void |
initStyleOption(QStyleOptionSlider option)
Initialize option with the values from this QDial. |
QSize |
minimumSizeHint()
This function is reimplemented for internal reasons. |
protected void |
mouseMoveEvent(QMouseEvent me)
This function is reimplemented for internal reasons. |
protected void |
mousePressEvent(QMouseEvent me)
This function is reimplemented for internal reasons. |
protected void |
mouseReleaseEvent(QMouseEvent me)
This function is reimplemented for internal reasons. |
boolean |
notchesVisible()
Returns whether the notches are shown. |
int |
notchSize()
Returns the current notch size. |
double |
notchTarget()
Returns the target number of pixels between notches. |
protected void |
paintEvent(QPaintEvent pe)
This function is reimplemented for internal reasons. |
protected void |
resizeEvent(QResizeEvent re)
This function is reimplemented for internal reasons. |
void |
setNotchesVisible(boolean visible)
Sets whether the notches are shown to visible. |
void |
setNotchTarget(double target)
Sets the target number of pixels between notches to target. |
void |
setWrapping(boolean on)
Sets whether wrapping is enabled to on. |
QSize |
sizeHint()
This function is reimplemented for internal reasons. |
protected void |
sliderChange(QAbstractSlider.SliderChange change)
Reimplement this virtual function to track slider changes such as SliderRangeChange, SliderOrientationChange, SliderStepsChange, or SliderValueChange. |
boolean |
wrapping()
Returns whether wrapping is enabled. |
Methods inherited from class com.trolltech.qt.gui.QAbstractSlider |
---|
changeEvent, hasTracking, invertedAppearance, invertedControls, isSliderDown, keyPressEvent, maximum, minimum, orientation, pageStep, repeatAction, setInvertedAppearance, setInvertedControls, setMaximum, setMinimum, setOrientation, setPageStep, setRange, setRepeatAction, setRepeatAction, setRepeatAction, setSingleStep, setSliderDown, setSliderPosition, setTracking, setValue, singleStep, sliderPosition, timerEvent, triggerAction, value, wheelEvent |
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 |
Constructor Detail |
---|
public QDial()
Equivalent to QDial(0).
public QDial(QWidget parent)
Constructs a dial.
The parent argument is sent to the QAbstractSlider constructor.
Method Detail |
---|
public final int notchSize()
Returns the current notch size.
The notch size is in range control units, not pixels, and if possible it is a multiple of singleStep that results in an on-screen notch size near notchTarget.
public final double notchTarget()
Returns the target number of pixels between notches.
The notch target is the number of pixels QDial attempts to put between each notch.
The actual size may differ from the target size.
The default notch target is 3.7 pixels.
public final boolean notchesVisible()
Returns whether the notches are shown.
If the property is true, a series of notches are drawn around the dial to indicate the range of values available; otherwise no notches are shown.
By default, this property is disabled.
public final void setNotchTarget(double target)
Sets the target number of pixels between notches to target.
The notch target is the number of pixels QDial attempts to put between each notch.
The actual size may differ from the target size.
The default notch target is 3.7 pixels.
public final void setNotchesVisible(boolean visible)
Sets whether the notches are shown to visible.
If the property is true, a series of notches are drawn around the dial to indicate the range of values available; otherwise no notches are shown.
By default, this property is disabled.
public final void setWrapping(boolean on)
Sets whether wrapping is enabled to on.
If true, wrapping is enabled; otherwise some space is inserted at the bottom of the dial to separate the ends of the range of valid values.
If enabled, the arrow can be oriented at any angle on the dial. If disabled, the arrow will be restricted to the upper part of the dial; if it is rotated into the space at the bottom of the dial, it will be clamped to the closest end of the valid range of values.
By default this property is false.
public final boolean wrapping()
Returns whether wrapping is enabled.
If true, wrapping is enabled; otherwise some space is inserted at the bottom of the dial to separate the ends of the range of valid values.
If enabled, the arrow can be oriented at any angle on the dial. If disabled, the arrow will be restricted to the upper part of the dial; if it is rotated into the space at the bottom of the dial, it will be clamped to the closest end of the valid range of values.
By default this property is false.
public boolean event(QEvent e)
This function is reimplemented for internal reasons.
event
in class QAbstractSlider
public QSize minimumSizeHint()
This function is reimplemented for internal reasons.
minimumSizeHint
in class QWidget
protected void mouseMoveEvent(QMouseEvent me)
This function is reimplemented for internal reasons.
mouseMoveEvent
in class QWidget
Example
protected void mousePressEvent(QMouseEvent me)
This function is reimplemented for internal reasons.
mousePressEvent
in class QWidget
Example
protected void mouseReleaseEvent(QMouseEvent me)
This function is reimplemented for internal reasons.
mouseReleaseEvent
in class QWidget
Example
protected void paintEvent(QPaintEvent pe)
This function is reimplemented for internal reasons.
paintEvent
in class QWidget
protected void resizeEvent(QResizeEvent re)
This function is reimplemented for internal reasons.
resizeEvent
in class QWidget
Example
public QSize sizeHint()
This function is reimplemented for internal reasons.
sizeHint
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.
sliderChange
in class QAbstractSlider
public static QDial fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.protected final void initStyleOption(QStyleOptionSlider option)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |