Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QDial Class Reference
[QtGui module]

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

 #include <QDial>

Inherits QAbstractSlider.

Properties

Public Functions

Public Slots

Additional Inherited 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 (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.

Screenshot of a dial in the Plastique widget styleScreenshot of a dial in the Windows XP widget styleScreenshot of a dial in the Macintosh widget style
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.


Property Documentation

notchSize : const int

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

Access functions:

  • int notchSize () const

See also notchTarget() and singleStep().

notchTarget : qreal

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.

Access functions:

  • qreal notchTarget () const
  • void setNotchTarget ( double target )

notchesVisible : bool

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.

Access functions:

  • bool notchesVisible () const
  • void setNotchesVisible ( bool visible )

wrapping : bool

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.

Access functions:

  • bool wrapping () const
  • void setWrapping ( bool on )

Member Function Documentation

QDial::QDial ( QWidget * parent = 0 )

Constructs a dial.

The parent argument is sent to the QAbstractSlider constructor.

QDial::~QDial ()

Destroys the dial.


Member Function Documentation

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

Use one of the constructors that doesn't take the name argument and then use setObjectName() instead.

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

Use one of the constructors that doesn't take the name argument and then use setObjectName() instead.

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

Use QAbstractSlider::sliderMoved() instead.

void QDial::dialPressed ()   [signal]

Use QAbstractSlider::sliderPressed() instead.

void QDial::dialReleased ()   [signal]

Use QAbstractSlider::sliderReleased() instead.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 44
  2. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  5. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web