Notice: Undefined offset: 1 in /home/developpez/www/developpez-com/upload/qt/doc/redir.php on line 39 Qt 4.7: Q3TimeEdit Class Reference
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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Q3TimeEdit Class Reference

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

 #include <Q3TimeEdit>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.

Inherits: Q3DateTimeEditBase.

Public Types

enum Display { Hours, Minutes, Seconds, AMPM }

Properties

  • 58 properties inherited from QWidget
  • 1 property inherited from QObject

Public Functions

Q3TimeEdit ( QWidget * parent = 0, const char * name = 0 )
Q3TimeEdit ( const QTime & time, QWidget * parent = 0, const char * name = 0 )
~Q3TimeEdit ()
bool autoAdvance () const
uint display () const
QTime maxValue () const
QTime minValue () const
QString separator () const
virtual void setAutoAdvance ( bool advance )
void setDisplay ( uint disp )
virtual void setMaxValue ( const QTime & d )
virtual void setMinValue ( const QTime & d )
virtual void setRange ( const QTime & min, const QTime & max )
virtual void setSeparator ( const QString & s )
QTime time () const

Reimplemented Public Functions

virtual QSize minimumSizeHint () const
virtual QSize sizeHint () const
  • 217 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 13 public functions inherited from QPaintDevice

Public Slots

virtual void setTime ( const QTime & time )
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Signals

void valueChanged ( const QTime & time )

Protected Functions

virtual void setHour ( int h )
virtual void setMinute ( int m )
virtual void setSecond ( int s )

Reimplemented Protected Functions

virtual bool event ( QEvent * e )
virtual void resizeEvent ( QResizeEvent * )
virtual QString sectionFormattedText ( int sec )
virtual void timerEvent ( QTimerEvent * e )
  • 37 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice

Additional Inherited Members

  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject
  • 1 protected slot inherited from QWidget

Detailed Description

The Q3TimeEdit class provides a time editor.

Q3TimeEdit 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 Q3TimeEdit 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 Q3TimeEdit is initialised with a time, e.g.

 QTime timeNow = QTime::currentTime();
 Q3TimeEdit *timeEdit = new Q3TimeEdit(timeNow, this);
 timeEdit->setRange(timeNow, timeNow.addSecs(60 * 60));

Here we've created a Q3TimeEdit 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, Q3DateEdit, and Q3DateTimeEdit.

Member Type Documentation

enum Q3TimeEdit::Display

This enum defines the sections that comprise a time

ConstantValueDescription
Q3TimeEdit::Hours0x01The hours section
Q3TimeEdit::Minutes0x02The minutes section
Q3TimeEdit::Seconds0x04The seconds section
Q3TimeEdit::AMPM0x10The AM/PM section

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

Property Documentation

autoAdvance : bool

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.

Access functions:

bool autoAdvance () const
virtual void setAutoAdvance ( bool advance )

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.

Access functions:

uint display () const
void setDisplay ( uint disp )

maxValue : QTime

This property holds the maximum time value.

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

Access functions:

QTime maxValue () const
virtual void setMaxValue ( const QTime & d )

See also minValue and setRange().

minValue : QTime

This property holds the minimum time value.

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

Access functions:

QTime minValue () const
virtual void setMinValue ( const QTime & d )

See also maxValue and setRange().

time : QTime

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.

Access functions:

QTime time () const
virtual void setTime ( const QTime & time )

Member Function Documentation

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

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

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

This is an overloaded function.

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

Q3TimeEdit::~Q3TimeEdit ()

Destroys the object and frees any allocated resources.

bool Q3TimeEdit::event ( QEvent * e ) [virtual protected]

Reimplemented from QObject::event().

QSize Q3TimeEdit::minimumSizeHint () const [virtual]

Reimplemented from QWidget::minimumSizeHint().

void Q3TimeEdit::resizeEvent ( QResizeEvent * ) [virtual protected]

Reimplemented from QWidget::resizeEvent().

QString Q3TimeEdit::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 Q3TimeEdit::separator () const

Returns the editor's separator.

See also setSeparator().

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

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

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

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

void Q3TimeEdit::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 Q3TimeEdit::setSecond ( int s ) [virtual protected]

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

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

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

See also separator().

QSize Q3TimeEdit::sizeHint () const [virtual]

Reimplemented from QWidget::sizeHint().

void Q3TimeEdit::timerEvent ( QTimerEvent * e ) [virtual protected]

Reimplemented from QObject::timerEvent().

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

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

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 64
  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. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. 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
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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.7
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