QDial

Section: Misc. Reference Manual Pages (3qt)
Updated: 2 February 2007
Index Return to Main Contents
 

NAME

QDial - Rounded range control (like a speedometer or potentiometer)  

SYNOPSIS

#include <qdial.h>

Inherits QWidget and QRangeControl.

 

Public Members


QDial ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )

QDial ( int minValue, int maxValue, int pageStep, int value, QWidget * parent = 0, const char * name = 0 )

~QDial ()

bool tracking () const

bool wrapping () const

int notchSize () const

virtual void setNotchTarget ( double )

double notchTarget () const

bool notchesVisible () const

int minValue () const

int maxValue () const

void setMinValue ( int )

void setMaxValue ( int )

int lineStep () const

int pageStep () const

void setLineStep ( int )

void setPageStep ( int )

int value () const
 

Public Slots


virtual void setValue ( int )

void addLine ()

void subtractLine ()

void addPage ()

void subtractPage ()

virtual void setNotchesVisible ( bool b )

virtual void setWrapping ( bool on )

virtual void setTracking ( bool enable )
 

Signals


void valueChanged ( int value )

void dialPressed ()

void dialMoved ( int value )

void dialReleased ()
 

Properties


int lineStep - the current line step

int maxValue - the current maximum value

int minValue - the current minimum value

int notchSize - the current notch size (read only)

double notchTarget - the target number of pixels between notches

bool notchesVisible - whether the notches are shown

int pageStep - the current page step

bool tracking - whether tracking is enabled

int value - the current dial value

bool wrapping - whether wrapping is enabled
 

Protected Members


virtual void valueChange ()

virtual void rangeChange ()

virtual void repaintScreen ( const QRect * cr = 0 )
 

DESCRIPTION

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 (typically, 0..359 degrees) or the dialog layout needs a square widget.

Both API- and UI-wise, the dial is very similar to a slider. Indeed, when wrapping() is FALSE (the default) there is no real difference between a slider and a dial. They have the same signals, slots and member functions, all of which do the same things. Which one you use depends only on your taste and on the application.

The dial initially emits valueChanged() signals continuously while the slider is being moved; you can make it emit the signal less often by calling setTracking(FALSE). dialMoved() is emitted continuously even when tracking() is FALSE.

The slider also emits dialPressed() and dialReleased() signals when the mouse button is pressed and released. But note that the dial's value can change without these signals being emitted; the keyboard and wheel can be used to change the value.

Unlike the slider, QDial attempts to draw a "nice" number of notches rather than one per lineStep(). If possible, the number of notches drawn is one per lineStep(), but if there aren't enough pixels to draw every one, QDial will draw every second, third etc., notch. notchSize() returns the number of units per notch, hopefully a multiple of lineStep(); setNotchTarget() sets the target distance between neighbouring notches in pixels. The default is 3.75 pixels.

Like the slider, the dial makes the QRangeControl 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 move by lineStep(), page up and page down by pageStep() and Home and End to minValue() and maxValue().

[Image Omitted]

[Image Omitted]

See also QScrollBar, QSpinBox, GUI Design Handbook: Slider, and Basic Widgets.  

MEMBER FUNCTION DOCUMENTATION

 

QDial::QDial ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )

Constructs a dial called name with parent parent. f is propagated to the QWidget constructor. It has the default range of a QRangeControl.  

QDial::QDial ( int minValue, int maxValue, int pageStep, int value, QWidget * parent = 0, const char * name = 0 )

Constructs a dial called name with parent parent. The dial's value can never be smaller than minValue or greater than maxValue. Its page step size is pageStep, and its initial value is value.

value is forced to be within the legal range.  

QDial::~QDial ()

Destroys the dial.  

void QDial::addLine () [slot]

Increments the dial's value() by one lineStep().  

void QDial::addPage () [slot]

Increments the dial's value() by one pageStep() of steps.  

void QDial::dialMoved ( int value ) [signal]

This signal is emitted whenever the dial value changes. The frequency of this signal is not influenced by setTracking().

See also valueChanged().  

void QDial::dialPressed () [signal]

This signal is emitted when the user begins mouse interaction with the dial.

See also dialReleased().  

void QDial::dialReleased () [signal]

This signal is emitted when the user ends mouse interaction with the dial.

See also dialPressed().  

int QDial::lineStep () const

Returns the current line step. See the "lineStep" property for details.  

int QDial::maxValue () const

Returns the current maximum value. See the "maxValue" property for details.  

int QDial::minValue () const

Returns the current minimum value. See the "minValue" property for details.  

int QDial::notchSize () const

Returns the current notch size. See the "notchSize" property for details.  

double QDial::notchTarget () const

Returns the target number of pixels between notches. See the "notchTarget" property for details.  

bool QDial::notchesVisible () const

