com.trolltech.qt.gui
Class QDial

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
                          extended by com.trolltech.qt.gui.QDial
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QDial
extends QAbstractSlider

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.

If you are using the mouse wheel to adjust the dial, the increment value is determined by the lesser value of wheelScrollLines multipled by singleStep, and pageStep.







Dials shown in various widget styles (from left to right): Plastique, Windows XP, Macintosh.

See also:
QScrollBar, QSpinBox, QSlider, GUI Design Handbook: Slider, and Sliders 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.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
 
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
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QDial()
          Constructs a dial.
QDial(QWidget parent)
          Constructs a dial.
 
Method Summary
protected  void initStyleOption(QStyleOptionSlider option)
          Initialize option with the values from this QDial.
 boolean notchesVisible()
          This property holds whether the notches are shown.
 int notchSize()
          This property holds the current notch size.
 double notchTarget()
          This property holds the target number of pixels between notches.
 void setNotchesVisible(boolean visible)
          This property holds whether the notches are shown.
 void setNotchTarget(double target)
          This property holds the target number of pixels between notches.
 void setWrapping(boolean on)
          This property holds whether wrapping is enabled.
 boolean wrapping()
          This property holds whether wrapping is enabled.
 
Methods inherited from class com.trolltech.qt.gui.QAbstractSlider
hasTracking, invertedAppearance, invertedControls, isSliderDown, maximum, minimum, orientation, pageStep, repeatAction, setInvertedAppearance, setInvertedControls, setMaximum, setMinimum, setOrientation, setPageStep, setRange, setRepeatAction, setRepeatAction, setRepeatAction, setSingleStep, setSliderDown, setSliderPosition, setTracking, setValue, singleStep, sliderChange, sliderPosition, triggerAction, 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
 

Constructor Detail

QDial

public QDial()
Constructs a dial.

The parent argument is sent to the QAbstractSlider constructor.


QDial

public QDial(QWidget parent)
Constructs a dial.

The parent argument is sent to the QAbstractSlider constructor.

Method Detail

notchSize

public final int notchSize()
This property holds 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().

By default, this property has a value of 1.

See also:
notchTarget(), and singleStep().


notchTarget

public final double notchTarget()
This property holds 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.


notchesVisible

public final boolean notchesVisible()
This property holds 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.


setNotchTarget

public final void setNotchTarget(double target)
This property holds 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.


setNotchesVisible

public final void setNotchesVisible(boolean visible)
This property holds 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.


setWrapping

public final void setWrapping(boolean on)
This property holds 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.


wrapping

public final boolean wrapping()
This property holds 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.


initStyleOption

protected final void initStyleOption(QStyleOptionSlider option)
Initialize option with the values from this QDial. This method is useful for subclasses when they need a QStyleOptionSlider, but don't want to fill in all the information themselves.