#include "q3datetimeedit.h"
#include <private/q3richtext_p.h>
#include "qevent.h"
#include "q3rangecontrol.h"
#include "qapplication.h"
#include "qpixmap.h"
#include "qlist.h"
#include "qstring.h"
#include "qstyle.h"
#include "q3datetimeedit.moc"
Include dependency graph for q3datetimeedit.cpp:

Go to the source code of this file.
Classes | |
| class | QNumberSection |
| class | Q3DateTimeEditorPrivate |
| class | Q3DateTimeEditor |
| class | QDateTimeSpinWidget |
| class | Q3DateEditPrivate |
| class | Q3TimeEditPrivate |
| class | Q3DateTimeEditPrivate |
Defines | |
| #define | QDATETIMEEDIT_HIDDEN_CHAR '0' |
Functions | |
| static void | cleanup () |
| static void | readLocaleSettings () |
| static Q3DateEdit::Order | localOrder () |
| static QString | localDateSep () |
| static QString | localTimeSep () |
Variables | |
| static QString * | lDateSep = 0 |
| static QString * | lTimeSep = 0 |
| static bool | lAMPM = false |
| static QString * | lAM = 0 |
| static QString * | lPM = 0 |
| static Q3DateEdit::Order | lOrder = Q3DateEdit::YMD |
| static int | refcount = 0 |
| #define QDATETIMEEDIT_HIDDEN_CHAR '0' |
Definition at line 41 of file q3datetimeedit.cpp.
Referenced by Q3DateTimeEditorPrivate::paint(), Q3TimeEdit::sectionFormattedText(), Q3DateEdit::sectionFormattedText(), and Q3TimeEdit::setFocusSection().
| static void cleanup | ( | ) | [static] |
| static QString localDateSep | ( | ) | [static] |
Definition at line 185 of file q3datetimeedit.cpp.
References lDateSep, and readLocaleSettings().
Referenced by Q3DateTimeEditorPrivate::Q3DateTimeEditorPrivate().
00185 { 00186 if (!lDateSep) { 00187 readLocaleSettings(); 00188 } 00189 return *lDateSep; 00190 }
Here is the call graph for this function:

| static Q3DateEdit::Order localOrder | ( | ) | [static] |
Definition at line 178 of file q3datetimeedit.cpp.
References lDateSep, lOrder, and readLocaleSettings().
Referenced by Q3DateEdit::init().
00178 { 00179 if (!lDateSep) { 00180 readLocaleSettings(); 00181 } 00182 return lOrder; 00183 }
Here is the call graph for this function:

| static QString localTimeSep | ( | ) | [static] |
Definition at line 192 of file q3datetimeedit.cpp.
References lTimeSep, and readLocaleSettings().
Referenced by Q3TimeEdit::event(), and Q3TimeEdit::init().
00192 { 00193 if (!lTimeSep) { 00194 readLocaleSettings(); 00195 } 00196 return *lTimeSep; 00197 }
Here is the call graph for this function:

