Eneboo - Documentación para desarrolladores
Slots públicos | Señales | Métodos públicos | Métodos protegidos | Propiedades
Referencia de la Clase QDial

The QDial class provides a rounded range control (like a speedometer or potentiometer). Más...

#include <qdial.h>

Diagrama de herencias de QDial
QWidget QRangeControl QWidget QRangeControl QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject

Lista de todos los miembros.

Slots públicos

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

Señales

void valueChanged (int value)
void dialPressed ()
void dialMoved (int value)
void dialReleased ()
void valueChanged (int value)
void dialPressed ()
void dialMoved (int value)
void dialReleased ()

Métodos públicos

 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
QSize sizeHint () const
QSize minimumSizeHint () 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
 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
QSize sizeHint () const
QSize minimumSizeHint () 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

Métodos protegidos

void resizeEvent (QResizeEvent *)
void paintEvent (QPaintEvent *)
void keyPressEvent (QKeyEvent *)
void mousePressEvent (QMouseEvent *)
void mouseReleaseEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
void wheelEvent (QWheelEvent *)
void focusInEvent (QFocusEvent *)
void focusOutEvent (QFocusEvent *)
void valueChange ()
void rangeChange ()
virtual void repaintScreen (const QRect *cr=0)
void resizeEvent (QResizeEvent *)
void paintEvent (QPaintEvent *)
void keyPressEvent (QKeyEvent *)
void mousePressEvent (QMouseEvent *)
void mouseReleaseEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
void wheelEvent (QWheelEvent *)
void focusInEvent (QFocusEvent *)
void focusOutEvent (QFocusEvent *)
void valueChange ()
void rangeChange ()
virtual void repaintScreen (const QRect *cr=0)

Propiedades

bool tracking
 whether tracking is enabled
bool wrapping
 whether wrapping is enabled
int notchSize
 the current notch size
double notchTarget
 the target number of pixels between notches
bool notchesVisible
 whether the notches are shown
int minValue
 the current minimum value
int maxValue
 the current maximum value
int lineStep
 the current line step
int pageStep
 the current page step
int value
 the current dial value

Descripción detallada

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

qdial-m.png
qdial-w.png
Ver también:
QScrollBar QSpinBox GUI Design Handbook: Slider

Documentación del constructor y destructor

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.

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

Documentación de las funciones miembro

void QDial::addLine ( ) [slot]

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

Reimplementado de QRangeControl.

void QDial::addLine ( ) [slot]

Equivalent to {setValue( value() + lineStep() )}.

If the value is changed, then valueChange() is called.

Ver también:
subtractLine() addPage() setValue()

Reimplementado de QRangeControl.

void QDial::addPage ( ) [slot]

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

Reimplementado de QRangeControl.

void QDial::addPage ( ) [slot]

Equivalent to {setValue( value() + pageStep() )}.

If the value is changed, then valueChange() is called.

Ver también:
subtractPage() addLine() setValue()

Reimplementado de QRangeControl.

void QDial::dialMoved ( int  value) [signal]
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().

Ver también:
valueChanged()
void QDial::dialPressed ( ) [signal]
void QDial::dialPressed ( ) [signal]

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

Ver también:
dialReleased()
void QDial::dialReleased ( ) [signal]
void QDial::dialReleased ( ) [signal]

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

Ver también:
dialPressed()
void QDial::focusInEvent ( QFocusEvent ) [protected, virtual]

Reimplementado de QWidget.

void QDial::focusInEvent ( QFocusEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive keyboard focus events (focus received) for the widget.

A widget normally must setFocusPolicy() to something other than NoFocus in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)

The default implementation updates the widget (except for toplevel widgets that do not specify a focusPolicy() ). It also calls setMicroFocusHint(), hinting any system-specific input tools about the focus of the user's attention.

Ver también:
focusOutEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event(), QFocusEvent

Reimplementado de QWidget.

void QDial::focusOutEvent ( QFocusEvent ) [protected, virtual]

Reimplementado de QWidget.

