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  · 

QTimeEdit Class Reference

The QTimeEdit class provides a time editor. More...

#include <qdatetimeedit.h>

Inherits QDateTimeEditBase.

List of all member functions.

Public Members

Public Slots

  • virtual void setTime ( const QTime & time )

Signals

Properties

  • bool autoAdvance - whether the editor automatically advances to the next section
  • Display display - the sections that are displayed in the time edit
  • QTime maxValue - the maximum time value
  • QTime minValue - the minimum time value
  • QTime time - the editor's time value

Protected Members


Detailed Description

The QTimeEdit class provides a time editor.

QTimeEdit allows the user to edit times by using the keyboard or the arrow keys to increase/decrease time values. The arrow keys can be used to move from section to section within the QTimeEdit box. The user can automatically be moved to the next section once they complete a section using setAutoAdvance(). Times appear in hour, minute, second order. It is recommended that the QTimeEdit is initialised with a time, e.g.

    QTime timeNow = QTime::currentTime();
    QTimeEdit *timeEdit = new QTimeEdit( timeNow, this );
    timeEdit->setRange( timeNow, timeNow.addSecs( 60 * 60 ) );
    
Here we've created a QTimeEdit widget set to the current time. We've also set the minimum value to the current time and the maximum time to one hour from now.

The maximum and minimum values for a time value in the time editor default to the maximum and minimum values for a QTime. You can change this by calling setMinValue(), setMaxValue() or setRange().

Terminology: A QTimeWidget consists of three sections, one each for the hour, minute and second. You can change the separator character using setSeparator(), by default the separator is read from the system's settings.

Date Time Widgets

See also QTime, QDateEdit, QDateTimeEdit, Advanced Widgets, and Time and Date.


Member Type Documentation

QTimeEdit::Display

This enum defines the sections that comprise a time

  • QTimeEdit::Hours - The hours section
  • QTimeEdit::Minutes - The minutes section
  • QTimeEdit::Seconds - The seconds section
  • QTimeEdit::AMPM - The AM/PM section

The values can be or'ed together to show any combination.


Member Function Documentation

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

Constructs an empty time edit with parent parent and called name.

QTimeEdit::QTimeEdit ( const QTime & time, QWidget * parent = 0, const char * name = 0 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Constructs a time edit with the initial time value, time, parent parent and called name.

QTimeEdit::~QTimeEdit ()

Destroys the object and frees any allocated resources.

bool QTimeEdit::autoAdvance () const

Returns TRUE if the editor automatically advances to the next section; otherwise returns FALSE. See the "autoAdvance" property for details.

uint QTimeEdit::display () const

Returns the sections that are displayed in the time edit. See the "display" property for details.

QTime QTimeEdit::maxValue () const

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

QTime QTimeEdit::minValue () const

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

QString QTimeEdit::sectionFormattedText ( int sec ) [virtual protected]

Returns the formatted number for section sec. This will correspond to either the hour, minute or second section, depending on sec.

QString QTimeEdit::separator () const

Returns the editor's separator.

void QTimeEdit::setAutoAdvance ( bool advance ) [virtual]

Sets whether the editor automatically advances to the next section to advance. See the "autoAdvance" property for details.

void QTimeEdit::setDisplay ( uint disp )

Sets the sections that are displayed in the time edit to disp. See the "display" property for details.

void QTimeEdit::setHour ( int h ) [virtual protected]

Sets the hour to h, which must be a valid hour, i.e. in the range 0..24.

void QTimeEdit::setMaxValue ( const QTime & d ) [virtual]

Sets the maximum time value to d. See the "maxValue" property for details.

void QTimeEdit::setMinValue ( const QTime & d ) [virtual]

Sets the minimum time value to d. See the "minValue" property for details.

void QTimeEdit::setMinute ( int m ) [virtual protected]

Sets the minute to m, which must be a valid minute, i.e. in the range 0..59.

void QTimeEdit::setRange ( const QTime & min, const QTime & max ) [virtual]

Sets the valid input range for the editor to be from min to max inclusive. If min is invalid no minimum time is set. Similarly, if max is invalid no maximum time is set.

void QTimeEdit::setSecond ( int s ) [virtual protected]

Sets the second to s, which must be a valid second, i.e. in the range 0..59.

void QTimeEdit::setSeparator ( const QString & s ) [virtual]

Sets the separator to s. Note that currently only the first character of s is used.

void QTimeEdit::setTime ( const QTime & time ) [virtual slot]

Sets the editor's time value to time. See the "time" property for details.

QTime QTimeEdit::time () const

Returns the editor's time value. See the "time" property for details.

void QTimeEdit::valueChanged ( const QTime & time ) [signal]

This signal is emitted whenever the editor's value changes. The time parameter is the new value.


Property Documentation

bool autoAdvance

This property holds whether the editor automatically advances to the next section.

If autoAdvance is TRUE, the editor will automatically advance focus to the next time section if a user has completed a section. The default is FALSE.

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

Display display

This property holds the sections that are displayed in the time edit.

The value can be any combination of the values in the Display enum. By default, the widget displays hours, minutes and seconds.

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

QTime maxValue

This property holds the maximum time value.

Setting the maximum time value is equivalent to calling QTimeEdit::setRange( minValue(), t ), where t is the maximum time. The default maximum time is 23:59:59.

See also minValue and setRange().

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

QTime minValue

This property holds the minimum time value.

Setting the minimum time value is equivalent to calling QTimeEdit::setRange( t, maxValue() ), where t is the minimum time. The default minimum time is 00:00:00.

See also maxValue and setRange().

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

QTime time

This property holds the editor's time value.

When changing the time property, if the time is less than minValue(), or is greater than maxValue(), nothing happens.

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


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

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 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 47
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 13
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le blog Digia au hasard

Logo

Une nouvelle ère d'IHM 3D pour les automobiles

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 3.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