Classes - Annotated - Tree - Functions - Home - Structure

QDial Class Reference

The QDial class provides a rounded range control (like a speedometer or potentiometer). More...

#include <qdial.h>

Inherits QWidget and QRangeControl.

List of all member functions.

Public Members

Public Slots

Signals

Properties

Protected Members


Detailed 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 like a slider. Indeed, when wrapping() is FALSE (the default) there is no hard 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 to 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, that number is lineStep(), but if there aren't enough pixels to draw every, QDial will draw every second, third or something. 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(), substractLine(), 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().

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


Member Function Documentation

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

Constructs a dial with the default range of QRangeControl.

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

Constructs a dial whose value can never be smaller than minValue or greater than maxValue, whose page step size is pageStep, and whose value is initially value.

value is forced to be within the legal range.

QDial::~QDial ()

Destroys the dial.

void QDial::addLine () [slot]

Moves the dial one lineStep() upwards.

void QDial::addPage () [slot]

Moves the dial one pageStep() upwards.

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

void QDial::dialPressed () [signal]

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

See also dialReleased().

void QDial::dialReleased () [signal]

This signal is emitted when the use 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 size of the notch. See the "notchTarget" property for details.

bool QDial::notchesVisible () const

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

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 size of the notch. 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 wether 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]

Moves the dial one lineStep() downwards.

void QDial::subtractPage () [slot]

Moves the dial one pageStep() downwards.

bool QDial::tracking () const

Returns wether tracking is enabled. 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 value changes. The frequency of this signal is influenced by setTracking().

bool QDial::wrapping () const

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

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

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

int maxValue

This property holds the current maximum value.

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

See also setRange().

int minValue

This property holds the current minimum value.

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

See also setRange().

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

Get this property's value with notchSize().

See also notchTarget and lineStep.

double notchTarget

This property holds the target size of the notch.

The notch target is the number of pixels QDial attempts to put between each little line.

The actual size differs a bit from the target.

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.

Enables or disables showing of notches. If TRUE, the notches are shown, else not.

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.

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

See also stepChange().

bool tracking

This property holds wether tracking is enabled.

If TRUE, tracking is enabled. This means that the arrow can be moved using the mouse. Otherwise this is not possible, the default is TRUE.

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 [minValue ... maxValue].

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

See also minValue and maxValue.

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 which is skipped by the arrow.

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


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.


Copyright © 2000 TrolltechTrademarks
Qt version main-beta1