void QDial::focusOutEvent ( QFocusEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive keyboard focus events (focus lost) for the widget.

A widget normally must setFocusPolicy() to something other than NoFocus in order to receive focus events. (Note that the application programmer can call setFocus() on any widget, even those that do not normally accept focus.)

The default implementation updates the widget (except for toplevel widgets that do not specify a focusPolicy() ). It also calls setMicroFocusHint(), hinting any system-specific input tools about the focus of the user's attention.

Ver también:
focusInEvent(), setFocusPolicy(), keyPressEvent(), keyReleaseEvent(), event(), QFocusEvent

Reimplementado de QWidget.

void QDial::keyPressEvent ( QKeyEvent e) [protected, virtual]

Reimplementado de QWidget.

void QDial::keyPressEvent ( QKeyEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive key press events for the widget.

A widget must call setFocusPolicy() to accept focus initially and have focus in order to receive a key press event.

If you reimplement this handler, it is very important that you explicitly ignore the event if you do not understand it, so that the widget's parent can interpret it; otherwise, the event will be implicitly accepted. Although top-level widgets are able to choose whether to accept or ignore unknown events because they have no parent widgets that could otherwise handle them, it is good practice to explicitly ignore events to make widgets as reusable as possible.

The default implementation closes popup widgets if the user presses Esc. Otherwise the event is ignored.

Ver también:
keyReleaseEvent(), QKeyEvent::ignore(), setFocusPolicy(), focusInEvent(), focusOutEvent(), event(), QKeyEvent

Reimplementado de QWidget.

int QDial::lineStep ( ) const

Returns the line step.

Ver también:
setSteps() pageStep()

Reimplementado de QRangeControl.

int QDial::lineStep ( ) const

Returns the line step.

Ver también:
setSteps() pageStep()

Reimplementado de QRangeControl.

int QDial::maxValue ( ) const

Returns the maximum value of the range.

Ver también:
setMaxValue() setRange() minValue()

Reimplementado de QRangeControl.

int QDial::maxValue ( ) const

Returns the maximum value of the range.

Ver también:
setMaxValue() setRange() minValue()

Reimplementado de QRangeControl.

QSize QDial::minimumSizeHint ( ) const [virtual]

Reimplementado de QWidget.

QSize QDial::minimumSizeHint ( ) const [virtual]

Reimplementado de QWidget.

int QDial::minValue ( ) const

Returns the minimum value of the range.

Ver también:
setMinValue() setRange() maxValue()

Reimplementado de QRangeControl.

int QDial::minValue ( ) const

Returns the minimum value of the range.

Ver también:
setMinValue() setRange() maxValue()

Reimplementado de QRangeControl.

void QDial::mouseMoveEvent ( QMouseEvent e) [protected, virtual]

Reimplementado de QWidget.

void QDial::mouseMoveEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse move events for the widget.

If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.

QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.

Ver también:
setMouseTracking(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), event(), QMouseEvent

Reimplementado de QWidget.

void QDial::mousePressEvent ( QMouseEvent e) [protected, virtual]

Reimplementado de QWidget.

void QDial::mousePressEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse press events for the widget.

If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.

The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.

Ver también:
mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent

Reimplementado de QWidget.

void QDial::mouseReleaseEvent ( QMouseEvent e) [protected, virtual]

Reimplementado de QWidget.

void QDial::mouseReleaseEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse release events for the widget.

Ver también:
mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent

Reimplementado de QWidget.

bool QDial::notchesVisible ( ) const
bool QDial::notchesVisible ( ) const
int QDial::notchSize ( ) const
int QDial::notchSize ( ) const
double QDial::notchTarget ( ) const
double QDial::notchTarget ( ) const
int QDial::pageStep ( ) const

Returns the page step.

Ver también:
setSteps() lineStep()

Reimplementado de QRangeControl.

int QDial::pageStep ( ) const

Returns the page step.

Ver también:
setSteps() lineStep()

Reimplementado de QRangeControl.

void QDial::paintEvent ( QPaintEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive paint events.

A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint() or update(), or because the widget was obscured and has now been uncovered, or for many other reasons.

Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QCanvas do this, for example.

Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::unite()). repaint() does not permit this optimization, so we suggest using update() when possible.

When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background. There are a couple of exceptions and QPaintEvent::erased() tells you whether the widget has been erased or not.

The background can be set using setBackgroundMode(), setPaletteBackgroundColor() or setBackgroundPixmap(). The documentation for setBackgroundMode() elaborates on the background; we recommend reading it.

Ver también:
event(), repaint(), update(), QPainter, QPixmap, QPaintEvent

Reimplementado de QWidget.

void QDial::paintEvent ( QPaintEvent e) [protected, virtual]

Reimplementado de QWidget.

void QDial::rangeChange ( ) [protected, virtual]

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

Reimplementado de QRangeControl.

void QDial::rangeChange ( ) [protected, virtual]

This virtual function is called whenever the range control's range changes. You can reimplement it if you want to be notified when the range changes. The default implementation does nothing.

Note that this method is called after the range has changed.

Ver también:
setRange(), valueChange(), stepChange()

Reimplementado de QRangeControl.

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

Paints the dial using clip region cr.

virtual void QDial::repaintScreen ( const QRect cr = 0) [protected, virtual]
void QDial::resizeEvent ( QResizeEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive widget resize events. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().

The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.

Widgets that have been created with the WNoAutoErase flag will not be erased. Nevertheless, they will receive a paint event for their entire area afterwards. Again, no drawing needs to be done inside this handler.

The default implementation calls updateMask() if the widget has automatic masking enabled.

Ver también:
moveEvent(), event(), resize(), QResizeEvent, paintEvent()

Reimplementado de QWidget.

void QDial::resizeEvent ( QResizeEvent e) [protected, virtual]

Reimplementado de QWidget.

void QDial::setLineStep ( int  )
void QDial::setLineStep ( int  i)
void QDial::setMaxValue ( int  maxVal)

Sets the minimum value of the range to maxVal.

If necessary, the minValue() is adjusted so that the range remains valid.

Ver también:
maxValue() setMinValue()

Reimplementado de QRangeControl.

void QDial::setMaxValue ( int  maxVal)

Sets the minimum value of the range to maxVal.

If necessary, the minValue() is adjusted so that the range remains valid.

Ver también:
maxValue() setMinValue()

Reimplementado de QRangeControl.

void QDial::setMinValue ( int  minVal)

Sets the minimum value of the range to minVal.

If necessary, the maxValue() is adjusted so that the range remains valid.

Ver también:
minValue() setMaxValue()

Reimplementado de QRangeControl.

void QDial::setMinValue ( int  minVal)

Sets the minimum value of the range to minVal.

If necessary, the maxValue() is adjusted so that the range remains valid.

Ver también:
minValue() setMaxValue()

Reimplementado de QRangeControl.

virtual void QDial::setNotchesVisible ( bool  b) [virtual, slot]
void QDial::setNotchesVisible ( bool  b) [virtual, slot]
void QDial::setNotchTarget ( double  target) [virtual]
virtual void QDial::setNotchTarget ( double  ) [virtual]
void QDial::setPageStep ( int  i)
void QDial::setPageStep ( int  )
virtual void QDial::setTracking ( bool  enable) [virtual, slot]
void QDial::setTracking ( bool  enable) [virtual, slot]
void QDial::setValue ( int  value) [virtual, slot]

Sets the range control's value to value and forces it to be within the legal range.

Calls the virtual valueChange() function if the new value is different from the previous value. The old value can still be retrieved using prevValue().

Ver también:
value()

Reimplementado de QRangeControl.

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

Sets the range control's value to value and forces it to be within the legal range.

Calls the virtual valueChange() function if the new value is different from the previous value. The old value can still be retrieved using prevValue().

Ver también:
value()

Reimplementado de QRangeControl.

virtual void QDial::setWrapping ( bool  on) [virtual, slot]
void QDial::setWrapping ( bool  on) [virtual, slot]
QSize QDial::sizeHint ( ) const [virtual]

Reimplementado de QWidget.

QSize QDial::sizeHint ( ) const [virtual]

Reimplementado de QWidget.

void QDial::subtractLine ( ) [slot]

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

Reimplementado de QRangeControl.

void QDial::subtractLine ( ) [slot]

Equivalent to {setValue( value() - lineStep() )}.

If the value is changed, then valueChange() is called.

Ver también:
addLine() subtractPage() setValue()

Reimplementado de QRangeControl.

void QDial::subtractPage ( ) [slot]

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

Reimplementado de QRangeControl.

void QDial::subtractPage ( ) [slot]

Equivalent to {setValue( value() - pageStep() )}.

If the value is changed, then valueChange() is called.

Ver también:
addPage() subtractLine() setValue()

Reimplementado de QRangeControl.

bool QDial::tracking ( ) const
bool QDial::tracking ( ) const
int QDial::value ( ) const

Returns the current range control value. This is guaranteed to be within the range [minValue(), maxValue()].

Ver también:
setValue() prevValue()

Reimplementado de QRangeControl.

int QDial::value ( ) const

Returns the current range control value. This is guaranteed to be within the range [minValue(), maxValue()].

Ver también:
setValue() prevValue()

Reimplementado de QRangeControl.

void QDial::valueChange ( ) [protected, virtual]

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

Reimplementado de QRangeControl.

void QDial::valueChange ( ) [protected, virtual]

This virtual function is called whenever the range control value changes. You can reimplement it if you want to be notified when the value changes. The default implementation does nothing.

Note that this method is called after the value has changed. The previous value can be retrieved using prevValue().

Ver también:
setValue(), addPage(), subtractPage(), addLine(), subtractLine() rangeChange(), stepChange()

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

void QDial::valueChanged ( int  value) [signal]
void QDial::wheelEvent ( QWheelEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive wheel events for the widget.

If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.

The default implementation ignores the event.

Ver también:
QWheelEvent::ignore(), QWheelEvent::accept(), event(), QWheelEvent

Reimplementado de QWidget.

void QDial::wheelEvent ( QWheelEvent e) [protected, virtual]

Reimplementado de QWidget.

bool QDial::wrapping ( ) const
bool QDial::wrapping ( ) const

Documentación de propiedades

int QDial::lineStep [read, write]

the current line step

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

Ver también:
QRangeControl::setSteps() pageStep setRange()
int QDial::maxValue [read, write]

the current maximum value

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

Ver también:
setRange()
int QDial::minValue [read, write]

the current minimum value

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

Ver también:
setRange()
bool QDial::notchesVisible [read, write]

whether the notches are shown

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

int QDial::notchSize [read]

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

Ver también:
notchTarget() lineStep()
double QDial::notchTarget [read, write]

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.

int QDial::pageStep [read, write]

the current page step

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

Ver también:
stepChange()
bool QDial::tracking [read, write]

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.

int QDial::value [read, write]

the current dial value

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

Ver también:
minValue maxValue
bool QDial::wrapping [read, write]

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.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'