| static void readLocaleSettings | ( | ) | [static] |
Definition at line 88 of file q3datetimeedit.cpp.
References cleanup(), d, data, Q3DateEdit::DMY, QString::fromLocal8Bit(), QString::fromUtf16(), QString::isEmpty(), lAM, lAMPM, lDateSep, Qt::LocalDate, lOrder, lPM, lTimeSep, Q3DateEdit::MDY, qMin(), t, QString::toInt(), Q3DateEdit::YDM, and Q3DateEdit::YMD.
Referenced by Q3TimeEdit::event(), localDateSep(), localOrder(), and localTimeSep().
00089 { 00090 int dpos, mpos, ypos; 00091 cleanup(); 00092 00093 lDateSep = new QString(); 00094 lTimeSep = new QString(); 00095 00096 #if defined(Q_WS_WIN) 00097 QT_WA({ 00098 TCHAR data[10]; 00099 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, data, 10); 00100 *lDateSep = QString::fromUtf16((ushort*)data); 00101 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, data, 10); 00102 *lTimeSep = QString::fromUtf16((ushort*)data); 00103 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, data, 10); 00104 lAMPM = QString::fromUtf16((ushort*)data).toInt()==0; 00105 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, data, 10); 00106 QString am = QString::fromUtf16((ushort*)data); 00107 if (!am.isEmpty()) 00108 lAM = new QString(am); 00109 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, data, 10); 00110 QString pm = QString::fromUtf16((ushort*)data); 00111 if (!pm.isEmpty() ) 00112 lPM = new QString(pm); 00113 } , { 00114 char data[10]; 00115 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDATE, (char*)&data, 10); 00116 *lDateSep = QString::fromLocal8Bit(data); 00117 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STIME, (char*)&data, 10); 00118 *lTimeSep = QString::fromLocal8Bit(data); 00119 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ITIME, (char*)&data, 10); 00120 lAMPM = QString::fromLocal8Bit(data).toInt()==0; 00121 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S1159, (char*)&data, 10); 00122 QString am = QString::fromLocal8Bit(data); 00123 if (!am.isEmpty()) 00124 lAM = new QString(am); 00125 GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_S2359, (char*)&data, 10); 00126 QString pm = QString::fromLocal8Bit(data); 00127 if (!pm.isEmpty()) 00128 lPM = new QString(pm); 00129 }); 00130 #else 00131 *lDateSep = "-"; 00132 *lTimeSep = ":"; 00133 #endif 00134 QString d = QDate(1999, 11, 22).toString(Qt::LocalDate); 00135 dpos = d.indexOf("22"); 00136 mpos = d.indexOf("11"); 00137 ypos = d.indexOf("99"); 00138 if (dpos > -1 && mpos > -1 && ypos > -1) { 00139 // test for DMY, MDY, YMD, YDM 00140 if (dpos < mpos && mpos < ypos) { 00141 lOrder = Q3DateEdit::DMY; 00142 } else if (mpos < dpos && dpos < ypos) { 00143 lOrder = Q3DateEdit::MDY; 00144 } else if (ypos < mpos && mpos < dpos) { 00145 lOrder = Q3DateEdit::YMD; 00146 } else if (ypos < dpos && dpos < mpos) { 00147 lOrder = Q3DateEdit::YDM; 00148 } else { 00149 // cannot determine the dateformat - use the default 00150 return; 00151 } 00152 00153 // this code needs to change if new formats are added 00154 00155 #ifndef Q_WS_WIN 00156 QString sep = d.mid(qMin(dpos, mpos) + 2, QABS(dpos - mpos) - 2); 00157 if (d.count(sep) == 2) { 00158 *lDateSep = sep; 00159 } 00160 #endif 00161 } 00162 00163 #ifndef Q_WS_WIN 00164 QString t = QTime(11, 22, 33).toString(Qt::LocalDate); 00165 dpos = t.indexOf("11"); 00166 mpos = t.indexOf("22"); 00167 ypos = t.indexOf("33"); 00168 // We only allow hhmmss 00169 if (dpos > -1 && dpos < mpos && mpos < ypos) { 00170 QString sep = t.mid(dpos + 2, mpos - dpos - 2); 00171 if (sep == t.mid(mpos + 2, ypos - mpos - 2)) { 00172 *lTimeSep = sep; 00173 } 00174 } 00175 #endif 00176 }
Here is the call graph for this function:

Definition at line 67 of file q3datetimeedit.cpp.
Referenced by Q3DateTimeEditor::eventFilter(), readLocaleSettings(), Q3TimeEdit::sectionText(), and Q3TimeEdit::sizeHint().
bool lAMPM = false [static] |
Definition at line 66 of file q3datetimeedit.cpp.
Referenced by Q3DateTimeEditor::eventFilter(), Q3TimeEdit::init(), and readLocaleSettings().
Definition at line 64 of file q3datetimeedit.cpp.
Referenced by localDateSep(), localOrder(), and readLocaleSettings().
Q3DateEdit::Order lOrder = Q3DateEdit::YMD [static] |
Definition at line 69 of file q3datetimeedit.cpp.
Referenced by localOrder(), and readLocaleSettings().
Definition at line 68 of file q3datetimeedit.cpp.
Referenced by Q3DateTimeEditor::eventFilter(), readLocaleSettings(), and Q3TimeEdit::sectionText().
Definition at line 65 of file q3datetimeedit.cpp.
Referenced by localTimeSep(), and readLocaleSettings().
int refcount = 0 [static] |
Definition at line 70 of file q3datetimeedit.cpp.
Referenced by QStyleSheetStyle::deref(), Q3DateEdit::init(), Q3TimeEdit::init(), Q3DateTimeEditorPrivate::Q3DateTimeEditorPrivate(), QStyleSheetStyle::ref(), Q3DateEdit::~Q3DateEdit(), Q3DateTimeEditorPrivate::~Q3DateTimeEditorPrivate(), and Q3TimeEdit::~Q3TimeEdit().
1.5.1