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  ·  Fonctions  · 

QDoubleValidator Class Reference

The QDoubleValidator class provides range checking of floating-point numbers. More...

#include <qvalidator.h>

Inherits QValidator.

List of all member functions.

Public Members

Properties

  • double bottom - the validator's minimum acceptable value
  • int decimals - the validator's maximum number of digits after the decimal point
  • double top - the validator's maximum acceptable value

Detailed Description

The QDoubleValidator class provides range checking of floating-point numbers.

QDoubleValidator provides an upper bound, a lower bound and a limit on the number of digits after the decimal point. It does not provide a fixup() function.

You can set the acceptable range in one call with setRange(), or with setBottom() and setTop(). Set the number of decimal places with setDecimals(). The validate() function returns the validation state.

See also QIntValidator, QRegExpValidator, and Miscellaneous Classes.


Member Function Documentation

QDoubleValidator::QDoubleValidator ( QObject * parent, const char * name = 0 )

Constructs a validator object with parent parent, called name, which accepts any double.

QDoubleValidator::QDoubleValidator ( double bottom, double top, int decimals, QObject * parent, const char * name = 0 )

Constructs a validator object with parent parent, called name. This validator will accept doubles from bottom to top inclusive, with up to decimals digits after the decimal point.

QDoubleValidator::~QDoubleValidator ()

Destroys the validator, freeing any resources used.

double QDoubleValidator::bottom () const

Returns the validator's minimum acceptable value. See the "bottom" property for details.

int QDoubleValidator::decimals () const

Returns the validator's maximum number of digits after the decimal point. See the "decimals" property for details.

void QDoubleValidator::setBottom ( double )

Sets the validator's minimum acceptable value. See the "bottom" property for details.

void QDoubleValidator::setDecimals ( int )

Sets the validator's maximum number of digits after the decimal point. See the "decimals" property for details.

void QDoubleValidator::setRange ( double minimum, double maximum, int decimals = 0 ) [virtual]

Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point.

void QDoubleValidator::setTop ( double )

Sets the validator's maximum acceptable value. See the "top" property for details.

double QDoubleValidator::top () const

Returns the validator's maximum acceptable value. See the "top" property for details.

QValidator::State QDoubleValidator::validate ( QString & input, int & ) const [virtual]

Returns Acceptable if the string input contains a double that is within the valid range and is in the correct format.

Returns Intermediate if input contains a double that is outside the range or is in the wrong format, e.g. with too many digits after the decimal point or is empty.

Returns Invalid if the input is not a double.

Note: If the valid range consists of just positive doubles (e.g. 0.0 - 100.0) and input is a negative double then Invalid is returned.

Reimplemented from QValidator.


Property Documentation

double bottom

This property holds the validator's minimum acceptable value.

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

See also setRange().

int decimals

This property holds the validator's maximum number of digits after the decimal point.

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

See also setRange().

double top

This property holds the validator's maximum acceptable value.

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

See also setRange().


This file is part of the Qt toolkit. Copyright © 1995-2005 Trolltech. All Rights Reserved.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 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. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
Page suivante

Le Qt Labs au hasard

Logo

QMake et au-delà

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. 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 3.3
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