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  · 

QTimeString Class Reference
[QtBaseModule]

The QTimeString class provides localized strings for times and dates. More...

    #include <QTimeString>

Public Types

  • enum Length { Short, Medium, Long }

Static Public Members


Detailed Description

The QTimeString class provides localized strings for times and dates.

It is recommended to use QTimeString rather than QDateTime::toString() because QTimeString returns localized strings for a given date and/or time. Each function expects a parameter that determines the length of a returned string. If the user changes the date or time format all strings obtained from QTimeString have to be invalidated. The QtopiaApplication::dateFormatChanged() and QtopiaApplication::clockChanged() signals will indicate when this happens. The handler for these signals must ensure that all time/date strings are refreshed.

Warning: The length of the localized string can vary among languages.

See also QtopiaApplication::dateFormatChanged() and QtopiaApplication::clockChanged().


Member Type Documentation

enum QTimeString::Length

This enum specifies the different string lengths supported by QTimeString.

ConstantValueDescription
QTimeString::Short0Returns shortest possible string (mostly used on phones).
QTimeString::Medium1Returns default length string.
QTimeString::Long2Returns verbose string.


Member Function Documentation

bool QTimeString::currentAMPM ()   [static]

Returns true if 12 hour time is preferred over 24 hour time; otherwise returns false.

QString QTimeString::currentFormat ()   [static]

Returns the date format used by QTimeString (e.g. D.M.Y) if set; otherwise returns an empty string.

In case no format is set the default format which is returned by QLocale::dateFormat() in QLocale::ShortFormat is used.

See also QTimeString::formatOptions().

QStringList QTimeString::formatOptions ()   [static]

Returns additional format options for a date string. The default format is the format of the current locale as returned by QLocale::dateFormat() in QLocale::ShortFormat.

See also QTimeString::currentFormat().

QString QTimeString::localDayOfWeek ( const QDate & date, Length len = Medium )   [static]

Returns a localized name of the week day on date in the given len.

  • QTimeString::Long - Monday
  • QTimeString::Medium - Mon
  • QTimeString::Short - M

QString QTimeString::localH ( int hour )   [static]

Returns a localized string for hour, in 12 hour if QTimeString::currentAMPM() is true; otherwise in 24 hour format.

If hour is greater than 23 or less then 0 then hour will default to 0.

QString QTimeString::localHM ( const QTime & t, Length len = Medium )   [static]

Returns a localized string for t in the given len, showing hours and minutes.

  • QTimeString::Long - 02:05 PM
  • QTimeString::Medium - 2:05 PM
  • QTimeString::Short - 2:05

The format, including order depends on the user's settings.

QString QTimeString::localHMDayOfWeek ( const QDateTime & t, Length len = Medium )   [static]

Returns a localized string for t in the given len, showing hours, minutes, and day of the week.

  • QTimeString::Long - Monday 02:04 PM
  • QTimeString::Medium - Mon 2:40 PM
  • QTimeString::Short - M 2:40

The format, including order depends on the user's settings.

QString QTimeString::localHMS ( const QTime & t, Length len = Medium )   [static]

Returns a localized string for t in the given len, showing hours, minutes, and seconds.

  • QTimeString::Long - 02:05:12 PM
  • QTimeString::Medium - 2:05:12 PM
  • QTimeString::Short - 2:05:12

The format, including order depends on the user's settings.

QString QTimeString::localHMSDayOfWeek ( const QDateTime & t, Length len = Medium )   [static]

Returns a localized string for t in the given len, showing hours, minutes, seconds, and day of the week.

  • QTimeString::Long - Monday 02:04:14 PM
  • QTimeString::Medium - Mon 2:40:14 PM
  • QTimeString::Short - M 2:40:14

The format, including order depends on the user's settings.

QString QTimeString::localMD ( const QDate & dt, Length len = Medium )   [static]

Returns a localized string for dt in the given len, showing month and date.

  • QTimeString::Long - 27 September
  • QTimeString::Medium - 27 Sep
  • QTimeString::Short - 27 Sep

The format, including the order of month and date depends on the user's current locale.

QString QTimeString::localYMD ( const QDate & dt, Length len = Medium )   [static]

Returns a localized string for dt in the given len showing year, month, and date.

  • QTimeString::Long - Monday 27 September 2005
  • QTimeString::Medium - 27 Sep 2005
  • QTimeString::Short - the same as the medium string

The format, including order depends on the user's settings.

QString QTimeString::localYMDHMS ( const QDateTime & dt, Length len = Medium )   [static]

Returns a localized string for dt in the given len, showing year, month, date, hours, minutes, and seconds.

  • QTimeString::Long - 27 September 2005 02:54:22 PM
  • QTimeString::Medium - 27 Sep 05 2:54:22 PM
  • QTimeString::Short - 27 Sep 05 2:54:22

The format, including order depends on the user's settings.

QString QTimeString::nameOfMonth ( int month, Length len = Medium )   [static]

Returns the name of month in the given len.

  • QTimeString::Long - January
  • QTimeString::Medium - Jan
  • QTimeString::Short - Jan

QString QTimeString::nameOfWeekDay ( int day, Length len = Medium )   [static]

Returns the name for the day of the week in the given len.

  • QTimeString::Long - Monday
  • QTimeString::Medium - Mon
  • QTimeString::Short - M

QString QTimeString::numberDateString ( const QDate & date, Length len = Medium )   [static]

Returns a localized string for date showing day, month and year as a number in the given len.

  • QTimeString::Long - 07/08/2005
  • QTimeString::Medium - 07/08/05
  • QTimeString::Short - 7/8/05

The format, including order depends on the user's settings.

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 qtextended4.4
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