Returns TRUE if the notches are shown; otherwise returns FALSE. See the "notchesVisible" property for details.  

int QDial::pageStep () const

Returns the current page step. See the "pageStep" property for details.  

void QDial::rangeChange () [virtual protected]

Reimplemented to ensure tick-marks are consistent with the new range.

Reimplemented from QRangeControl.  

void QDial::repaintScreen ( const QRect * cr = 0 ) [virtual protected]

Paints the dial using clip region cr.  

void QDial::setLineStep ( int )

Sets the current line step. See the "lineStep" property for details.  

void QDial::setMaxValue ( int )

Sets the current maximum value. See the "maxValue" property for details.  

void QDial::setMinValue ( int )

Sets the current minimum value. See the "minValue" property for details.  

void QDial::setNotchTarget ( double ) [virtual]

Sets the target number of pixels between notches. See the "notchTarget" property for details.  

void QDial::setNotchesVisible ( bool b ) [virtual slot]

Sets whether the notches are shown to b. See the "notchesVisible" property for details.  

void QDial::setPageStep ( int )

Sets the current page step. See the "pageStep" property for details.  

void QDial::setTracking ( bool enable ) [virtual slot]

Sets whether tracking is enabled to enable. See the "tracking" property for details.  

void QDial::setValue ( int ) [virtual slot]

Sets the current dial value. See the "value" property for details.  

void QDial::setWrapping ( bool on ) [virtual slot]

Sets whether wrapping is enabled to on. See the "wrapping" property for details.  

void QDial::subtractLine () [slot]

Decrements the dial's value() by one lineStep().  

void QDial::subtractPage () [slot]

Decrements the dial's value() by one pageStep() of steps.  

bool QDial::tracking () const

Returns TRUE if tracking is enabled; otherwise returns FALSE. See the "tracking" property for details.  

int QDial::value () const

Returns the current dial value. See the "value" property for details.  

void QDial::valueChange () [virtual protected]

Reimplemented to ensure the display is correct and to emit the valueChanged(int) signal when appropriate.

Reimplemented from QRangeControl.  

void QDial::valueChanged ( int value ) [signal]

This signal is emitted whenever the dial's value changes. The frequency of this signal is influenced by setTracking().  

bool QDial::wrapping () const

Returns TRUE if wrapping is enabled; otherwise returns FALSE. See the "wrapping" property for details.  

Property Documentation

 

int lineStep

This property holds the current line step.

setLineStep() calls the virtual stepChange() function if the new line step is different from the previous setting.

See also QRangeControl::setSteps(), pageStep, and setRange().

Set this property's value with setLineStep() and get this property's value with lineStep().  

int maxValue

This property holds the current maximum value.

When setting this property, the QDial::minValue is adjusted if necessary to ensure that the range remains valid.

See also setRange().

Set this property's value with setMaxValue() and get this property's value with maxValue().  

int minValue

This property holds the current minimum value.

When setting this property, the QDial::maxValue is adjusted if necessary to ensure that the range remains valid.

See also setRange().

Set this property's value with setMinValue() and get this property's value with minValue().  

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 lineStep() that results in an on-screen notch size near notchTarget().

See also notchTarget and lineStep.

Get this property's value with notchSize().  

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.

Set this property's value with setNotchTarget() and get this property's value with notchTarget().  

bool notchesVisible

This property holds whether the notches are shown.

If TRUE, the notches are shown. If FALSE (the default) notches are not shown.

Set this property's value with setNotchesVisible() and get this property's value with notchesVisible().  

int pageStep

This property holds the current page step.

setPageStep() calls the virtual stepChange() function if the new page step is different from the previous setting.

See also stepChange().

Set this property's value with setPageStep() and get this property's value with pageStep().  

bool tracking

This property holds whether tracking is enabled.

If TRUE (the default), tracking is enabled. This means that the arrow can be moved using the mouse; otherwise the arrow cannot be moved with the mouse.

Set this property's value with setTracking() and get this property's value with tracking().  

int value

This property holds the current dial value.

This is guaranteed to be within the range QDial::minValue..QDial::maxValue.

See also minValue and maxValue.

Set this property's value with setValue() and get this property's value with value().  

bool wrapping

This property holds whether wrapping is enabled.

If TRUE, wrapping is enabled. This means that the arrow can be turned around 360°. Otherwise there is some space at the bottom of the dial which is skipped by the arrow.

This property's default is FALSE.

Set this property's value with setWrapping() and get this property's value with wrapping().

 

SEE ALSO

http://doc.trolltech.com/qdial.html http://www.trolltech.com/faq/tech.html  

COPYRIGHT

Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.  

AUTHOR

Generated automatically from the source code.  

BUGS

If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qdial.3qt) and the Qt version (3.3.8).