Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qdatetimeedit.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | QDateTimeEdit::QDateTimeEdit(QWidget *parent) | - | ||||||||||||||||||
3 | : QAbstractSpinBox(*new QDateTimeEditPrivate, parent) | - | ||||||||||||||||||
4 | { | - | ||||||||||||||||||
5 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
6 | d->init(QDateTime(QDate(2000, 1, 1), QTime(0, 0, 0, 0))); | - | ||||||||||||||||||
7 | } never executed: end of block | 0 | ||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | - | |||||||||||||||||||
11 | - | |||||||||||||||||||
12 | - | |||||||||||||||||||
13 | - | |||||||||||||||||||
14 | QDateTimeEdit::QDateTimeEdit(const QDateTime &datetime, QWidget *parent) | - | ||||||||||||||||||
15 | : QAbstractSpinBox(*new QDateTimeEditPrivate, parent) | - | ||||||||||||||||||
16 | { | - | ||||||||||||||||||
17 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
18 | d->init(datetime.isValid() ? datetime : QDateTime(QDate(2000, 1, 1), | - | ||||||||||||||||||
19 | QTime(0, 0, 0, 0))); | - | ||||||||||||||||||
20 | } never executed: end of block | 0 | ||||||||||||||||||
21 | QDateTimeEdit::QDateTimeEdit(const QDate &date, QWidget *parent) | - | ||||||||||||||||||
22 | : QAbstractSpinBox(*new QDateTimeEditPrivate, parent) | - | ||||||||||||||||||
23 | { | - | ||||||||||||||||||
24 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
25 | d->init(date.isValid() ? date : QDate(2000, 1, 1)); | - | ||||||||||||||||||
26 | } never executed: end of block | 0 | ||||||||||||||||||
27 | QDateTimeEdit::QDateTimeEdit(const QTime &time, QWidget *parent) | - | ||||||||||||||||||
28 | : QAbstractSpinBox(*new QDateTimeEditPrivate, parent) | - | ||||||||||||||||||
29 | { | - | ||||||||||||||||||
30 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
31 | d->init(time.isValid() ? time : QTime(0, 0, 0, 0)); | - | ||||||||||||||||||
32 | } never executed: end of block | 0 | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | - | |||||||||||||||||||
35 | - | |||||||||||||||||||
36 | - | |||||||||||||||||||
37 | - | |||||||||||||||||||
38 | QDateTimeEdit::QDateTimeEdit(const QVariant &var, QVariant::Type parserType, QWidget *parent) | - | ||||||||||||||||||
39 | : QAbstractSpinBox(*new QDateTimeEditPrivate, parent) | - | ||||||||||||||||||
40 | { | - | ||||||||||||||||||
41 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
42 | d->parserType = parserType; | - | ||||||||||||||||||
43 | d->init(var); | - | ||||||||||||||||||
44 | } never executed: end of block | 0 | ||||||||||||||||||
45 | - | |||||||||||||||||||
46 | - | |||||||||||||||||||
47 | - | |||||||||||||||||||
48 | - | |||||||||||||||||||
49 | QDateTimeEdit::~QDateTimeEdit() | - | ||||||||||||||||||
50 | { | - | ||||||||||||||||||
51 | } | - | ||||||||||||||||||
52 | QDateTime QDateTimeEdit::dateTime() const | - | ||||||||||||||||||
53 | { | - | ||||||||||||||||||
54 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
55 | return never executed: d->value.toDateTime();return d->value.toDateTime(); never executed: return d->value.toDateTime(); | 0 | ||||||||||||||||||
56 | } | - | ||||||||||||||||||
57 | - | |||||||||||||||||||
58 | void QDateTimeEdit::setDateTime(const QDateTime &datetime) | - | ||||||||||||||||||
59 | { | - | ||||||||||||||||||
60 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
61 | if (datetime.isValid()
| 0 | ||||||||||||||||||
62 | d->clearCache(); | - | ||||||||||||||||||
63 | if (!(d->sections & DateSections_Mask)
| 0 | ||||||||||||||||||
64 | setDateRange(datetime.date(), datetime.date()); never executed: setDateRange(datetime.date(), datetime.date()); | 0 | ||||||||||||||||||
65 | d->setValue(QDateTime(datetime.date(), datetime.time(), d->spec), EmitIfChanged); | - | ||||||||||||||||||
66 | } never executed: end of block | 0 | ||||||||||||||||||
67 | } never executed: end of block | 0 | ||||||||||||||||||
68 | QDate QDateTimeEdit::date() const | - | ||||||||||||||||||
69 | { | - | ||||||||||||||||||
70 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
71 | return never executed: d->value.toDate();return d->value.toDate(); never executed: return d->value.toDate(); | 0 | ||||||||||||||||||
72 | } | - | ||||||||||||||||||
73 | - | |||||||||||||||||||
74 | void QDateTimeEdit::setDate(const QDate &date) | - | ||||||||||||||||||
75 | { | - | ||||||||||||||||||
76 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
77 | if (date.isValid()
| 0 | ||||||||||||||||||
78 | if (!(d->sections & DateSections_Mask)
| 0 | ||||||||||||||||||
79 | setDateRange(date, date); never executed: setDateRange(date, date); | 0 | ||||||||||||||||||
80 | - | |||||||||||||||||||
81 | d->clearCache(); | - | ||||||||||||||||||
82 | d->setValue(QDateTime(date, d->value.toTime(), d->spec), EmitIfChanged); | - | ||||||||||||||||||
83 | d->updateTimeSpec(); | - | ||||||||||||||||||
84 | } never executed: end of block | 0 | ||||||||||||||||||
85 | } never executed: end of block | 0 | ||||||||||||||||||
86 | QTime QDateTimeEdit::time() const | - | ||||||||||||||||||
87 | { | - | ||||||||||||||||||
88 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
89 | return never executed: d->value.toTime();return d->value.toTime(); never executed: return d->value.toTime(); | 0 | ||||||||||||||||||
90 | } | - | ||||||||||||||||||
91 | - | |||||||||||||||||||
92 | void QDateTimeEdit::setTime(const QTime &time) | - | ||||||||||||||||||
93 | { | - | ||||||||||||||||||
94 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
95 | if (time.isValid()
| 0 | ||||||||||||||||||
96 | d->clearCache(); | - | ||||||||||||||||||
97 | d->setValue(QDateTime(d->value.toDate(), time, d->spec), EmitIfChanged); | - | ||||||||||||||||||
98 | } never executed: end of block | 0 | ||||||||||||||||||
99 | } never executed: end of block | 0 | ||||||||||||||||||
100 | QDateTime QDateTimeEdit::minimumDateTime() const | - | ||||||||||||||||||
101 | { | - | ||||||||||||||||||
102 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
103 | return never executed: d->minimum.toDateTime();return d->minimum.toDateTime(); never executed: return d->minimum.toDateTime(); | 0 | ||||||||||||||||||
104 | } | - | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | void QDateTimeEdit::clearMinimumDateTime() | - | ||||||||||||||||||
107 | { | - | ||||||||||||||||||
108 | setMinimumDateTime(QDateTime(QDate(1752, 9, 14), QTime(0, 0, 0, 0))); | - | ||||||||||||||||||
109 | } never executed: end of block | 0 | ||||||||||||||||||
110 | - | |||||||||||||||||||
111 | void QDateTimeEdit::setMinimumDateTime(const QDateTime &dt) | - | ||||||||||||||||||
112 | { | - | ||||||||||||||||||
113 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
114 | if (dt.isValid()
| 0 | ||||||||||||||||||
115 | const QDateTime m = dt.toTimeSpec(d->spec); | - | ||||||||||||||||||
116 | const QDateTime max = d->maximum.toDateTime(); | - | ||||||||||||||||||
117 | d->setRange(m, (max > m ? max : m)); | - | ||||||||||||||||||
118 | } never executed: end of block | 0 | ||||||||||||||||||
119 | } never executed: end of block | 0 | ||||||||||||||||||
120 | QDateTime QDateTimeEdit::maximumDateTime() const | - | ||||||||||||||||||
121 | { | - | ||||||||||||||||||
122 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
123 | return never executed: d->maximum.toDateTime();return d->maximum.toDateTime(); never executed: return d->maximum.toDateTime(); | 0 | ||||||||||||||||||
124 | } | - | ||||||||||||||||||
125 | - | |||||||||||||||||||
126 | void QDateTimeEdit::clearMaximumDateTime() | - | ||||||||||||||||||
127 | { | - | ||||||||||||||||||
128 | setMaximumDateTime(QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999))); | - | ||||||||||||||||||
129 | } never executed: end of block | 0 | ||||||||||||||||||
130 | - | |||||||||||||||||||
131 | void QDateTimeEdit::setMaximumDateTime(const QDateTime &dt) | - | ||||||||||||||||||
132 | { | - | ||||||||||||||||||
133 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
134 | if (dt.isValid()
| 0 | ||||||||||||||||||
135 | const QDateTime m = dt.toTimeSpec(d->spec); | - | ||||||||||||||||||
136 | const QDateTime min = d->minimum.toDateTime(); | - | ||||||||||||||||||
137 | d->setRange((min < m ? min : m), m); | - | ||||||||||||||||||
138 | } never executed: end of block | 0 | ||||||||||||||||||
139 | } never executed: end of block | 0 | ||||||||||||||||||
140 | void QDateTimeEdit::setDateTimeRange(const QDateTime &min, const QDateTime &max) | - | ||||||||||||||||||
141 | { | - | ||||||||||||||||||
142 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
143 | const QDateTime minimum = min.toTimeSpec(d->spec); | - | ||||||||||||||||||
144 | QDateTime maximum = max.toTimeSpec(d->spec); | - | ||||||||||||||||||
145 | if (min > max
| 0 | ||||||||||||||||||
146 | maximum = minimum; never executed: maximum = minimum; | 0 | ||||||||||||||||||
147 | d->setRange(minimum, maximum); | - | ||||||||||||||||||
148 | } never executed: end of block | 0 | ||||||||||||||||||
149 | QDate QDateTimeEdit::minimumDate() const | - | ||||||||||||||||||
150 | { | - | ||||||||||||||||||
151 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
152 | return never executed: d->minimum.toDate();return d->minimum.toDate(); never executed: return d->minimum.toDate(); | 0 | ||||||||||||||||||
153 | } | - | ||||||||||||||||||
154 | - | |||||||||||||||||||
155 | void QDateTimeEdit::setMinimumDate(const QDate &min) | - | ||||||||||||||||||
156 | { | - | ||||||||||||||||||
157 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
158 | if (min.isValid()
| 0 | ||||||||||||||||||
159 | setMinimumDateTime(QDateTime(min, d->minimum.toTime(), d->spec)); | - | ||||||||||||||||||
160 | } never executed: end of block | 0 | ||||||||||||||||||
161 | } never executed: end of block | 0 | ||||||||||||||||||
162 | - | |||||||||||||||||||
163 | void QDateTimeEdit::clearMinimumDate() | - | ||||||||||||||||||
164 | { | - | ||||||||||||||||||
165 | setMinimumDate(QDate(1752, 9, 14)); | - | ||||||||||||||||||
166 | } never executed: end of block | 0 | ||||||||||||||||||
167 | QDate QDateTimeEdit::maximumDate() const | - | ||||||||||||||||||
168 | { | - | ||||||||||||||||||
169 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
170 | return never executed: d->maximum.toDate();return d->maximum.toDate(); never executed: return d->maximum.toDate(); | 0 | ||||||||||||||||||
171 | } | - | ||||||||||||||||||
172 | - | |||||||||||||||||||
173 | void QDateTimeEdit::setMaximumDate(const QDate &max) | - | ||||||||||||||||||
174 | { | - | ||||||||||||||||||
175 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
176 | if (max.isValid()
| 0 | ||||||||||||||||||
177 | setMaximumDateTime(QDateTime(max, d->maximum.toTime(), d->spec)); | - | ||||||||||||||||||
178 | } never executed: end of block | 0 | ||||||||||||||||||
179 | } never executed: end of block | 0 | ||||||||||||||||||
180 | - | |||||||||||||||||||
181 | void QDateTimeEdit::clearMaximumDate() | - | ||||||||||||||||||
182 | { | - | ||||||||||||||||||
183 | setMaximumDate(QDate(7999, 12, 31)); | - | ||||||||||||||||||
184 | } never executed: end of block | 0 | ||||||||||||||||||
185 | QTime QDateTimeEdit::minimumTime() const | - | ||||||||||||||||||
186 | { | - | ||||||||||||||||||
187 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
188 | return never executed: d->minimum.toTime();return d->minimum.toTime(); never executed: return d->minimum.toTime(); | 0 | ||||||||||||||||||
189 | } | - | ||||||||||||||||||
190 | - | |||||||||||||||||||
191 | void QDateTimeEdit::setMinimumTime(const QTime &min) | - | ||||||||||||||||||
192 | { | - | ||||||||||||||||||
193 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
194 | if (min.isValid()
| 0 | ||||||||||||||||||
195 | const QDateTime m(d->minimum.toDate(), min, d->spec); | - | ||||||||||||||||||
196 | setMinimumDateTime(m); | - | ||||||||||||||||||
197 | } never executed: end of block | 0 | ||||||||||||||||||
198 | } never executed: end of block | 0 | ||||||||||||||||||
199 | - | |||||||||||||||||||
200 | void QDateTimeEdit::clearMinimumTime() | - | ||||||||||||||||||
201 | { | - | ||||||||||||||||||
202 | setMinimumTime(QTime(0, 0, 0, 0)); | - | ||||||||||||||||||
203 | } never executed: end of block | 0 | ||||||||||||||||||
204 | QTime QDateTimeEdit::maximumTime() const | - | ||||||||||||||||||
205 | { | - | ||||||||||||||||||
206 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
207 | return never executed: d->maximum.toTime();return d->maximum.toTime(); never executed: return d->maximum.toTime(); | 0 | ||||||||||||||||||
208 | } | - | ||||||||||||||||||
209 | - | |||||||||||||||||||
210 | void QDateTimeEdit::setMaximumTime(const QTime &max) | - | ||||||||||||||||||
211 | { | - | ||||||||||||||||||
212 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
213 | if (max.isValid()
| 0 | ||||||||||||||||||
214 | const QDateTime m(d->maximum.toDate(), max); | - | ||||||||||||||||||
215 | setMaximumDateTime(m); | - | ||||||||||||||||||
216 | } never executed: end of block | 0 | ||||||||||||||||||
217 | } never executed: end of block | 0 | ||||||||||||||||||
218 | - | |||||||||||||||||||
219 | void QDateTimeEdit::clearMaximumTime() | - | ||||||||||||||||||
220 | { | - | ||||||||||||||||||
221 | setMaximumTime(QTime(23, 59, 59, 999)); | - | ||||||||||||||||||
222 | } never executed: end of block | 0 | ||||||||||||||||||
223 | void QDateTimeEdit::setDateRange(const QDate &min, const QDate &max) | - | ||||||||||||||||||
224 | { | - | ||||||||||||||||||
225 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
226 | if (min.isValid()
| 0 | ||||||||||||||||||
227 | setDateTimeRange(QDateTime(min, d->minimum.toTime(), d->spec), | - | ||||||||||||||||||
228 | QDateTime(max, d->maximum.toTime(), d->spec)); | - | ||||||||||||||||||
229 | } never executed: end of block | 0 | ||||||||||||||||||
230 | } never executed: end of block | 0 | ||||||||||||||||||
231 | void QDateTimeEdit::setTimeRange(const QTime &min, const QTime &max) | - | ||||||||||||||||||
232 | { | - | ||||||||||||||||||
233 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
234 | if (min.isValid()
| 0 | ||||||||||||||||||
235 | setDateTimeRange(QDateTime(d->minimum.toDate(), min, d->spec), | - | ||||||||||||||||||
236 | QDateTime(d->maximum.toDate(), max, d->spec)); | - | ||||||||||||||||||
237 | } never executed: end of block | 0 | ||||||||||||||||||
238 | } never executed: end of block | 0 | ||||||||||||||||||
239 | QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const | - | ||||||||||||||||||
240 | { | - | ||||||||||||||||||
241 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
242 | return never executed: d->sections;return d->sections; never executed: return d->sections; | 0 | ||||||||||||||||||
243 | } | - | ||||||||||||||||||
244 | QDateTimeEdit::Section QDateTimeEdit::currentSection() const | - | ||||||||||||||||||
245 | { | - | ||||||||||||||||||
246 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
247 | - | |||||||||||||||||||
248 | - | |||||||||||||||||||
249 | - | |||||||||||||||||||
250 | - | |||||||||||||||||||
251 | return never executed: d->convertToPublic(d->sectionType(d->currentSectionIndex));return d->convertToPublic(d->sectionType(d->currentSectionIndex)); never executed: return d->convertToPublic(d->sectionType(d->currentSectionIndex)); | 0 | ||||||||||||||||||
252 | } | - | ||||||||||||||||||
253 | - | |||||||||||||||||||
254 | void QDateTimeEdit::setCurrentSection(Section section) | - | ||||||||||||||||||
255 | { | - | ||||||||||||||||||
256 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
257 | if (section == NoSection
| 0 | ||||||||||||||||||
258 | return; never executed: return; | 0 | ||||||||||||||||||
259 | - | |||||||||||||||||||
260 | d->updateCache(d->value, d->displayText()); | - | ||||||||||||||||||
261 | const int size = d->sectionNodes.size(); | - | ||||||||||||||||||
262 | int index = d->currentSectionIndex + 1; | - | ||||||||||||||||||
263 | for (int i=0; i<2
| 0 | ||||||||||||||||||
264 | while (index < size
| 0 | ||||||||||||||||||
265 | if (d->convertToPublic(d->sectionType(index)) == section
| 0 | ||||||||||||||||||
266 | d->edit->setCursorPosition(d->sectionPos(index)); | - | ||||||||||||||||||
267 | if (false) QMessageLogger(__FILE__, 658, __PRETTY_FUNCTION__).debug() << d->sectionPos(index); dead code: QMessageLogger(__FILE__, 658, __PRETTY_FUNCTION__).debug() << d->sectionPos(index); | - | ||||||||||||||||||
268 | return; never executed: return; | 0 | ||||||||||||||||||
269 | } | - | ||||||||||||||||||
270 | ++index; | - | ||||||||||||||||||
271 | } never executed: end of block | 0 | ||||||||||||||||||
272 | index = 0; | - | ||||||||||||||||||
273 | } never executed: end of block | 0 | ||||||||||||||||||
274 | } never executed: end of block | 0 | ||||||||||||||||||
275 | QDateTimeEdit::Section QDateTimeEdit::sectionAt(int index) const | - | ||||||||||||||||||
276 | { | - | ||||||||||||||||||
277 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
278 | if (index < 0
| 0 | ||||||||||||||||||
279 | return never executed: NoSection;return NoSection; never executed: return NoSection; | 0 | ||||||||||||||||||
280 | return never executed: d->convertToPublic(d->sectionType(index));return d->convertToPublic(d->sectionType(index)); never executed: return d->convertToPublic(d->sectionType(index)); | 0 | ||||||||||||||||||
281 | } | - | ||||||||||||||||||
282 | int QDateTimeEdit::sectionCount() const | - | ||||||||||||||||||
283 | { | - | ||||||||||||||||||
284 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
285 | return never executed: d->sectionNodes.size();return d->sectionNodes.size(); never executed: return d->sectionNodes.size(); | 0 | ||||||||||||||||||
286 | } | - | ||||||||||||||||||
287 | int QDateTimeEdit::currentSectionIndex() const | - | ||||||||||||||||||
288 | { | - | ||||||||||||||||||
289 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
290 | return never executed: d->currentSectionIndex;return d->currentSectionIndex; never executed: return d->currentSectionIndex; | 0 | ||||||||||||||||||
291 | } | - | ||||||||||||||||||
292 | - | |||||||||||||||||||
293 | void QDateTimeEdit::setCurrentSectionIndex(int index) | - | ||||||||||||||||||
294 | { | - | ||||||||||||||||||
295 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
296 | if (index < 0
| 0 | ||||||||||||||||||
297 | return; never executed: return; | 0 | ||||||||||||||||||
298 | d->edit->setCursorPosition(d->sectionPos(index)); | - | ||||||||||||||||||
299 | } never executed: end of block | 0 | ||||||||||||||||||
300 | QCalendarWidget *QDateTimeEdit::calendarWidget() const | - | ||||||||||||||||||
301 | { | - | ||||||||||||||||||
302 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
303 | if (!d->calendarPopup
| 0 | ||||||||||||||||||
304 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
305 | if (!d->monthCalendar
| 0 | ||||||||||||||||||
306 | const_cast<QDateTimeEditPrivate*>(d)->initCalendarPopup(); | - | ||||||||||||||||||
307 | } never executed: end of block | 0 | ||||||||||||||||||
308 | return never executed: d->monthCalendar->calendarWidget();return d->monthCalendar->calendarWidget(); never executed: return d->monthCalendar->calendarWidget(); | 0 | ||||||||||||||||||
309 | } | - | ||||||||||||||||||
310 | void QDateTimeEdit::setCalendarWidget(QCalendarWidget *calendarWidget) | - | ||||||||||||||||||
311 | { | - | ||||||||||||||||||
312 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
313 | if (!calendarWidget
| 0 | ||||||||||||||||||
314 | QMessageLogger(__FILE__, 764, __PRETTY_FUNCTION__).warning("QDateTimeEdit::setCalendarWidget: Cannot set a null calendar widget"); | - | ||||||||||||||||||
315 | return; never executed: return; | 0 | ||||||||||||||||||
316 | } | - | ||||||||||||||||||
317 | - | |||||||||||||||||||
318 | if (!d->calendarPopup
| 0 | ||||||||||||||||||
319 | QMessageLogger(__FILE__, 769, __PRETTY_FUNCTION__).warning("QDateTimeEdit::setCalendarWidget: calendarPopup is set to false"); | - | ||||||||||||||||||
320 | return; never executed: return; | 0 | ||||||||||||||||||
321 | } | - | ||||||||||||||||||
322 | - | |||||||||||||||||||
323 | if (!(d->display & QDateTimeParser::DateSectionMask)
| 0 | ||||||||||||||||||
324 | QMessageLogger(__FILE__, 774, __PRETTY_FUNCTION__).warning("QDateTimeEdit::setCalendarWidget: no date sections specified"); | - | ||||||||||||||||||
325 | return; never executed: return; | 0 | ||||||||||||||||||
326 | } | - | ||||||||||||||||||
327 | d->initCalendarPopup(calendarWidget); | - | ||||||||||||||||||
328 | } never executed: end of block | 0 | ||||||||||||||||||
329 | void QDateTimeEdit::setSelectedSection(Section section) | - | ||||||||||||||||||
330 | { | - | ||||||||||||||||||
331 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
332 | if (section == NoSection
| 0 | ||||||||||||||||||
333 | d->edit->setSelection(d->edit->cursorPosition(), 0); | - | ||||||||||||||||||
334 | } never executed: else if (section & d->sectionsend of block
| 0 | ||||||||||||||||||
335 | if (currentSection() != section
| 0 | ||||||||||||||||||
336 | setCurrentSection(section); never executed: setCurrentSection(section); | 0 | ||||||||||||||||||
337 | d->setSelected(d->currentSectionIndex); | - | ||||||||||||||||||
338 | } never executed: end of block | 0 | ||||||||||||||||||
339 | } never executed: end of block | 0 | ||||||||||||||||||
340 | QString QDateTimeEdit::sectionText(Section section) const | - | ||||||||||||||||||
341 | { | - | ||||||||||||||||||
342 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
343 | if (section == QDateTimeEdit::NoSection
| 0 | ||||||||||||||||||
344 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||||||||
345 | } | - | ||||||||||||||||||
346 | - | |||||||||||||||||||
347 | d->updateCache(d->value, d->displayText()); | - | ||||||||||||||||||
348 | const int sectionIndex = d->absoluteIndex(section, 0); | - | ||||||||||||||||||
349 | return never executed: d->sectionText(sectionIndex);return d->sectionText(sectionIndex); never executed: return d->sectionText(sectionIndex); | 0 | ||||||||||||||||||
350 | } | - | ||||||||||||||||||
351 | QString QDateTimeEdit::displayFormat() const | - | ||||||||||||||||||
352 | { | - | ||||||||||||||||||
353 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
354 | return never executed: isRightToLeft()return isRightToLeft() ? d->unreversedFormat : d->displayFormat;
never executed: return isRightToLeft() ? d->unreversedFormat : d->displayFormat; | 0 | ||||||||||||||||||
355 | } | - | ||||||||||||||||||
356 | - | |||||||||||||||||||
357 | template<typename C> static inline C reverse(const C &l) | - | ||||||||||||||||||
358 | { | - | ||||||||||||||||||
359 | C ret; | - | ||||||||||||||||||
360 | for (int i=l.size() - 1; i>=0
| 0 | ||||||||||||||||||
361 | ret.append(l.at(i)); never executed: ret.append(l.at(i)); | 0 | ||||||||||||||||||
362 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
363 | } | - | ||||||||||||||||||
364 | - | |||||||||||||||||||
365 | void QDateTimeEdit::setDisplayFormat(const QString &format) | - | ||||||||||||||||||
366 | { | - | ||||||||||||||||||
367 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
368 | if (d->parseFormat(format)
| 0 | ||||||||||||||||||
369 | d->unreversedFormat.clear(); | - | ||||||||||||||||||
370 | if (isRightToLeft()
| 0 | ||||||||||||||||||
371 | d->unreversedFormat = format; | - | ||||||||||||||||||
372 | d->displayFormat.clear(); | - | ||||||||||||||||||
373 | for (int i=d->sectionNodes.size() - 1; i>=0
| 0 | ||||||||||||||||||
374 | d->displayFormat += d->separators.at(i + 1); | - | ||||||||||||||||||
375 | d->displayFormat += d->sectionNode(i).format(); | - | ||||||||||||||||||
376 | } never executed: end of block | 0 | ||||||||||||||||||
377 | d->displayFormat += d->separators.at(0); | - | ||||||||||||||||||
378 | d->separators = reverse(d->separators); | - | ||||||||||||||||||
379 | d->sectionNodes = reverse(d->sectionNodes); | - | ||||||||||||||||||
380 | } never executed: end of block | 0 | ||||||||||||||||||
381 | - | |||||||||||||||||||
382 | d->formatExplicitlySet = true; | - | ||||||||||||||||||
383 | d->sections = d->convertSections(d->display); | - | ||||||||||||||||||
384 | d->clearCache(); | - | ||||||||||||||||||
385 | - | |||||||||||||||||||
386 | d->currentSectionIndex = qMin(d->currentSectionIndex, d->sectionNodes.size() - 1); | - | ||||||||||||||||||
387 | const bool timeShown = (d->sections & TimeSections_Mask); | - | ||||||||||||||||||
388 | const bool dateShown = (d->sections & DateSections_Mask); | - | ||||||||||||||||||
389 | ((!(dateShown || timeShown)) ? qt_assert("dateShown || timeShown",__FILE__,890) : qt_noop()); | - | ||||||||||||||||||
390 | if (timeShown
| 0 | ||||||||||||||||||
391 | QTime time = d->value.toTime(); | - | ||||||||||||||||||
392 | setDateRange(d->value.toDate(), d->value.toDate()); | - | ||||||||||||||||||
393 | if (d->minimum.toTime() >= d->maximum.toTime()
| 0 | ||||||||||||||||||
394 | setTimeRange(QTime(0, 0, 0, 0), QTime(23, 59, 59, 999)); | - | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | setTime(time); | - | ||||||||||||||||||
397 | } never executed: end of block | 0 | ||||||||||||||||||
398 | } never executed: else if (dateShownend of block
| 0 | ||||||||||||||||||
399 | setTimeRange(QTime(0, 0, 0, 0), QTime(23, 59, 59, 999)); | - | ||||||||||||||||||
400 | d->value = QDateTime(d->value.toDate(), QTime(), d->spec); | - | ||||||||||||||||||
401 | } never executed: end of block | 0 | ||||||||||||||||||
402 | d->updateEdit(); | - | ||||||||||||||||||
403 | d->_q_editorCursorPositionChanged(-1, 0); | - | ||||||||||||||||||
404 | } never executed: end of block | 0 | ||||||||||||||||||
405 | } never executed: end of block | 0 | ||||||||||||||||||
406 | bool QDateTimeEdit::calendarPopup() const | - | ||||||||||||||||||
407 | { | - | ||||||||||||||||||
408 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
409 | return never executed: d->calendarPopup;return d->calendarPopup; never executed: return d->calendarPopup; | 0 | ||||||||||||||||||
410 | } | - | ||||||||||||||||||
411 | - | |||||||||||||||||||
412 | void QDateTimeEdit::setCalendarPopup(bool enable) | - | ||||||||||||||||||
413 | { | - | ||||||||||||||||||
414 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
415 | if (enable == d->calendarPopup
| 0 | ||||||||||||||||||
416 | return; never executed: return; | 0 | ||||||||||||||||||
417 | setAttribute(Qt::WA_MacShowFocusRect, !enable); | - | ||||||||||||||||||
418 | d->calendarPopup = enable; | - | ||||||||||||||||||
419 | - | |||||||||||||||||||
420 | - | |||||||||||||||||||
421 | - | |||||||||||||||||||
422 | - | |||||||||||||||||||
423 | d->updateEditFieldGeometry(); | - | ||||||||||||||||||
424 | update(); | - | ||||||||||||||||||
425 | } never executed: end of block | 0 | ||||||||||||||||||
426 | - | |||||||||||||||||||
427 | - | |||||||||||||||||||
428 | - | |||||||||||||||||||
429 | - | |||||||||||||||||||
430 | - | |||||||||||||||||||
431 | - | |||||||||||||||||||
432 | - | |||||||||||||||||||
433 | Qt::TimeSpec QDateTimeEdit::timeSpec() const | - | ||||||||||||||||||
434 | { | - | ||||||||||||||||||
435 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
436 | return never executed: d->spec;return d->spec; never executed: return d->spec; | 0 | ||||||||||||||||||
437 | } | - | ||||||||||||||||||
438 | - | |||||||||||||||||||
439 | void QDateTimeEdit::setTimeSpec(Qt::TimeSpec spec) | - | ||||||||||||||||||
440 | { | - | ||||||||||||||||||
441 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
442 | if (spec != d->spec
| 0 | ||||||||||||||||||
443 | d->spec = spec; | - | ||||||||||||||||||
444 | d->updateTimeSpec(); | - | ||||||||||||||||||
445 | } never executed: end of block | 0 | ||||||||||||||||||
446 | } never executed: end of block | 0 | ||||||||||||||||||
447 | - | |||||||||||||||||||
448 | - | |||||||||||||||||||
449 | - | |||||||||||||||||||
450 | - | |||||||||||||||||||
451 | - | |||||||||||||||||||
452 | QSize QDateTimeEdit::sizeHint() const | - | ||||||||||||||||||
453 | { | - | ||||||||||||||||||
454 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
455 | if (d->cachedSizeHint.isEmpty()
| 0 | ||||||||||||||||||
456 | ensurePolished(); | - | ||||||||||||||||||
457 | - | |||||||||||||||||||
458 | const QFontMetrics fm(fontMetrics()); | - | ||||||||||||||||||
459 | int h = d->edit->sizeHint().height(); | - | ||||||||||||||||||
460 | int w = 0; | - | ||||||||||||||||||
461 | QString s; | - | ||||||||||||||||||
462 | s = d->textFromValue(d->minimum) + QLatin1Char(' '); | - | ||||||||||||||||||
463 | w = qMax<int>(w, fm.width(s)); | - | ||||||||||||||||||
464 | s = d->textFromValue(d->maximum) + QLatin1Char(' '); | - | ||||||||||||||||||
465 | w = qMax<int>(w, fm.width(s)); | - | ||||||||||||||||||
466 | if (d->specialValueText.size()
| 0 | ||||||||||||||||||
467 | s = d->specialValueText; | - | ||||||||||||||||||
468 | w = qMax<int>(w, fm.width(s)); | - | ||||||||||||||||||
469 | } never executed: end of block | 0 | ||||||||||||||||||
470 | w += 2; | - | ||||||||||||||||||
471 | - | |||||||||||||||||||
472 | QSize hint(w, h); | - | ||||||||||||||||||
473 | - | |||||||||||||||||||
474 | - | |||||||||||||||||||
475 | - | |||||||||||||||||||
476 | - | |||||||||||||||||||
477 | - | |||||||||||||||||||
478 | - | |||||||||||||||||||
479 | - | |||||||||||||||||||
480 | { | - | ||||||||||||||||||
481 | QStyleOptionSpinBox opt; | - | ||||||||||||||||||
482 | initStyleOption(&opt); | - | ||||||||||||||||||
483 | d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) | - | ||||||||||||||||||
484 | .expandedTo(QApplication::globalStrut()); | - | ||||||||||||||||||
485 | } | - | ||||||||||||||||||
486 | - | |||||||||||||||||||
487 | d->cachedMinimumSizeHint = d->cachedSizeHint; | - | ||||||||||||||||||
488 | - | |||||||||||||||||||
489 | } never executed: end of block | 0 | ||||||||||||||||||
490 | return never executed: d->cachedSizeHint;return d->cachedSizeHint; never executed: return d->cachedSizeHint; | 0 | ||||||||||||||||||
491 | } | - | ||||||||||||||||||
492 | - | |||||||||||||||||||
493 | - | |||||||||||||||||||
494 | - | |||||||||||||||||||
495 | - | |||||||||||||||||||
496 | - | |||||||||||||||||||
497 | - | |||||||||||||||||||
498 | bool QDateTimeEdit::event(QEvent *event) | - | ||||||||||||||||||
499 | { | - | ||||||||||||||||||
500 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
501 | switch (event->type()) { | - | ||||||||||||||||||
502 | case never executed: QEvent::ApplicationLayoutDirectionChange:case QEvent::ApplicationLayoutDirectionChange: never executed: {case QEvent::ApplicationLayoutDirectionChange: | 0 | ||||||||||||||||||
503 | const bool was = d->formatExplicitlySet; | - | ||||||||||||||||||
504 | const QString oldFormat = d->displayFormat; | - | ||||||||||||||||||
505 | d->displayFormat.clear(); | - | ||||||||||||||||||
506 | setDisplayFormat(oldFormat); | - | ||||||||||||||||||
507 | d->formatExplicitlySet = was; | - | ||||||||||||||||||
508 | break; never executed: }break; | 0 | ||||||||||||||||||
509 | case never executed: QEvent::LocaleChange:case QEvent::LocaleChange: never executed: case QEvent::LocaleChange: | 0 | ||||||||||||||||||
510 | d->updateEdit(); | - | ||||||||||||||||||
511 | break; never executed: break; | 0 | ||||||||||||||||||
512 | case never executed: QEvent::StyleChange:case QEvent::StyleChange: never executed: case QEvent::StyleChange: | 0 | ||||||||||||||||||
513 | - | |||||||||||||||||||
514 | - | |||||||||||||||||||
515 | - | |||||||||||||||||||
516 | d->setLayoutItemMargins(QStyle::SE_DateTimeEditLayoutItem); | - | ||||||||||||||||||
517 | break; never executed: break; | 0 | ||||||||||||||||||
518 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
519 | break; never executed: break; | 0 | ||||||||||||||||||
520 | } | - | ||||||||||||||||||
521 | return never executed: QAbstractSpinBox::event(event);return QAbstractSpinBox::event(event); never executed: return QAbstractSpinBox::event(event); | 0 | ||||||||||||||||||
522 | } | - | ||||||||||||||||||
523 | - | |||||||||||||||||||
524 | - | |||||||||||||||||||
525 | - | |||||||||||||||||||
526 | - | |||||||||||||||||||
527 | - | |||||||||||||||||||
528 | void QDateTimeEdit::clear() | - | ||||||||||||||||||
529 | { | - | ||||||||||||||||||
530 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
531 | d->clearSection(d->currentSectionIndex); | - | ||||||||||||||||||
532 | } never executed: end of block | 0 | ||||||||||||||||||
533 | - | |||||||||||||||||||
534 | - | |||||||||||||||||||
535 | - | |||||||||||||||||||
536 | - | |||||||||||||||||||
537 | void QDateTimeEdit::keyPressEvent(QKeyEvent *event) | - | ||||||||||||||||||
538 | { | - | ||||||||||||||||||
539 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
540 | int oldCurrent = d->currentSectionIndex; | - | ||||||||||||||||||
541 | bool select = true; | - | ||||||||||||||||||
542 | bool inserted = false; | - | ||||||||||||||||||
543 | - | |||||||||||||||||||
544 | switch (event->key()) { | - | ||||||||||||||||||
545 | case never executed: Qt::Key_Enter:case Qt::Key_Enter: never executed: case Qt::Key_Enter: | 0 | ||||||||||||||||||
546 | case never executed: Qt::Key_Return:case Qt::Key_Return: never executed: case Qt::Key_Return: | 0 | ||||||||||||||||||
547 | d->interpret(AlwaysEmit); | - | ||||||||||||||||||
548 | d->setSelected(d->currentSectionIndex, true); | - | ||||||||||||||||||
549 | event->ignore(); | - | ||||||||||||||||||
550 | editingFinished(); | - | ||||||||||||||||||
551 | return; never executed: return; | 0 | ||||||||||||||||||
552 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
553 | if (!d->isSeparatorKey(event)
| 0 | ||||||||||||||||||
554 | inserted = select = !event->text().isEmpty()
| 0 | ||||||||||||||||||
555 | && !(event->modifiers() & ~(Qt::ShiftModifier|Qt::KeypadModifier))
| 0 | ||||||||||||||||||
556 | break; never executed: break; | 0 | ||||||||||||||||||
557 | } | - | ||||||||||||||||||
558 | case never executed: Qt::Key_Left:case Qt::Key_Left: never executed: case Qt::Key_Left: code before this statement never executed: case Qt::Key_Left: | 0 | ||||||||||||||||||
559 | case never executed: Qt::Key_Right:case Qt::Key_Right: never executed: case Qt::Key_Right: | 0 | ||||||||||||||||||
560 | if (event->key() == Qt::Key_Left
| 0 | ||||||||||||||||||
561 | if ( | - | ||||||||||||||||||
562 | - | |||||||||||||||||||
563 | - | |||||||||||||||||||
564 | - | |||||||||||||||||||
565 | - | |||||||||||||||||||
566 | !(event->modifiers() & Qt::ControlModifier)
| 0 | ||||||||||||||||||
567 | select = false; | - | ||||||||||||||||||
568 | break; never executed: break; | 0 | ||||||||||||||||||
569 | } | - | ||||||||||||||||||
570 | } never executed: end of block | 0 | ||||||||||||||||||
571 | - | |||||||||||||||||||
572 | case never executed: Qt::Key_Backtab:case Qt::Key_Backtab: never executed: case Qt::Key_Backtab: code before this statement never executed: case Qt::Key_Backtab: | 0 | ||||||||||||||||||
573 | case never executed: Qt::Key_Tab:case Qt::Key_Tab: never executed: {case Qt::Key_Tab: | 0 | ||||||||||||||||||
574 | event->accept(); | - | ||||||||||||||||||
575 | if (d->specialValue()
| 0 | ||||||||||||||||||
576 | d->edit->setSelection(d->edit->cursorPosition(), 0); | - | ||||||||||||||||||
577 | return; never executed: return; | 0 | ||||||||||||||||||
578 | } | - | ||||||||||||||||||
579 | const bool forward = event->key() != Qt::Key_Left
| 0 | ||||||||||||||||||
580 | && (event->key() != Qt::Key_Tab
| 0 | ||||||||||||||||||
581 | if (event->key() != Qt::Key_Backtab
| 0 | ||||||||||||||||||
582 | focusNextPrevChild(forward); never executed: focusNextPrevChild(forward); | 0 | ||||||||||||||||||
583 | - | |||||||||||||||||||
584 | return; never executed: }return; | 0 | ||||||||||||||||||
585 | } | - | ||||||||||||||||||
586 | QAbstractSpinBox::keyPressEvent(event); | - | ||||||||||||||||||
587 | if (select
| 0 | ||||||||||||||||||
588 | if (inserted
| 0 | ||||||||||||||||||
589 | QString str = d->displayText(); | - | ||||||||||||||||||
590 | int pos = d->edit->cursorPosition(); | - | ||||||||||||||||||
591 | if (validate(str, pos) == QValidator::Acceptable
| 0 | ||||||||||||||||||
592 | && (d->sectionNodes.at(oldCurrent).count != 1
| 0 | ||||||||||||||||||
593 | || d->sectionMaxSize(oldCurrent) == d->sectionSize(oldCurrent)
| 0 | ||||||||||||||||||
594 | || d->skipToNextSection(oldCurrent, d->value.toDateTime(), d->sectionText(oldCurrent))
| 0 | ||||||||||||||||||
595 | if (false) QMessageLogger(__FILE__, 1181, __PRETTY_FUNCTION__).debug() << "Setting currentsection to" dead code: QMessageLogger(__FILE__, 1181, __PRETTY_FUNCTION__).debug() << "Setting currentsection to" << d->closestSection(d->edit->cursorPosition(), true) << event->key() << oldCurrent << str; | - | ||||||||||||||||||
596 | << d->closestSection(d->edit->cursorPosition(), true) << event->key() dead code: QMessageLogger(__FILE__, 1181, __PRETTY_FUNCTION__).debug() << "Setting currentsection to" << d->closestSection(d->edit->cursorPosition(), true) << event->key() << oldCurrent << str; | - | ||||||||||||||||||
597 | << oldCurrent << str; dead code: QMessageLogger(__FILE__, 1181, __PRETTY_FUNCTION__).debug() << "Setting currentsection to" << d->closestSection(d->edit->cursorPosition(), true) << event->key() << oldCurrent << str; | - | ||||||||||||||||||
598 | const int tmp = d->closestSection(d->edit->cursorPosition(), true); | - | ||||||||||||||||||
599 | if (tmp >= 0
| 0 | ||||||||||||||||||
600 | d->currentSectionIndex = tmp; never executed: d->currentSectionIndex = tmp; | 0 | ||||||||||||||||||
601 | } never executed: end of block | 0 | ||||||||||||||||||
602 | } never executed: end of block | 0 | ||||||||||||||||||
603 | if (d->currentSectionIndex != oldCurrent
| 0 | ||||||||||||||||||
604 | d->setSelected(d->currentSectionIndex); | - | ||||||||||||||||||
605 | } never executed: end of block | 0 | ||||||||||||||||||
606 | } never executed: end of block | 0 | ||||||||||||||||||
607 | if (d->specialValue()
| 0 | ||||||||||||||||||
608 | d->edit->setSelection(d->edit->cursorPosition(), 0); | - | ||||||||||||||||||
609 | } never executed: end of block | 0 | ||||||||||||||||||
610 | } never executed: end of block | 0 | ||||||||||||||||||
611 | - | |||||||||||||||||||
612 | - | |||||||||||||||||||
613 | - | |||||||||||||||||||
614 | - | |||||||||||||||||||
615 | - | |||||||||||||||||||
616 | - | |||||||||||||||||||
617 | void QDateTimeEdit::wheelEvent(QWheelEvent *event) | - | ||||||||||||||||||
618 | { | - | ||||||||||||||||||
619 | QAbstractSpinBox::wheelEvent(event); | - | ||||||||||||||||||
620 | } never executed: end of block | 0 | ||||||||||||||||||
621 | - | |||||||||||||||||||
622 | - | |||||||||||||||||||
623 | - | |||||||||||||||||||
624 | - | |||||||||||||||||||
625 | - | |||||||||||||||||||
626 | - | |||||||||||||||||||
627 | void QDateTimeEdit::focusInEvent(QFocusEvent *event) | - | ||||||||||||||||||
628 | { | - | ||||||||||||||||||
629 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
630 | QAbstractSpinBox::focusInEvent(event); | - | ||||||||||||||||||
631 | QString *frm = 0; | - | ||||||||||||||||||
632 | const int oldPos = d->edit->cursorPosition(); | - | ||||||||||||||||||
633 | if (!d->formatExplicitlySet
| 0 | ||||||||||||||||||
634 | if (d->displayFormat == d->defaultTimeFormat
| 0 | ||||||||||||||||||
635 | frm = &d->defaultTimeFormat; | - | ||||||||||||||||||
636 | } never executed: else if (d->displayFormat == d->defaultDateFormatend of block
| 0 | ||||||||||||||||||
637 | frm = &d->defaultDateFormat; | - | ||||||||||||||||||
638 | } never executed: else if (d->displayFormat == d->defaultDateTimeFormatend of block
| 0 | ||||||||||||||||||
639 | frm = &d->defaultDateTimeFormat; | - | ||||||||||||||||||
640 | } never executed: end of block | 0 | ||||||||||||||||||
641 | - | |||||||||||||||||||
642 | if (frm
| 0 | ||||||||||||||||||
643 | d->readLocaleSettings(); | - | ||||||||||||||||||
644 | if (d->displayFormat != *frm
| 0 | ||||||||||||||||||
645 | setDisplayFormat(*frm); | - | ||||||||||||||||||
646 | d->formatExplicitlySet = false; | - | ||||||||||||||||||
647 | d->edit->setCursorPosition(oldPos); | - | ||||||||||||||||||
648 | } never executed: end of block | 0 | ||||||||||||||||||
649 | } never executed: end of block | 0 | ||||||||||||||||||
650 | } never executed: end of block | 0 | ||||||||||||||||||
651 | const bool oldHasHadFocus = d->hasHadFocus; | - | ||||||||||||||||||
652 | d->hasHadFocus = true; | - | ||||||||||||||||||
653 | bool first = true; | - | ||||||||||||||||||
654 | switch (event->reason()) { | - | ||||||||||||||||||
655 | case never executed: Qt::BacktabFocusReason:case Qt::BacktabFocusReason: never executed: case Qt::BacktabFocusReason: | 0 | ||||||||||||||||||
656 | first = false; | - | ||||||||||||||||||
657 | break; never executed: break; | 0 | ||||||||||||||||||
658 | case never executed: Qt::MouseFocusReason:case Qt::MouseFocusReason: never executed: case Qt::MouseFocusReason: | 0 | ||||||||||||||||||
659 | case never executed: Qt::PopupFocusReason:case Qt::PopupFocusReason: never executed: case Qt::PopupFocusReason: | 0 | ||||||||||||||||||
660 | return; never executed: return; | 0 | ||||||||||||||||||
661 | case never executed: Qt::ActiveWindowFocusReason:case Qt::ActiveWindowFocusReason: never executed: case Qt::ActiveWindowFocusReason: | 0 | ||||||||||||||||||
662 | if (oldHasHadFocus
| 0 | ||||||||||||||||||
663 | return; never executed: return; | 0 | ||||||||||||||||||
664 | case never executed: Qt::ShortcutFocusReason:case Qt::ShortcutFocusReason: never executed: case Qt::ShortcutFocusReason: code before this statement never executed: case Qt::ShortcutFocusReason: | 0 | ||||||||||||||||||
665 | case never executed: Qt::TabFocusReason:case Qt::TabFocusReason: never executed: case Qt::TabFocusReason: | 0 | ||||||||||||||||||
666 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
667 | break; never executed: break; | 0 | ||||||||||||||||||
668 | } | - | ||||||||||||||||||
669 | if (isRightToLeft()
| 0 | ||||||||||||||||||
670 | first = !first; never executed: first = !first; | 0 | ||||||||||||||||||
671 | d->updateEdit(); | - | ||||||||||||||||||
672 | - | |||||||||||||||||||
673 | d->setSelected(first ? 0 : d->sectionNodes.size() - 1); | - | ||||||||||||||||||
674 | } never executed: end of block | 0 | ||||||||||||||||||
675 | - | |||||||||||||||||||
676 | - | |||||||||||||||||||
677 | - | |||||||||||||||||||
678 | - | |||||||||||||||||||
679 | - | |||||||||||||||||||
680 | bool QDateTimeEdit::focusNextPrevChild(bool next) | - | ||||||||||||||||||
681 | { | - | ||||||||||||||||||
682 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
683 | const int newSection = d->nextPrevSection(d->currentSectionIndex, next); | - | ||||||||||||||||||
684 | switch (d->sectionType(newSection)) { | - | ||||||||||||||||||
685 | case never executed: QDateTimeParser::NoSection:case QDateTimeParser::NoSection: never executed: case QDateTimeParser::NoSection: | 0 | ||||||||||||||||||
686 | case never executed: QDateTimeParser::FirstSection:case QDateTimeParser::FirstSection: never executed: case QDateTimeParser::FirstSection: | 0 | ||||||||||||||||||
687 | case never executed: QDateTimeParser::LastSection:case QDateTimeParser::LastSection: never executed: case QDateTimeParser::LastSection: | 0 | ||||||||||||||||||
688 | return never executed: QAbstractSpinBox::focusNextPrevChild(next);return QAbstractSpinBox::focusNextPrevChild(next); never executed: return QAbstractSpinBox::focusNextPrevChild(next); | 0 | ||||||||||||||||||
689 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
690 | d->edit->deselect(); | - | ||||||||||||||||||
691 | d->edit->setCursorPosition(d->sectionPos(newSection)); | - | ||||||||||||||||||
692 | if (false) QMessageLogger(__FILE__, 1278, __PRETTY_FUNCTION__).debug() << d->sectionPos(newSection); dead code: QMessageLogger(__FILE__, 1278, __PRETTY_FUNCTION__).debug() << d->sectionPos(newSection); | - | ||||||||||||||||||
693 | d->setSelected(newSection, true); | - | ||||||||||||||||||
694 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
695 | } | - | ||||||||||||||||||
696 | } | - | ||||||||||||||||||
697 | - | |||||||||||||||||||
698 | - | |||||||||||||||||||
699 | - | |||||||||||||||||||
700 | - | |||||||||||||||||||
701 | - | |||||||||||||||||||
702 | void QDateTimeEdit::stepBy(int steps) | - | ||||||||||||||||||
703 | { | - | ||||||||||||||||||
704 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
705 | if (d->specialValue()
| 0 | ||||||||||||||||||
706 | for (int i=0; i<d->sectionNodes.size()
| 0 | ||||||||||||||||||
707 | if (d->sectionType(i) != QDateTimeParser::AmPmSection
| 0 | ||||||||||||||||||
708 | d->currentSectionIndex = i; | - | ||||||||||||||||||
709 | break; never executed: break; | 0 | ||||||||||||||||||
710 | } | - | ||||||||||||||||||
711 | } never executed: end of block | 0 | ||||||||||||||||||
712 | } never executed: end of block | 0 | ||||||||||||||||||
713 | d->setValue(d->stepBy(d->currentSectionIndex, steps, false), EmitIfChanged); | - | ||||||||||||||||||
714 | d->updateCache(d->value, d->displayText()); | - | ||||||||||||||||||
715 | - | |||||||||||||||||||
716 | d->setSelected(d->currentSectionIndex); | - | ||||||||||||||||||
717 | d->updateTimeSpec(); | - | ||||||||||||||||||
718 | } never executed: end of block | 0 | ||||||||||||||||||
719 | QString QDateTimeEdit::textFromDateTime(const QDateTime &dateTime) const | - | ||||||||||||||||||
720 | { | - | ||||||||||||||||||
721 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
722 | return never executed: locale().toString(dateTime, d->displayFormat);return locale().toString(dateTime, d->displayFormat); never executed: return locale().toString(dateTime, d->displayFormat); | 0 | ||||||||||||||||||
723 | } | - | ||||||||||||||||||
724 | QDateTime QDateTimeEdit::dateTimeFromText(const QString &text) const | - | ||||||||||||||||||
725 | { | - | ||||||||||||||||||
726 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
727 | QString copy = text; | - | ||||||||||||||||||
728 | int pos = d->edit->cursorPosition(); | - | ||||||||||||||||||
729 | QValidator::State state = QValidator::Acceptable; | - | ||||||||||||||||||
730 | return never executed: d->validateAndInterpret(copy, pos, state);return d->validateAndInterpret(copy, pos, state); never executed: return d->validateAndInterpret(copy, pos, state); | 0 | ||||||||||||||||||
731 | } | - | ||||||||||||||||||
732 | - | |||||||||||||||||||
733 | - | |||||||||||||||||||
734 | - | |||||||||||||||||||
735 | - | |||||||||||||||||||
736 | - | |||||||||||||||||||
737 | QValidator::State QDateTimeEdit::validate(QString &text, int &pos) const | - | ||||||||||||||||||
738 | { | - | ||||||||||||||||||
739 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
740 | QValidator::State state; | - | ||||||||||||||||||
741 | d->validateAndInterpret(text, pos, state); | - | ||||||||||||||||||
742 | return never executed: state;return state; never executed: return state; | 0 | ||||||||||||||||||
743 | } | - | ||||||||||||||||||
744 | - | |||||||||||||||||||
745 | - | |||||||||||||||||||
746 | - | |||||||||||||||||||
747 | - | |||||||||||||||||||
748 | - | |||||||||||||||||||
749 | - | |||||||||||||||||||
750 | void QDateTimeEdit::fixup(QString &input) const | - | ||||||||||||||||||
751 | { | - | ||||||||||||||||||
752 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
753 | QValidator::State state; | - | ||||||||||||||||||
754 | int copy = d->edit->cursorPosition(); | - | ||||||||||||||||||
755 | - | |||||||||||||||||||
756 | d->validateAndInterpret(input, copy, state, true); | - | ||||||||||||||||||
757 | } never executed: end of block | 0 | ||||||||||||||||||
758 | - | |||||||||||||||||||
759 | - | |||||||||||||||||||
760 | - | |||||||||||||||||||
761 | - | |||||||||||||||||||
762 | - | |||||||||||||||||||
763 | - | |||||||||||||||||||
764 | QDateTimeEdit::StepEnabled QDateTimeEdit::stepEnabled() const | - | ||||||||||||||||||
765 | { | - | ||||||||||||||||||
766 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
767 | if (d->readOnly
| 0 | ||||||||||||||||||
768 | return never executed: StepEnabled(0);return StepEnabled(0); never executed: return StepEnabled(0); | 0 | ||||||||||||||||||
769 | if (d->specialValue()
| 0 | ||||||||||||||||||
770 | return never executed: (d->minimum == d->maximumreturn (d->minimum == d->maximum ? StepEnabled(0) : StepEnabled(StepUpEnabled));
never executed: return (d->minimum == d->maximum ? StepEnabled(0) : StepEnabled(StepUpEnabled)); | 0 | ||||||||||||||||||
771 | } | - | ||||||||||||||||||
772 | - | |||||||||||||||||||
773 | QAbstractSpinBox::StepEnabled ret = 0; | - | ||||||||||||||||||
774 | switch (d->sectionType(d->currentSectionIndex)) { | - | ||||||||||||||||||
775 | case never executed: QDateTimeParser::NoSection:case QDateTimeParser::NoSection: never executed: case QDateTimeParser::NoSection: | 0 | ||||||||||||||||||
776 | case never executed: QDateTimeParser::FirstSection:case QDateTimeParser::FirstSection: never executed: case QDateTimeParser::FirstSection: | 0 | ||||||||||||||||||
777 | case never executed: QDateTimeParser::LastSection:case QDateTimeParser::LastSection: never executed: returncase QDateTimeParser::LastSection: never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
778 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||
779 | } | - | ||||||||||||||||||
780 | if (d->wrapping
| 0 | ||||||||||||||||||
781 | return never executed: StepEnabled(StepDownEnabled|StepUpEnabled);return StepEnabled(StepDownEnabled|StepUpEnabled); never executed: return StepEnabled(StepDownEnabled|StepUpEnabled); | 0 | ||||||||||||||||||
782 | - | |||||||||||||||||||
783 | QVariant v = d->stepBy(d->currentSectionIndex, 1, true); | - | ||||||||||||||||||
784 | if (v != d->value
| 0 | ||||||||||||||||||
785 | ret |= QAbstractSpinBox::StepUpEnabled; | - | ||||||||||||||||||
786 | } never executed: end of block | 0 | ||||||||||||||||||
787 | v = d->stepBy(d->currentSectionIndex, -1, true); | - | ||||||||||||||||||
788 | if (v != d->value
| 0 | ||||||||||||||||||
789 | ret |= QAbstractSpinBox::StepDownEnabled; | - | ||||||||||||||||||
790 | } never executed: end of block | 0 | ||||||||||||||||||
791 | - | |||||||||||||||||||
792 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
793 | } | - | ||||||||||||||||||
794 | - | |||||||||||||||||||
795 | - | |||||||||||||||||||
796 | - | |||||||||||||||||||
797 | - | |||||||||||||||||||
798 | - | |||||||||||||||||||
799 | - | |||||||||||||||||||
800 | void QDateTimeEdit::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||
801 | { | - | ||||||||||||||||||
802 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
803 | if (!d->calendarPopupEnabled()
| 0 | ||||||||||||||||||
804 | QAbstractSpinBox::mousePressEvent(event); | - | ||||||||||||||||||
805 | return; never executed: return; | 0 | ||||||||||||||||||
806 | } | - | ||||||||||||||||||
807 | d->updateHoverControl(event->pos()); | - | ||||||||||||||||||
808 | if (d->hoverControl == QStyle::SC_ComboBoxArrow
| 0 | ||||||||||||||||||
809 | event->accept(); | - | ||||||||||||||||||
810 | if (d->readOnly
| 0 | ||||||||||||||||||
811 | return; never executed: return; | 0 | ||||||||||||||||||
812 | } | - | ||||||||||||||||||
813 | d->updateArrow(QStyle::State_Sunken); | - | ||||||||||||||||||
814 | d->initCalendarPopup(); | - | ||||||||||||||||||
815 | d->positionCalendarPopup(); | - | ||||||||||||||||||
816 | - | |||||||||||||||||||
817 | d->monthCalendar->show(); | - | ||||||||||||||||||
818 | } never executed: else {end of block | 0 | ||||||||||||||||||
819 | QAbstractSpinBox::mousePressEvent(event); | - | ||||||||||||||||||
820 | } never executed: end of block | 0 | ||||||||||||||||||
821 | } | - | ||||||||||||||||||
822 | QTimeEdit::QTimeEdit(QWidget *parent) | - | ||||||||||||||||||
823 | : QDateTimeEdit(QTime(0, 0, 0, 0), QVariant::Time, parent) | - | ||||||||||||||||||
824 | { | - | ||||||||||||||||||
825 | connect(this, qFlagLocation("2""timeChanged(QTime)" "\0" __FILE__ ":" "1539"), qFlagLocation("2""userTimeChanged(QTime)" "\0" __FILE__ ":" "1539")); | - | ||||||||||||||||||
826 | } never executed: end of block | 0 | ||||||||||||||||||
827 | - | |||||||||||||||||||
828 | - | |||||||||||||||||||
829 | - | |||||||||||||||||||
830 | - | |||||||||||||||||||
831 | - | |||||||||||||||||||
832 | - | |||||||||||||||||||
833 | QTimeEdit::QTimeEdit(const QTime &time, QWidget *parent) | - | ||||||||||||||||||
834 | : QDateTimeEdit(time, QVariant::Time, parent) | - | ||||||||||||||||||
835 | { | - | ||||||||||||||||||
836 | } never executed: end of block | 0 | ||||||||||||||||||
837 | - | |||||||||||||||||||
838 | - | |||||||||||||||||||
839 | - | |||||||||||||||||||
840 | - | |||||||||||||||||||
841 | QTimeEdit::~QTimeEdit() | - | ||||||||||||||||||
842 | { | - | ||||||||||||||||||
843 | } | - | ||||||||||||||||||
844 | QDateEdit::QDateEdit(QWidget *parent) | - | ||||||||||||||||||
845 | : QDateTimeEdit(QDate(2000, 1, 1), QVariant::Date, parent) | - | ||||||||||||||||||
846 | { | - | ||||||||||||||||||
847 | connect(this, qFlagLocation("2""dateChanged(QDate)" "\0" __FILE__ ":" "1615"), qFlagLocation("2""userDateChanged(QDate)" "\0" __FILE__ ":" "1615")); | - | ||||||||||||||||||
848 | } never executed: end of block | 0 | ||||||||||||||||||
849 | - | |||||||||||||||||||
850 | - | |||||||||||||||||||
851 | - | |||||||||||||||||||
852 | - | |||||||||||||||||||
853 | - | |||||||||||||||||||
854 | - | |||||||||||||||||||
855 | QDateEdit::QDateEdit(const QDate &date, QWidget *parent) | - | ||||||||||||||||||
856 | : QDateTimeEdit(date, QVariant::Date, parent) | - | ||||||||||||||||||
857 | { | - | ||||||||||||||||||
858 | } never executed: end of block | 0 | ||||||||||||||||||
859 | - | |||||||||||||||||||
860 | - | |||||||||||||||||||
861 | - | |||||||||||||||||||
862 | - | |||||||||||||||||||
863 | QDateEdit::~QDateEdit() | - | ||||||||||||||||||
864 | { | - | ||||||||||||||||||
865 | } | - | ||||||||||||||||||
866 | QDateTimeEditPrivate::QDateTimeEditPrivate() | - | ||||||||||||||||||
867 | : QDateTimeParser(QVariant::DateTime, QDateTimeParser::DateTimeEdit) | - | ||||||||||||||||||
868 | { | - | ||||||||||||||||||
869 | hasHadFocus = false; | - | ||||||||||||||||||
870 | formatExplicitlySet = false; | - | ||||||||||||||||||
871 | cacheGuard = false; | - | ||||||||||||||||||
872 | fixday = true; | - | ||||||||||||||||||
873 | type = QVariant::DateTime; | - | ||||||||||||||||||
874 | sections = 0; | - | ||||||||||||||||||
875 | cachedDay = -1; | - | ||||||||||||||||||
876 | currentSectionIndex = FirstSectionIndex; | - | ||||||||||||||||||
877 | - | |||||||||||||||||||
878 | first.pos = 0; | - | ||||||||||||||||||
879 | sections = 0; | - | ||||||||||||||||||
880 | calendarPopup = false; | - | ||||||||||||||||||
881 | minimum = QDateTime(QDate(1752, 9, 14), QTime(0, 0, 0, 0)); | - | ||||||||||||||||||
882 | maximum = QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999)); | - | ||||||||||||||||||
883 | arrowState = QStyle::State_None; | - | ||||||||||||||||||
884 | monthCalendar = 0; | - | ||||||||||||||||||
885 | readLocaleSettings(); | - | ||||||||||||||||||
886 | - | |||||||||||||||||||
887 | - | |||||||||||||||||||
888 | - | |||||||||||||||||||
889 | - | |||||||||||||||||||
890 | } never executed: end of block | 0 | ||||||||||||||||||
891 | - | |||||||||||||||||||
892 | QDateTimeEditPrivate::~QDateTimeEditPrivate() | - | ||||||||||||||||||
893 | { | - | ||||||||||||||||||
894 | } | - | ||||||||||||||||||
895 | - | |||||||||||||||||||
896 | void QDateTimeEditPrivate::updateTimeSpec() | - | ||||||||||||||||||
897 | { | - | ||||||||||||||||||
898 | minimum = minimum.toDateTime().toTimeSpec(spec); | - | ||||||||||||||||||
899 | maximum = maximum.toDateTime().toTimeSpec(spec); | - | ||||||||||||||||||
900 | value = value.toDateTime().toTimeSpec(spec); | - | ||||||||||||||||||
901 | - | |||||||||||||||||||
902 | - | |||||||||||||||||||
903 | const bool dateShown = (sections & QDateTimeEdit::DateSections_Mask); | - | ||||||||||||||||||
904 | if (!dateShown
| 0 | ||||||||||||||||||
905 | if (minimum.toTime() >= maximum.toTime()
| 0 | ||||||||||||||||||
906 | minimum = QDateTime(value.toDate(), QTime(0, 0, 0, 0), spec); | - | ||||||||||||||||||
907 | maximum = QDateTime(value.toDate(), QTime(23, 59, 59, 999), spec); | - | ||||||||||||||||||
908 | } never executed: end of block | 0 | ||||||||||||||||||
909 | } never executed: end of block | 0 | ||||||||||||||||||
910 | } never executed: end of block | 0 | ||||||||||||||||||
911 | - | |||||||||||||||||||
912 | void QDateTimeEditPrivate::updateEdit() | - | ||||||||||||||||||
913 | { | - | ||||||||||||||||||
914 | const QString newText = (specialValue()
| 0 | ||||||||||||||||||
915 | if (newText == displayText()
| 0 | ||||||||||||||||||
916 | return; never executed: return; | 0 | ||||||||||||||||||
917 | int selsize = edit->selectedText().size(); | - | ||||||||||||||||||
918 | const QSignalBlocker blocker(edit); | - | ||||||||||||||||||
919 | - | |||||||||||||||||||
920 | edit->setText(newText); | - | ||||||||||||||||||
921 | - | |||||||||||||||||||
922 | if (!specialValue()
| 0 | ||||||||||||||||||
923 | - | |||||||||||||||||||
924 | - | |||||||||||||||||||
925 | - | |||||||||||||||||||
926 | ) { | - | ||||||||||||||||||
927 | int cursor = sectionPos(currentSectionIndex); | - | ||||||||||||||||||
928 | if (false) QMessageLogger(__FILE__, 1721, __PRETTY_FUNCTION__).debug() << "cursor is " << cursor << currentSectionIndex; dead code: QMessageLogger(__FILE__, 1721, __PRETTY_FUNCTION__).debug() << "cursor is " << cursor << currentSectionIndex; | - | ||||||||||||||||||
929 | cursor = qBound(0, cursor, displayText().size()); | - | ||||||||||||||||||
930 | if (false) QMessageLogger(__FILE__, 1723, __PRETTY_FUNCTION__).debug() << cursor; dead code: QMessageLogger(__FILE__, 1723, __PRETTY_FUNCTION__).debug() << cursor; | - | ||||||||||||||||||
931 | if (selsize > 0
| 0 | ||||||||||||||||||
932 | edit->setSelection(cursor, selsize); | - | ||||||||||||||||||
933 | if (false) QMessageLogger(__FILE__, 1726, __PRETTY_FUNCTION__).debug() << cursor << selsize; dead code: QMessageLogger(__FILE__, 1726, __PRETTY_FUNCTION__).debug() << cursor << selsize; | - | ||||||||||||||||||
934 | } never executed: else {end of block | 0 | ||||||||||||||||||
935 | edit->setCursorPosition(cursor); | - | ||||||||||||||||||
936 | if (false) QMessageLogger(__FILE__, 1729, __PRETTY_FUNCTION__).debug() << cursor; dead code: QMessageLogger(__FILE__, 1729, __PRETTY_FUNCTION__).debug() << cursor; | - | ||||||||||||||||||
937 | - | |||||||||||||||||||
938 | } never executed: end of block | 0 | ||||||||||||||||||
939 | } | - | ||||||||||||||||||
940 | } never executed: end of block | 0 | ||||||||||||||||||
941 | void QDateTimeEditPrivate::setSelected(int sectionIndex, bool forward) | - | ||||||||||||||||||
942 | { | - | ||||||||||||||||||
943 | if (specialValue()
| 0 | ||||||||||||||||||
944 | - | |||||||||||||||||||
945 | - | |||||||||||||||||||
946 | - | |||||||||||||||||||
947 | ) { | - | ||||||||||||||||||
948 | edit->selectAll(); | - | ||||||||||||||||||
949 | } never executed: else {end of block | 0 | ||||||||||||||||||
950 | const SectionNode &node = sectionNode(sectionIndex); | - | ||||||||||||||||||
951 | if (node.type == NoSection
| 0 | ||||||||||||||||||
952 | return; never executed: return; | 0 | ||||||||||||||||||
953 | - | |||||||||||||||||||
954 | updateCache(value, displayText()); | - | ||||||||||||||||||
955 | const int size = sectionSize(sectionIndex); | - | ||||||||||||||||||
956 | if (forward
| 0 | ||||||||||||||||||
957 | edit->setSelection(sectionPos(node), size); | - | ||||||||||||||||||
958 | } never executed: else {end of block | 0 | ||||||||||||||||||
959 | edit->setSelection(sectionPos(node) + size, -size); | - | ||||||||||||||||||
960 | } never executed: end of block | 0 | ||||||||||||||||||
961 | } | - | ||||||||||||||||||
962 | } | - | ||||||||||||||||||
963 | - | |||||||||||||||||||
964 | - | |||||||||||||||||||
965 | - | |||||||||||||||||||
966 | - | |||||||||||||||||||
967 | - | |||||||||||||||||||
968 | - | |||||||||||||||||||
969 | - | |||||||||||||||||||
970 | int QDateTimeEditPrivate::sectionAt(int pos) const | - | ||||||||||||||||||
971 | { | - | ||||||||||||||||||
972 | if (pos < separators.first().size()
| 0 | ||||||||||||||||||
973 | return never executed: (pos == 0return (pos == 0 ? FirstSectionIndex : NoSectionIndex);
never executed: return (pos == 0 ? FirstSectionIndex : NoSectionIndex); | 0 | ||||||||||||||||||
974 | } else if (displayText().size() - pos < separators.last().size() + 1
| 0 | ||||||||||||||||||
975 | if (separators.last().size() == 0
| 0 | ||||||||||||||||||
976 | return never executed: sectionNodes.count() - 1;return sectionNodes.count() - 1; never executed: return sectionNodes.count() - 1; | 0 | ||||||||||||||||||
977 | } | - | ||||||||||||||||||
978 | return never executed: (pos == displayText().size()return (pos == displayText().size() ? LastSectionIndex : NoSectionIndex);
never executed: return (pos == displayText().size() ? LastSectionIndex : NoSectionIndex); | 0 | ||||||||||||||||||
979 | } | - | ||||||||||||||||||
980 | updateCache(value, displayText()); | - | ||||||||||||||||||
981 | - | |||||||||||||||||||
982 | for (int i=0; i<sectionNodes.size()
| 0 | ||||||||||||||||||
983 | const int tmp = sectionPos(i); | - | ||||||||||||||||||
984 | if (pos < tmp + sectionSize(i)
| 0 | ||||||||||||||||||
985 | return never executed: (pos < tmpreturn (pos < tmp ? -1 : i);
never executed: return (pos < tmp ? -1 : i); | 0 | ||||||||||||||||||
986 | } | - | ||||||||||||||||||
987 | } never executed: end of block | 0 | ||||||||||||||||||
988 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
989 | } | - | ||||||||||||||||||
990 | int QDateTimeEditPrivate::closestSection(int pos, bool forward) const | - | ||||||||||||||||||
991 | { | - | ||||||||||||||||||
992 | ((!(pos >= 0)) ? qt_assert("pos >= 0",__FILE__,1801) : qt_noop()); | - | ||||||||||||||||||
993 | if (pos < separators.first().size()
| 0 | ||||||||||||||||||
994 | return never executed: forwardreturn forward ? 0 : FirstSectionIndex;
never executed: return forward ? 0 : FirstSectionIndex; | 0 | ||||||||||||||||||
995 | } else if (displayText().size() - pos < separators.last().size() + 1
| 0 | ||||||||||||||||||
996 | return never executed: forwardreturn forward ? LastSectionIndex : sectionNodes.size() - 1;
never executed: return forward ? LastSectionIndex : sectionNodes.size() - 1; | 0 | ||||||||||||||||||
997 | } | - | ||||||||||||||||||
998 | updateCache(value, displayText()); | - | ||||||||||||||||||
999 | for (int i=0; i<sectionNodes.size()
| 0 | ||||||||||||||||||
1000 | const int tmp = sectionPos(sectionNodes.at(i)); | - | ||||||||||||||||||
1001 | if (pos < tmp + sectionSize(i)
| 0 | ||||||||||||||||||
1002 | if (pos < tmp
| 0 | ||||||||||||||||||
1003 | return never executed: i-1;return i-1; never executed: return i-1; | 0 | ||||||||||||||||||
1004 | } | - | ||||||||||||||||||
1005 | return never executed: i;return i; never executed: return i; | 0 | ||||||||||||||||||
1006 | } else if (i == sectionNodes.size() - 1
| 0 | ||||||||||||||||||
1007 | return never executed: i;return i; never executed: return i; | 0 | ||||||||||||||||||
1008 | } | - | ||||||||||||||||||
1009 | } never executed: end of block | 0 | ||||||||||||||||||
1010 | QMessageLogger(__FILE__, 1819, __PRETTY_FUNCTION__).warning("QDateTimeEdit: Internal Error: closestSection returned NoSection"); | - | ||||||||||||||||||
1011 | return never executed: NoSectionIndex;return NoSectionIndex; never executed: return NoSectionIndex; | 0 | ||||||||||||||||||
1012 | } | - | ||||||||||||||||||
1013 | - | |||||||||||||||||||
1014 | - | |||||||||||||||||||
1015 | - | |||||||||||||||||||
1016 | - | |||||||||||||||||||
1017 | - | |||||||||||||||||||
1018 | - | |||||||||||||||||||
1019 | - | |||||||||||||||||||
1020 | int QDateTimeEditPrivate::nextPrevSection(int current, bool forward) const | - | ||||||||||||||||||
1021 | { | - | ||||||||||||||||||
1022 | const QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1023 | if (q->isRightToLeft()
| 0 | ||||||||||||||||||
1024 | forward = !forward; never executed: forward = !forward; | 0 | ||||||||||||||||||
1025 | - | |||||||||||||||||||
1026 | switch (current) { | - | ||||||||||||||||||
1027 | case never executed: FirstSectionIndex:case FirstSectionIndex: never executed: returncase FirstSectionIndex: never executed: forwardreturn forward ? 0 : FirstSectionIndex;
never executed: return forward ? 0 : FirstSectionIndex; | 0 | ||||||||||||||||||
1028 | case never executed: LastSectionIndex:case LastSectionIndex: never executed: returncase LastSectionIndex: never executed: (forwardreturn (forward ? LastSectionIndex : sectionNodes.size() - 1);
never executed: return (forward ? LastSectionIndex : sectionNodes.size() - 1); | 0 | ||||||||||||||||||
1029 | case never executed: NoSectionIndex:case NoSectionIndex: never executed: returncase NoSectionIndex: never executed: FirstSectionIndex;return FirstSectionIndex; never executed: return FirstSectionIndex; | 0 | ||||||||||||||||||
1030 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||
1031 | } | - | ||||||||||||||||||
1032 | ((!(current >= 0 && current < sectionNodes.size())) ? qt_assert("current >= 0 && current < sectionNodes.size()",__FILE__,1841) : qt_noop()); | - | ||||||||||||||||||
1033 | - | |||||||||||||||||||
1034 | current += (forward
| 0 | ||||||||||||||||||
1035 | if (current >= sectionNodes.size()
| 0 | ||||||||||||||||||
1036 | return never executed: LastSectionIndex;return LastSectionIndex; never executed: return LastSectionIndex; | 0 | ||||||||||||||||||
1037 | } else if (current < 0
| 0 | ||||||||||||||||||
1038 | return never executed: FirstSectionIndex;return FirstSectionIndex; never executed: return FirstSectionIndex; | 0 | ||||||||||||||||||
1039 | } | - | ||||||||||||||||||
1040 | - | |||||||||||||||||||
1041 | return never executed: current;return current; never executed: return current; | 0 | ||||||||||||||||||
1042 | } | - | ||||||||||||||||||
1043 | - | |||||||||||||||||||
1044 | - | |||||||||||||||||||
1045 | - | |||||||||||||||||||
1046 | - | |||||||||||||||||||
1047 | - | |||||||||||||||||||
1048 | - | |||||||||||||||||||
1049 | - | |||||||||||||||||||
1050 | void QDateTimeEditPrivate::clearSection(int index) | - | ||||||||||||||||||
1051 | { | - | ||||||||||||||||||
1052 | const QLatin1Char space(' '); | - | ||||||||||||||||||
1053 | int cursorPos = edit->cursorPosition(); | - | ||||||||||||||||||
1054 | const QSignalBlocker blocker(edit); | - | ||||||||||||||||||
1055 | QString t = edit->text(); | - | ||||||||||||||||||
1056 | const int pos = sectionPos(index); | - | ||||||||||||||||||
1057 | if (pos == -1
| 0 | ||||||||||||||||||
1058 | QMessageLogger(__FILE__, 1867, __PRETTY_FUNCTION__).warning("QDateTimeEdit: Internal error (%s:%d)", __FILE__, 1867); | - | ||||||||||||||||||
1059 | return; never executed: return; | 0 | ||||||||||||||||||
1060 | } | - | ||||||||||||||||||
1061 | const int size = sectionSize(index); | - | ||||||||||||||||||
1062 | t.replace(pos, size, QString().fill(space, size)); | - | ||||||||||||||||||
1063 | edit->setText(t); | - | ||||||||||||||||||
1064 | edit->setCursorPosition(cursorPos); | - | ||||||||||||||||||
1065 | if (false) QMessageLogger(__FILE__, 1874, __PRETTY_FUNCTION__).debug() << cursorPos; dead code: QMessageLogger(__FILE__, 1874, __PRETTY_FUNCTION__).debug() << cursorPos; | - | ||||||||||||||||||
1066 | } never executed: end of block | 0 | ||||||||||||||||||
1067 | void QDateTimeEditPrivate::updateCache(const QVariant &val, const QString &str) const | - | ||||||||||||||||||
1068 | { | - | ||||||||||||||||||
1069 | if (val != cachedValue
| 0 | ||||||||||||||||||
1070 | cacheGuard = true; | - | ||||||||||||||||||
1071 | QString copy = str; | - | ||||||||||||||||||
1072 | int unused = edit->cursorPosition(); | - | ||||||||||||||||||
1073 | QValidator::State unusedState; | - | ||||||||||||||||||
1074 | validateAndInterpret(copy, unused, unusedState); | - | ||||||||||||||||||
1075 | cacheGuard = false; | - | ||||||||||||||||||
1076 | } never executed: end of block | 0 | ||||||||||||||||||
1077 | } never executed: end of block | 0 | ||||||||||||||||||
1078 | - | |||||||||||||||||||
1079 | - | |||||||||||||||||||
1080 | - | |||||||||||||||||||
1081 | - | |||||||||||||||||||
1082 | - | |||||||||||||||||||
1083 | - | |||||||||||||||||||
1084 | - | |||||||||||||||||||
1085 | QDateTime QDateTimeEditPrivate::validateAndInterpret(QString &input, int &position, | - | ||||||||||||||||||
1086 | QValidator::State &state, bool fixup) const | - | ||||||||||||||||||
1087 | { | - | ||||||||||||||||||
1088 | if (input.isEmpty()
| 0 | ||||||||||||||||||
1089 | if (sectionNodes.size() == 1
| 0 | ||||||||||||||||||
1090 | state = QValidator::Intermediate; | - | ||||||||||||||||||
1091 | } never executed: else {end of block | 0 | ||||||||||||||||||
1092 | state = QValidator::Invalid; | - | ||||||||||||||||||
1093 | } never executed: end of block | 0 | ||||||||||||||||||
1094 | return never executed: getZeroVariant().toDateTime();return getZeroVariant().toDateTime(); never executed: return getZeroVariant().toDateTime(); | 0 | ||||||||||||||||||
1095 | } else if (cachedText == input
| 0 | ||||||||||||||||||
1096 | state = cachedState; | - | ||||||||||||||||||
1097 | return never executed: cachedValue.toDateTime();return cachedValue.toDateTime(); never executed: return cachedValue.toDateTime(); | 0 | ||||||||||||||||||
1098 | } else if (!specialValueText.isEmpty()
| 0 | ||||||||||||||||||
1099 | bool changeCase = false; | - | ||||||||||||||||||
1100 | const int max = qMin(specialValueText.size(), input.size()); | - | ||||||||||||||||||
1101 | int i; | - | ||||||||||||||||||
1102 | for (i=0; i<max
| 0 | ||||||||||||||||||
1103 | const QChar ic = input.at(i); | - | ||||||||||||||||||
1104 | const QChar sc = specialValueText.at(i); | - | ||||||||||||||||||
1105 | if (ic != sc
| 0 | ||||||||||||||||||
1106 | if (sc.toLower() == ic.toLower()
| 0 | ||||||||||||||||||
1107 | changeCase = true; | - | ||||||||||||||||||
1108 | } never executed: else {end of block | 0 | ||||||||||||||||||
1109 | break; never executed: break; | 0 | ||||||||||||||||||
1110 | } | - | ||||||||||||||||||
1111 | } | - | ||||||||||||||||||
1112 | } never executed: end of block | 0 | ||||||||||||||||||
1113 | if (i == max
| 0 | ||||||||||||||||||
1114 | state = specialValueText.size() == input.size()
| 0 | ||||||||||||||||||
1115 | if (changeCase
| 0 | ||||||||||||||||||
1116 | input = specialValueText.left(max); | - | ||||||||||||||||||
1117 | } never executed: end of block | 0 | ||||||||||||||||||
1118 | return never executed: minimum.toDateTime();return minimum.toDateTime(); never executed: return minimum.toDateTime(); | 0 | ||||||||||||||||||
1119 | } | - | ||||||||||||||||||
1120 | } never executed: end of block | 0 | ||||||||||||||||||
1121 | StateNode tmp = parse(input, position, value.toDateTime(), fixup); | - | ||||||||||||||||||
1122 | input = tmp.input; | - | ||||||||||||||||||
1123 | state = QValidator::State(int(tmp.state)); | - | ||||||||||||||||||
1124 | if (state == QValidator::Acceptable
| 0 | ||||||||||||||||||
1125 | if (tmp.conflicts
| 0 | ||||||||||||||||||
1126 | conflictGuard = tmp.value; | - | ||||||||||||||||||
1127 | clearCache(); | - | ||||||||||||||||||
1128 | input = textFromValue(tmp.value); | - | ||||||||||||||||||
1129 | updateCache(tmp.value, input); | - | ||||||||||||||||||
1130 | conflictGuard.clear(); | - | ||||||||||||||||||
1131 | } never executed: else {end of block | 0 | ||||||||||||||||||
1132 | cachedText = input; | - | ||||||||||||||||||
1133 | cachedState = state; | - | ||||||||||||||||||
1134 | cachedValue = tmp.value; | - | ||||||||||||||||||
1135 | } never executed: end of block | 0 | ||||||||||||||||||
1136 | } else { | - | ||||||||||||||||||
1137 | clearCache(); | - | ||||||||||||||||||
1138 | } never executed: end of block | 0 | ||||||||||||||||||
1139 | return never executed: (tmp.value.isNull()return (tmp.value.isNull() ? getZeroVariant().toDateTime() : tmp.value);
never executed: return (tmp.value.isNull() ? getZeroVariant().toDateTime() : tmp.value); | 0 | ||||||||||||||||||
1140 | } | - | ||||||||||||||||||
1141 | - | |||||||||||||||||||
1142 | - | |||||||||||||||||||
1143 | - | |||||||||||||||||||
1144 | - | |||||||||||||||||||
1145 | - | |||||||||||||||||||
1146 | - | |||||||||||||||||||
1147 | QString QDateTimeEditPrivate::textFromValue(const QVariant &f) const | - | ||||||||||||||||||
1148 | { | - | ||||||||||||||||||
1149 | const QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1150 | return never executed: q->textFromDateTime(f.toDateTime());return q->textFromDateTime(f.toDateTime()); never executed: return q->textFromDateTime(f.toDateTime()); | 0 | ||||||||||||||||||
1151 | } | - | ||||||||||||||||||
1152 | QVariant QDateTimeEditPrivate::valueFromText(const QString &f) const | - | ||||||||||||||||||
1153 | { | - | ||||||||||||||||||
1154 | const QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1155 | return never executed: q->dateTimeFromText(f).toTimeSpec(spec);return q->dateTimeFromText(f).toTimeSpec(spec); never executed: return q->dateTimeFromText(f).toTimeSpec(spec); | 0 | ||||||||||||||||||
1156 | } | - | ||||||||||||||||||
1157 | QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) const | - | ||||||||||||||||||
1158 | { | - | ||||||||||||||||||
1159 | const QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1160 | QDateTime v = value.toDateTime(); | - | ||||||||||||||||||
1161 | QString str = displayText(); | - | ||||||||||||||||||
1162 | int pos = edit->cursorPosition(); | - | ||||||||||||||||||
1163 | const SectionNode sn = sectionNode(sectionIndex); | - | ||||||||||||||||||
1164 | - | |||||||||||||||||||
1165 | int val; | - | ||||||||||||||||||
1166 | - | |||||||||||||||||||
1167 | if (!test
| 0 | ||||||||||||||||||
1168 | if (q->validate(str, pos) != QValidator::Acceptable
| 0 | ||||||||||||||||||
1169 | v = value.toDateTime(); | - | ||||||||||||||||||
1170 | } never executed: else {end of block | 0 | ||||||||||||||||||
1171 | v = q->dateTimeFromText(str); | - | ||||||||||||||||||
1172 | } never executed: end of block | 0 | ||||||||||||||||||
1173 | val = getDigit(v, sectionIndex); | - | ||||||||||||||||||
1174 | } never executed: else {end of block | 0 | ||||||||||||||||||
1175 | val = getDigit(v, sectionIndex); | - | ||||||||||||||||||
1176 | } never executed: end of block | 0 | ||||||||||||||||||
1177 | - | |||||||||||||||||||
1178 | val += steps; | - | ||||||||||||||||||
1179 | - | |||||||||||||||||||
1180 | const int min = absoluteMin(sectionIndex); | - | ||||||||||||||||||
1181 | const int max = absoluteMax(sectionIndex, value.toDateTime()); | - | ||||||||||||||||||
1182 | - | |||||||||||||||||||
1183 | if (val < min
| 0 | ||||||||||||||||||
1184 | val = (wrapping
| 0 | ||||||||||||||||||
1185 | } never executed: else if (val > maxend of block
| 0 | ||||||||||||||||||
1186 | val = (wrapping
| 0 | ||||||||||||||||||
1187 | } never executed: end of block | 0 | ||||||||||||||||||
1188 | - | |||||||||||||||||||
1189 | - | |||||||||||||||||||
1190 | const int oldDay = v.date().day(); | - | ||||||||||||||||||
1191 | - | |||||||||||||||||||
1192 | setDigit(v, sectionIndex, val); | - | ||||||||||||||||||
1193 | - | |||||||||||||||||||
1194 | - | |||||||||||||||||||
1195 | - | |||||||||||||||||||
1196 | const QDateTime minimumDateTime = minimum.toDateTime(); | - | ||||||||||||||||||
1197 | const QDateTime maximumDateTime = maximum.toDateTime(); | - | ||||||||||||||||||
1198 | - | |||||||||||||||||||
1199 | if (sn.type != AmPmSection
| 0 | ||||||||||||||||||
1200 | const int localmin = getDigit(minimumDateTime, sectionIndex); | - | ||||||||||||||||||
1201 | const int localmax = getDigit(maximumDateTime, sectionIndex); | - | ||||||||||||||||||
1202 | - | |||||||||||||||||||
1203 | if (wrapping
| 0 | ||||||||||||||||||
1204 | - | |||||||||||||||||||
1205 | - | |||||||||||||||||||
1206 | if (steps > 0
| 0 | ||||||||||||||||||
1207 | setDigit(v, sectionIndex, min); | - | ||||||||||||||||||
1208 | if (!(sn.type & DaySectionMask)
| 0 | ||||||||||||||||||
1209 | const int daysInMonth = v.date().daysInMonth(); | - | ||||||||||||||||||
1210 | if (v.date().day() < oldDay
| 0 | ||||||||||||||||||
1211 | const int adds = qMin(oldDay, daysInMonth); | - | ||||||||||||||||||
1212 | v = v.addDays(adds - v.date().day()); | - | ||||||||||||||||||
1213 | } never executed: end of block | 0 | ||||||||||||||||||
1214 | } never executed: end of block | 0 | ||||||||||||||||||
1215 | - | |||||||||||||||||||
1216 | if (v < minimumDateTime
| 0 | ||||||||||||||||||
1217 | setDigit(v, sectionIndex, localmin); | - | ||||||||||||||||||
1218 | if (v < minimumDateTime
| 0 | ||||||||||||||||||
1219 | setDigit(v, sectionIndex, localmin + 1); never executed: setDigit(v, sectionIndex, localmin + 1); | 0 | ||||||||||||||||||
1220 | } never executed: end of block | 0 | ||||||||||||||||||
1221 | } never executed: else {end of block | 0 | ||||||||||||||||||
1222 | setDigit(v, sectionIndex, max); | - | ||||||||||||||||||
1223 | if (!(sn.type & DaySectionMask)
| 0 | ||||||||||||||||||
1224 | const int daysInMonth = v.date().daysInMonth(); | - | ||||||||||||||||||
1225 | if (v.date().day() < oldDay
| 0 | ||||||||||||||||||
1226 | const int adds = qMin(oldDay, daysInMonth); | - | ||||||||||||||||||
1227 | v = v.addDays(adds - v.date().day()); | - | ||||||||||||||||||
1228 | } never executed: end of block | 0 | ||||||||||||||||||
1229 | } never executed: end of block | 0 | ||||||||||||||||||
1230 | - | |||||||||||||||||||
1231 | if (v > maximumDateTime
| 0 | ||||||||||||||||||
1232 | setDigit(v, sectionIndex, localmax); | - | ||||||||||||||||||
1233 | if (v > maximumDateTime
| 0 | ||||||||||||||||||
1234 | setDigit(v, sectionIndex, localmax - 1); never executed: setDigit(v, sectionIndex, localmax - 1); | 0 | ||||||||||||||||||
1235 | } never executed: end of block | 0 | ||||||||||||||||||
1236 | } never executed: end of block | 0 | ||||||||||||||||||
1237 | } else { | - | ||||||||||||||||||
1238 | setDigit(v, sectionIndex, (steps > 0 ? localmax : localmin)); | - | ||||||||||||||||||
1239 | } never executed: end of block | 0 | ||||||||||||||||||
1240 | } | - | ||||||||||||||||||
1241 | if (!test
| 0 | ||||||||||||||||||
1242 | - | |||||||||||||||||||
1243 | cachedDay = qMax<int>(oldDay, cachedDay); | - | ||||||||||||||||||
1244 | } never executed: end of block | 0 | ||||||||||||||||||
1245 | - | |||||||||||||||||||
1246 | if (v < minimumDateTime
| 0 | ||||||||||||||||||
1247 | if (wrapping
| 0 | ||||||||||||||||||
1248 | QDateTime t = v; | - | ||||||||||||||||||
1249 | setDigit(t, sectionIndex, steps < 0 ? max : min); | - | ||||||||||||||||||
1250 | bool mincmp = (t >= minimumDateTime); | - | ||||||||||||||||||
1251 | bool maxcmp = (t <= maximumDateTime); | - | ||||||||||||||||||
1252 | if (!mincmp
| 0 | ||||||||||||||||||
1253 | setDigit(t, sectionIndex, getDigit(steps < 0 | - | ||||||||||||||||||
1254 | ? maximumDateTime | - | ||||||||||||||||||
1255 | : minimumDateTime, sectionIndex)); | - | ||||||||||||||||||
1256 | mincmp = (t >= minimumDateTime); | - | ||||||||||||||||||
1257 | maxcmp = (t <= maximumDateTime); | - | ||||||||||||||||||
1258 | } never executed: end of block | 0 | ||||||||||||||||||
1259 | if (mincmp
| 0 | ||||||||||||||||||
1260 | v = t; | - | ||||||||||||||||||
1261 | } never executed: end of block | 0 | ||||||||||||||||||
1262 | } never executed: else {end of block | 0 | ||||||||||||||||||
1263 | v = value.toDateTime(); | - | ||||||||||||||||||
1264 | } never executed: end of block | 0 | ||||||||||||||||||
1265 | } else if (v > maximumDateTime
| 0 | ||||||||||||||||||
1266 | if (wrapping
| 0 | ||||||||||||||||||
1267 | QDateTime t = v; | - | ||||||||||||||||||
1268 | setDigit(t, sectionIndex, steps > 0 ? min : max); | - | ||||||||||||||||||
1269 | bool mincmp = (t >= minimumDateTime); | - | ||||||||||||||||||
1270 | bool maxcmp = (t <= maximumDateTime); | - | ||||||||||||||||||
1271 | if (!mincmp
| 0 | ||||||||||||||||||
1272 | setDigit(t, sectionIndex, getDigit(steps > 0 ? | - | ||||||||||||||||||
1273 | minimumDateTime : | - | ||||||||||||||||||
1274 | maximumDateTime, sectionIndex)); | - | ||||||||||||||||||
1275 | mincmp = (t >= minimumDateTime); | - | ||||||||||||||||||
1276 | maxcmp = (t <= maximumDateTime); | - | ||||||||||||||||||
1277 | } never executed: end of block | 0 | ||||||||||||||||||
1278 | if (mincmp
| 0 | ||||||||||||||||||
1279 | v = t; | - | ||||||||||||||||||
1280 | } never executed: end of block | 0 | ||||||||||||||||||
1281 | } never executed: else {end of block | 0 | ||||||||||||||||||
1282 | v = value.toDateTime(); | - | ||||||||||||||||||
1283 | } never executed: end of block | 0 | ||||||||||||||||||
1284 | } | - | ||||||||||||||||||
1285 | - | |||||||||||||||||||
1286 | const QDateTime ret = bound(v, value, steps).toDateTime().toTimeSpec(spec); | - | ||||||||||||||||||
1287 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
1288 | } | - | ||||||||||||||||||
1289 | - | |||||||||||||||||||
1290 | - | |||||||||||||||||||
1291 | - | |||||||||||||||||||
1292 | - | |||||||||||||||||||
1293 | - | |||||||||||||||||||
1294 | void QDateTimeEditPrivate::emitSignals(EmitPolicy ep, const QVariant &old) | - | ||||||||||||||||||
1295 | { | - | ||||||||||||||||||
1296 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1297 | if (ep == NeverEmit
| 0 | ||||||||||||||||||
1298 | return; never executed: return; | 0 | ||||||||||||||||||
1299 | } | - | ||||||||||||||||||
1300 | pendingEmit = false; | - | ||||||||||||||||||
1301 | - | |||||||||||||||||||
1302 | const bool dodate = value.toDate().isValid()
| 0 | ||||||||||||||||||
1303 | const bool datechanged = (ep == AlwaysEmit
| 0 | ||||||||||||||||||
1304 | const bool dotime = value.toTime().isValid()
| 0 | ||||||||||||||||||
1305 | const bool timechanged = (ep == AlwaysEmit
| 0 | ||||||||||||||||||
1306 | - | |||||||||||||||||||
1307 | updateCache(value, displayText()); | - | ||||||||||||||||||
1308 | - | |||||||||||||||||||
1309 | syncCalendarWidget(); | - | ||||||||||||||||||
1310 | if (datechanged
| 0 | ||||||||||||||||||
1311 | q->dateTimeChanged(value.toDateTime()); never executed: q->dateTimeChanged(value.toDateTime()); | 0 | ||||||||||||||||||
1312 | if (dodate
| 0 | ||||||||||||||||||
1313 | q->dateChanged(value.toDate()); never executed: q->dateChanged(value.toDate()); | 0 | ||||||||||||||||||
1314 | if (dotime
| 0 | ||||||||||||||||||
1315 | q->timeChanged(value.toTime()); never executed: q->timeChanged(value.toTime()); | 0 | ||||||||||||||||||
1316 | - | |||||||||||||||||||
1317 | } never executed: end of block | 0 | ||||||||||||||||||
1318 | - | |||||||||||||||||||
1319 | - | |||||||||||||||||||
1320 | - | |||||||||||||||||||
1321 | - | |||||||||||||||||||
1322 | - | |||||||||||||||||||
1323 | void QDateTimeEditPrivate::_q_editorCursorPositionChanged(int oldpos, int newpos) | - | ||||||||||||||||||
1324 | { | - | ||||||||||||||||||
1325 | if (ignoreCursorPositionChanged
| 0 | ||||||||||||||||||
1326 | return; never executed: return; | 0 | ||||||||||||||||||
1327 | const QString oldText = displayText(); | - | ||||||||||||||||||
1328 | updateCache(value, oldText); | - | ||||||||||||||||||
1329 | - | |||||||||||||||||||
1330 | const bool allowChange = !edit->hasSelectedText(); | - | ||||||||||||||||||
1331 | const bool forward = oldpos <= newpos; | - | ||||||||||||||||||
1332 | ignoreCursorPositionChanged = true; | - | ||||||||||||||||||
1333 | int s = sectionAt(newpos); | - | ||||||||||||||||||
1334 | if (s == NoSectionIndex
| 0 | ||||||||||||||||||
1335 | s = sectionAt(newpos - 1); | - | ||||||||||||||||||
1336 | } never executed: end of block | 0 | ||||||||||||||||||
1337 | - | |||||||||||||||||||
1338 | int c = newpos; | - | ||||||||||||||||||
1339 | - | |||||||||||||||||||
1340 | const int selstart = edit->selectionStart(); | - | ||||||||||||||||||
1341 | const int selSection = sectionAt(selstart); | - | ||||||||||||||||||
1342 | const int l = selSection != -1
| 0 | ||||||||||||||||||
1343 | - | |||||||||||||||||||
1344 | if (s == NoSectionIndex
| 0 | ||||||||||||||||||
1345 | if (l > 0
| 0 | ||||||||||||||||||
1346 | s = selSection; | - | ||||||||||||||||||
1347 | if (allowChange
| 0 | ||||||||||||||||||
1348 | setSelected(selSection, true); never executed: setSelected(selSection, true); | 0 | ||||||||||||||||||
1349 | c = -1; | - | ||||||||||||||||||
1350 | } never executed: else {end of block | 0 | ||||||||||||||||||
1351 | int closest = closestSection(newpos, forward); | - | ||||||||||||||||||
1352 | c = sectionPos(closest) + (forward
| 0 | ||||||||||||||||||
1353 | - | |||||||||||||||||||
1354 | if (allowChange
| 0 | ||||||||||||||||||
1355 | edit->setCursorPosition(c); | - | ||||||||||||||||||
1356 | if (false) QMessageLogger(__FILE__, 2193, __PRETTY_FUNCTION__).debug() << c; dead code: QMessageLogger(__FILE__, 2193, __PRETTY_FUNCTION__).debug() << c; | - | ||||||||||||||||||
1357 | } never executed: end of block | 0 | ||||||||||||||||||
1358 | s = closest; | - | ||||||||||||||||||
1359 | } never executed: end of block | 0 | ||||||||||||||||||
1360 | } | - | ||||||||||||||||||
1361 | - | |||||||||||||||||||
1362 | if (allowChange
| 0 | ||||||||||||||||||
1363 | interpret(EmitIfChanged); | - | ||||||||||||||||||
1364 | } never executed: end of block | 0 | ||||||||||||||||||
1365 | if (c == -1
| 0 | ||||||||||||||||||
1366 | setSelected(s, true); | - | ||||||||||||||||||
1367 | } never executed: else if (!edit->hasSelectedText()end of block
| 0 | ||||||||||||||||||
1368 | if (oldpos < newpos
| 0 | ||||||||||||||||||
1369 | edit->setCursorPosition(displayText().size() - (oldText.size() - c)); | - | ||||||||||||||||||
1370 | } never executed: else {end of block | 0 | ||||||||||||||||||
1371 | edit->setCursorPosition(c); | - | ||||||||||||||||||
1372 | } never executed: end of block | 0 | ||||||||||||||||||
1373 | } | - | ||||||||||||||||||
1374 | - | |||||||||||||||||||
1375 | if (false) QMessageLogger(__FILE__, 2212, __PRETTY_FUNCTION__).debug() << "currentSectionIndex is set to" << sectionNode(s).name() dead code: QMessageLogger(__FILE__, 2212, __PRETTY_FUNCTION__).debug() << "currentSectionIndex is set to" << sectionNode(s).name() << oldpos << newpos << "was" << sectionNode(currentSectionIndex).name(); | - | ||||||||||||||||||
1376 | << oldpos << newpos dead code: QMessageLogger(__FILE__, 2212, __PRETTY_FUNCTION__).debug() << "currentSectionIndex is set to" << sectionNode(s).name() << oldpos << newpos << "was" << sectionNode(currentSectionIndex).name(); | - | ||||||||||||||||||
1377 | << "was" << sectionNode(currentSectionIndex).name(); dead code: QMessageLogger(__FILE__, 2212, __PRETTY_FUNCTION__).debug() << "currentSectionIndex is set to" << sectionNode(s).name() << oldpos << newpos << "was" << sectionNode(currentSectionIndex).name(); | - | ||||||||||||||||||
1378 | - | |||||||||||||||||||
1379 | currentSectionIndex = s; | - | ||||||||||||||||||
1380 | ((!(currentSectionIndex < sectionNodes.size())) ? qt_assert_x("QDateTimeEditPrivate::_q_editorCursorPositionChanged()", QString(QString::fromLatin1("Internal error (%1 %2)"). arg(currentSectionIndex). arg(sectionNodes.size())).toLocal8Bit().constData(), | - | ||||||||||||||||||
1381 | - | |||||||||||||||||||
1382 | - | |||||||||||||||||||
1383 | - | |||||||||||||||||||
1384 | __FILE__ | - | ||||||||||||||||||
1385 | , | - | ||||||||||||||||||
1386 | - | |||||||||||||||||||
1387 | - | |||||||||||||||||||
1388 | - | |||||||||||||||||||
1389 | 2221 | - | ||||||||||||||||||
1390 | ) : qt_noop()) | - | ||||||||||||||||||
1391 | - | |||||||||||||||||||
1392 | - | |||||||||||||||||||
1393 | - | |||||||||||||||||||
1394 | ; | - | ||||||||||||||||||
1395 | - | |||||||||||||||||||
1396 | ignoreCursorPositionChanged = false; | - | ||||||||||||||||||
1397 | } never executed: end of block | 0 | ||||||||||||||||||
1398 | - | |||||||||||||||||||
1399 | - | |||||||||||||||||||
1400 | - | |||||||||||||||||||
1401 | - | |||||||||||||||||||
1402 | - | |||||||||||||||||||
1403 | - | |||||||||||||||||||
1404 | void QDateTimeEditPrivate::readLocaleSettings() | - | ||||||||||||||||||
1405 | { | - | ||||||||||||||||||
1406 | const QLocale loc; | - | ||||||||||||||||||
1407 | defaultTimeFormat = loc.timeFormat(QLocale::ShortFormat); | - | ||||||||||||||||||
1408 | defaultDateFormat = loc.dateFormat(QLocale::ShortFormat); | - | ||||||||||||||||||
1409 | defaultDateTimeFormat = loc.dateTimeFormat(QLocale::ShortFormat); | - | ||||||||||||||||||
1410 | } never executed: end of block | 0 | ||||||||||||||||||
1411 | - | |||||||||||||||||||
1412 | QDateTimeEdit::Section QDateTimeEditPrivate::convertToPublic(QDateTimeParser::Section s) | - | ||||||||||||||||||
1413 | { | - | ||||||||||||||||||
1414 | switch (s & ~Internal) { | - | ||||||||||||||||||
1415 | case never executed: AmPmSection:case AmPmSection: never executed: returncase AmPmSection: never executed: QDateTimeEdit::AmPmSection;return QDateTimeEdit::AmPmSection; never executed: return QDateTimeEdit::AmPmSection; | 0 | ||||||||||||||||||
1416 | case never executed: MSecSection:case MSecSection: never executed: returncase MSecSection: never executed: QDateTimeEdit::MSecSection;return QDateTimeEdit::MSecSection; never executed: return QDateTimeEdit::MSecSection; | 0 | ||||||||||||||||||
1417 | case never executed: SecondSection:case SecondSection: never executed: returncase SecondSection: never executed: QDateTimeEdit::SecondSection;return QDateTimeEdit::SecondSection; never executed: return QDateTimeEdit::SecondSection; | 0 | ||||||||||||||||||
1418 | case never executed: MinuteSection:case MinuteSection: never executed: returncase MinuteSection: never executed: QDateTimeEdit::MinuteSection;return QDateTimeEdit::MinuteSection; never executed: return QDateTimeEdit::MinuteSection; | 0 | ||||||||||||||||||
1419 | case never executed: DayOfWeekSectionShort:case DayOfWeekSectionShort: never executed: case DayOfWeekSectionShort: | 0 | ||||||||||||||||||
1420 | case never executed: DayOfWeekSectionLong:case DayOfWeekSectionLong: never executed: case DayOfWeekSectionLong: | 0 | ||||||||||||||||||
1421 | case never executed: DaySection:case DaySection: never executed: returncase DaySection: never executed: QDateTimeEdit::DaySection;return QDateTimeEdit::DaySection; never executed: return QDateTimeEdit::DaySection; | 0 | ||||||||||||||||||
1422 | case never executed: MonthSection:case MonthSection: never executed: returncase MonthSection: never executed: QDateTimeEdit::MonthSection;return QDateTimeEdit::MonthSection; never executed: return QDateTimeEdit::MonthSection; | 0 | ||||||||||||||||||
1423 | case never executed: YearSection2Digits:case YearSection2Digits: never executed: case YearSection2Digits: | 0 | ||||||||||||||||||
1424 | case never executed: YearSection:case YearSection: never executed: returncase YearSection: never executed: QDateTimeEdit::YearSection;return QDateTimeEdit::YearSection; never executed: return QDateTimeEdit::YearSection; | 0 | ||||||||||||||||||
1425 | case never executed: Hour12Section:case Hour12Section: never executed: case Hour12Section: | 0 | ||||||||||||||||||
1426 | case never executed: Hour24Section:case Hour24Section: never executed: returncase Hour24Section: never executed: QDateTimeEdit::HourSection;return QDateTimeEdit::HourSection; never executed: return QDateTimeEdit::HourSection; | 0 | ||||||||||||||||||
1427 | case never executed: FirstSection:case FirstSection: never executed: case FirstSection: | 0 | ||||||||||||||||||
1428 | case never executed: NoSection:case NoSection: never executed: case NoSection: | 0 | ||||||||||||||||||
1429 | case never executed: LastSection:case LastSection: never executed: break;case LastSection: never executed: break; | 0 | ||||||||||||||||||
1430 | } | - | ||||||||||||||||||
1431 | return never executed: QDateTimeEdit::NoSection;return QDateTimeEdit::NoSection; never executed: return QDateTimeEdit::NoSection; | 0 | ||||||||||||||||||
1432 | } | - | ||||||||||||||||||
1433 | - | |||||||||||||||||||
1434 | QDateTimeEdit::Sections QDateTimeEditPrivate::convertSections(QDateTimeParser::Sections s) | - | ||||||||||||||||||
1435 | { | - | ||||||||||||||||||
1436 | QDateTimeEdit::Sections ret = 0; | - | ||||||||||||||||||
1437 | if (s & QDateTimeParser::MSecSection
| 0 | ||||||||||||||||||
1438 | ret |= QDateTimeEdit::MSecSection; never executed: ret |= QDateTimeEdit::MSecSection; | 0 | ||||||||||||||||||
1439 | if (s & QDateTimeParser::SecondSection
| 0 | ||||||||||||||||||
1440 | ret |= QDateTimeEdit::SecondSection; never executed: ret |= QDateTimeEdit::SecondSection; | 0 | ||||||||||||||||||
1441 | if (s & QDateTimeParser::MinuteSection
| 0 | ||||||||||||||||||
1442 | ret |= QDateTimeEdit::MinuteSection; never executed: ret |= QDateTimeEdit::MinuteSection; | 0 | ||||||||||||||||||
1443 | if (s & (QDateTimeParser::HourSectionMask)
| 0 | ||||||||||||||||||
1444 | ret |= QDateTimeEdit::HourSection; never executed: ret |= QDateTimeEdit::HourSection; | 0 | ||||||||||||||||||
1445 | if (s & QDateTimeParser::AmPmSection
| 0 | ||||||||||||||||||
1446 | ret |= QDateTimeEdit::AmPmSection; never executed: ret |= QDateTimeEdit::AmPmSection; | 0 | ||||||||||||||||||
1447 | if (s & (QDateTimeParser::DaySectionMask)
| 0 | ||||||||||||||||||
1448 | ret |= QDateTimeEdit::DaySection; never executed: ret |= QDateTimeEdit::DaySection; | 0 | ||||||||||||||||||
1449 | if (s & QDateTimeParser::MonthSection
| 0 | ||||||||||||||||||
1450 | ret |= QDateTimeEdit::MonthSection; never executed: ret |= QDateTimeEdit::MonthSection; | 0 | ||||||||||||||||||
1451 | if (s & (QDateTimeParser::YearSectionMask)
| 0 | ||||||||||||||||||
1452 | ret |= QDateTimeEdit::YearSection; never executed: ret |= QDateTimeEdit::YearSection; | 0 | ||||||||||||||||||
1453 | - | |||||||||||||||||||
1454 | return never executed: ret;return ret; never executed: return ret; | 0 | ||||||||||||||||||
1455 | } | - | ||||||||||||||||||
1456 | - | |||||||||||||||||||
1457 | - | |||||||||||||||||||
1458 | - | |||||||||||||||||||
1459 | - | |||||||||||||||||||
1460 | - | |||||||||||||||||||
1461 | void QDateTimeEdit::paintEvent(QPaintEvent *event) | - | ||||||||||||||||||
1462 | { | - | ||||||||||||||||||
1463 | QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
1464 | if (!d->calendarPopupEnabled()
| 0 | ||||||||||||||||||
1465 | QAbstractSpinBox::paintEvent(event); | - | ||||||||||||||||||
1466 | return; never executed: return; | 0 | ||||||||||||||||||
1467 | } | - | ||||||||||||||||||
1468 | - | |||||||||||||||||||
1469 | QStyleOptionSpinBox opt; | - | ||||||||||||||||||
1470 | initStyleOption(&opt); | - | ||||||||||||||||||
1471 | - | |||||||||||||||||||
1472 | QStyleOptionComboBox optCombo; | - | ||||||||||||||||||
1473 | - | |||||||||||||||||||
1474 | optCombo.init(this); | - | ||||||||||||||||||
1475 | optCombo.editable = true; | - | ||||||||||||||||||
1476 | optCombo.frame = opt.frame; | - | ||||||||||||||||||
1477 | optCombo.subControls = opt.subControls; | - | ||||||||||||||||||
1478 | optCombo.activeSubControls = opt.activeSubControls; | - | ||||||||||||||||||
1479 | optCombo.state = opt.state; | - | ||||||||||||||||||
1480 | if (d->readOnly
| 0 | ||||||||||||||||||
1481 | optCombo.state &= ~QStyle::State_Enabled; | - | ||||||||||||||||||
1482 | } never executed: end of block | 0 | ||||||||||||||||||
1483 | - | |||||||||||||||||||
1484 | QPainter p(this); | - | ||||||||||||||||||
1485 | style()->drawComplexControl(QStyle::CC_ComboBox, &optCombo, &p, this); | - | ||||||||||||||||||
1486 | } never executed: end of block | 0 | ||||||||||||||||||
1487 | - | |||||||||||||||||||
1488 | QString QDateTimeEditPrivate::getAmPmText(AmPm ap, Case cs) const | - | ||||||||||||||||||
1489 | { | - | ||||||||||||||||||
1490 | if (ap == AmText
| 0 | ||||||||||||||||||
1491 | return never executed: (cs == UpperCasereturn (cs == UpperCase ? QDateTimeParser::tr("AM") : QDateTimeParser::tr("am"));
never executed: return (cs == UpperCase ? QDateTimeParser::tr("AM") : QDateTimeParser::tr("am")); | 0 | ||||||||||||||||||
1492 | } else { | - | ||||||||||||||||||
1493 | return never executed: (cs == UpperCasereturn (cs == UpperCase ? QDateTimeParser::tr("PM") : QDateTimeParser::tr("pm"));
never executed: return (cs == UpperCase ? QDateTimeParser::tr("PM") : QDateTimeParser::tr("pm")); | 0 | ||||||||||||||||||
1494 | } | - | ||||||||||||||||||
1495 | } | - | ||||||||||||||||||
1496 | - | |||||||||||||||||||
1497 | int QDateTimeEditPrivate::absoluteIndex(QDateTimeEdit::Section s, int index) const | - | ||||||||||||||||||
1498 | { | - | ||||||||||||||||||
1499 | for (int i=0; i<sectionNodes.size()
| 0 | ||||||||||||||||||
1500 | if (convertToPublic(sectionNodes.at(i).type) == s
| 0 | ||||||||||||||||||
1501 | return never executed: i;return i; never executed: return i; | 0 | ||||||||||||||||||
1502 | } | - | ||||||||||||||||||
1503 | } never executed: end of block | 0 | ||||||||||||||||||
1504 | return never executed: NoSectionIndex;return NoSectionIndex; never executed: return NoSectionIndex; | 0 | ||||||||||||||||||
1505 | } | - | ||||||||||||||||||
1506 | - | |||||||||||||||||||
1507 | int QDateTimeEditPrivate::absoluteIndex(const SectionNode &s) const | - | ||||||||||||||||||
1508 | { | - | ||||||||||||||||||
1509 | return never executed: sectionNodes.indexOf(s);return sectionNodes.indexOf(s); never executed: return sectionNodes.indexOf(s); | 0 | ||||||||||||||||||
1510 | } | - | ||||||||||||||||||
1511 | - | |||||||||||||||||||
1512 | void QDateTimeEditPrivate::interpret(EmitPolicy ep) | - | ||||||||||||||||||
1513 | { | - | ||||||||||||||||||
1514 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1515 | QString tmp = displayText(); | - | ||||||||||||||||||
1516 | int pos = edit->cursorPosition(); | - | ||||||||||||||||||
1517 | const QValidator::State state = q->validate(tmp, pos); | - | ||||||||||||||||||
1518 | if (state != QValidator::Acceptable
| 0 | ||||||||||||||||||
1519 | && correctionMode == QAbstractSpinBox::CorrectToPreviousValue
| 0 | ||||||||||||||||||
1520 | && (state == QValidator::Invalid
| 0 | ||||||||||||||||||
1521 | || currentSectionIndex < 0
| 0 | ||||||||||||||||||
1522 | || !(fieldInfo(currentSectionIndex) & AllowPartial)
| 0 | ||||||||||||||||||
1523 | setValue(value, ep); | - | ||||||||||||||||||
1524 | updateTimeSpec(); | - | ||||||||||||||||||
1525 | } never executed: else {end of block | 0 | ||||||||||||||||||
1526 | QAbstractSpinBoxPrivate::interpret(ep); | - | ||||||||||||||||||
1527 | } never executed: end of block | 0 | ||||||||||||||||||
1528 | } | - | ||||||||||||||||||
1529 | - | |||||||||||||||||||
1530 | void QDateTimeEditPrivate::clearCache() const | - | ||||||||||||||||||
1531 | { | - | ||||||||||||||||||
1532 | QAbstractSpinBoxPrivate::clearCache(); | - | ||||||||||||||||||
1533 | cachedDay = -1; | - | ||||||||||||||||||
1534 | } never executed: end of block | 0 | ||||||||||||||||||
1535 | void QDateTimeEdit::initStyleOption(QStyleOptionSpinBox *option) const | - | ||||||||||||||||||
1536 | { | - | ||||||||||||||||||
1537 | if (!option
| 0 | ||||||||||||||||||
1538 | return; never executed: return; | 0 | ||||||||||||||||||
1539 | - | |||||||||||||||||||
1540 | const QDateTimeEditPrivate * const d = d_func(); | - | ||||||||||||||||||
1541 | QAbstractSpinBox::initStyleOption(option); | - | ||||||||||||||||||
1542 | if (d->calendarPopupEnabled()
| 0 | ||||||||||||||||||
1543 | option->subControls = QStyle::SC_ComboBoxFrame | QStyle::SC_ComboBoxEditField | - | ||||||||||||||||||
1544 | | QStyle::SC_ComboBoxArrow; | - | ||||||||||||||||||
1545 | if (d->arrowState == QStyle::State_Sunken
| 0 | ||||||||||||||||||
1546 | option->state |= QStyle::State_Sunken; never executed: option->state |= QStyle::State_Sunken; | 0 | ||||||||||||||||||
1547 | else | - | ||||||||||||||||||
1548 | option->state &= ~QStyle::State_Sunken; never executed: option->state &= ~QStyle::State_Sunken; | 0 | ||||||||||||||||||
1549 | } | - | ||||||||||||||||||
1550 | } never executed: end of block | 0 | ||||||||||||||||||
1551 | - | |||||||||||||||||||
1552 | void QDateTimeEditPrivate::init(const QVariant &var) | - | ||||||||||||||||||
1553 | { | - | ||||||||||||||||||
1554 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1555 | switch (var.type()) { | - | ||||||||||||||||||
1556 | case never executed: QVariant::Date:case QVariant::Date: never executed: case QVariant::Date: | 0 | ||||||||||||||||||
1557 | value = QDateTime(var.toDate(), QTime(0, 0, 0, 0)); | - | ||||||||||||||||||
1558 | updateTimeSpec(); | - | ||||||||||||||||||
1559 | q->setDisplayFormat(defaultDateFormat); | - | ||||||||||||||||||
1560 | if (sectionNodes.isEmpty()
| 0 | ||||||||||||||||||
1561 | q->setDisplayFormat(QLatin1String("dd/MM/yyyy")); never executed: q->setDisplayFormat(QLatin1String("dd/MM/yyyy")); | 0 | ||||||||||||||||||
1562 | break; never executed: break; | 0 | ||||||||||||||||||
1563 | case never executed: QVariant::DateTime:case QVariant::DateTime: never executed: case QVariant::DateTime: | 0 | ||||||||||||||||||
1564 | value = var; | - | ||||||||||||||||||
1565 | updateTimeSpec(); | - | ||||||||||||||||||
1566 | q->setDisplayFormat(defaultDateTimeFormat); | - | ||||||||||||||||||
1567 | if (sectionNodes.isEmpty()
| 0 | ||||||||||||||||||
1568 | q->setDisplayFormat(QLatin1String("dd/MM/yyyy hh:mm:ss")); never executed: q->setDisplayFormat(QLatin1String("dd/MM/yyyy hh:mm:ss")); | 0 | ||||||||||||||||||
1569 | break; never executed: break; | 0 | ||||||||||||||||||
1570 | case never executed: QVariant::Time:case QVariant::Time: never executed: case QVariant::Time: | 0 | ||||||||||||||||||
1571 | value = QDateTime(QDate(2000, 1, 1), var.toTime()); | - | ||||||||||||||||||
1572 | updateTimeSpec(); | - | ||||||||||||||||||
1573 | q->setDisplayFormat(defaultTimeFormat); | - | ||||||||||||||||||
1574 | if (sectionNodes.isEmpty()
| 0 | ||||||||||||||||||
1575 | q->setDisplayFormat(QLatin1String("hh:mm:ss")); never executed: q->setDisplayFormat(QLatin1String("hh:mm:ss")); | 0 | ||||||||||||||||||
1576 | break; never executed: break; | 0 | ||||||||||||||||||
1577 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||
1578 | ((!(0)) ? qt_assert_x("QDateTimeEditPrivate::init", "Internal error",__FILE__,2413) : qt_noop()); | - | ||||||||||||||||||
1579 | break; never executed: break; | 0 | ||||||||||||||||||
1580 | } | - | ||||||||||||||||||
1581 | - | |||||||||||||||||||
1582 | - | |||||||||||||||||||
1583 | - | |||||||||||||||||||
1584 | - | |||||||||||||||||||
1585 | q->setInputMethodHints(Qt::ImhPreferNumbers); | - | ||||||||||||||||||
1586 | setLayoutItemMargins(QStyle::SE_DateTimeEditLayoutItem); | - | ||||||||||||||||||
1587 | } never executed: end of block | 0 | ||||||||||||||||||
1588 | - | |||||||||||||||||||
1589 | void QDateTimeEditPrivate::_q_resetButton() | - | ||||||||||||||||||
1590 | { | - | ||||||||||||||||||
1591 | updateArrow(QStyle::State_None); | - | ||||||||||||||||||
1592 | } never executed: end of block | 0 | ||||||||||||||||||
1593 | - | |||||||||||||||||||
1594 | void QDateTimeEditPrivate::updateArrow(QStyle::StateFlag state) | - | ||||||||||||||||||
1595 | { | - | ||||||||||||||||||
1596 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1597 | - | |||||||||||||||||||
1598 | if (arrowState == state
| 0 | ||||||||||||||||||
1599 | return; never executed: return; | 0 | ||||||||||||||||||
1600 | arrowState = state; | - | ||||||||||||||||||
1601 | if (arrowState != QStyle::State_None
| 0 | ||||||||||||||||||
1602 | buttonState |= Mouse; never executed: buttonState |= Mouse; | 0 | ||||||||||||||||||
1603 | else { | - | ||||||||||||||||||
1604 | buttonState = 0; | - | ||||||||||||||||||
1605 | hoverControl = QStyle::SC_ComboBoxFrame; | - | ||||||||||||||||||
1606 | } never executed: end of block | 0 | ||||||||||||||||||
1607 | q->update(); | - | ||||||||||||||||||
1608 | } never executed: end of block | 0 | ||||||||||||||||||
1609 | - | |||||||||||||||||||
1610 | - | |||||||||||||||||||
1611 | - | |||||||||||||||||||
1612 | - | |||||||||||||||||||
1613 | - | |||||||||||||||||||
1614 | - | |||||||||||||||||||
1615 | QStyle::SubControl QDateTimeEditPrivate::newHoverControl(const QPoint &pos) | - | ||||||||||||||||||
1616 | { | - | ||||||||||||||||||
1617 | if (!calendarPopupEnabled()
| 0 | ||||||||||||||||||
1618 | return never executed: QAbstractSpinBoxPrivate::newHoverControl(pos);return QAbstractSpinBoxPrivate::newHoverControl(pos); never executed: return QAbstractSpinBoxPrivate::newHoverControl(pos); | 0 | ||||||||||||||||||
1619 | - | |||||||||||||||||||
1620 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1621 | - | |||||||||||||||||||
1622 | QStyleOptionComboBox optCombo; | - | ||||||||||||||||||
1623 | optCombo.init(q); | - | ||||||||||||||||||
1624 | optCombo.editable = true; | - | ||||||||||||||||||
1625 | optCombo.subControls = QStyle::SC_All; | - | ||||||||||||||||||
1626 | hoverControl = q->style()->hitTestComplexControl(QStyle::CC_ComboBox, &optCombo, pos, q); | - | ||||||||||||||||||
1627 | return never executed: hoverControl;return hoverControl; never executed: return hoverControl; | 0 | ||||||||||||||||||
1628 | } | - | ||||||||||||||||||
1629 | - | |||||||||||||||||||
1630 | void QDateTimeEditPrivate::updateEditFieldGeometry() | - | ||||||||||||||||||
1631 | { | - | ||||||||||||||||||
1632 | if (!calendarPopupEnabled()
| 0 | ||||||||||||||||||
1633 | QAbstractSpinBoxPrivate::updateEditFieldGeometry(); | - | ||||||||||||||||||
1634 | return; never executed: return; | 0 | ||||||||||||||||||
1635 | } | - | ||||||||||||||||||
1636 | - | |||||||||||||||||||
1637 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1638 | - | |||||||||||||||||||
1639 | QStyleOptionComboBox optCombo; | - | ||||||||||||||||||
1640 | optCombo.init(q); | - | ||||||||||||||||||
1641 | optCombo.editable = true; | - | ||||||||||||||||||
1642 | optCombo.subControls = QStyle::SC_ComboBoxEditField; | - | ||||||||||||||||||
1643 | edit->setGeometry(q->style()->subControlRect(QStyle::CC_ComboBox, &optCombo, | - | ||||||||||||||||||
1644 | QStyle::SC_ComboBoxEditField, q)); | - | ||||||||||||||||||
1645 | } never executed: end of block | 0 | ||||||||||||||||||
1646 | - | |||||||||||||||||||
1647 | QVariant QDateTimeEditPrivate::getZeroVariant() const | - | ||||||||||||||||||
1648 | { | - | ||||||||||||||||||
1649 | ((!(type == QVariant::DateTime)) ? qt_assert("type == QVariant::DateTime",__FILE__,2484) : qt_noop()); | - | ||||||||||||||||||
1650 | return never executed: QDateTime(QDate(2000, 1, 1), QTime(), spec);return QDateTime(QDate(2000, 1, 1), QTime(), spec); never executed: return QDateTime(QDate(2000, 1, 1), QTime(), spec); | 0 | ||||||||||||||||||
1651 | } | - | ||||||||||||||||||
1652 | - | |||||||||||||||||||
1653 | void QDateTimeEditPrivate::setRange(const QVariant &min, const QVariant &max) | - | ||||||||||||||||||
1654 | { | - | ||||||||||||||||||
1655 | QAbstractSpinBoxPrivate::setRange(min, max); | - | ||||||||||||||||||
1656 | syncCalendarWidget(); | - | ||||||||||||||||||
1657 | } never executed: end of block | 0 | ||||||||||||||||||
1658 | - | |||||||||||||||||||
1659 | - | |||||||||||||||||||
1660 | bool QDateTimeEditPrivate::isSeparatorKey(const QKeyEvent *ke) const | - | ||||||||||||||||||
1661 | { | - | ||||||||||||||||||
1662 | if (!ke->text().isEmpty()
| 0 | ||||||||||||||||||
1663 | if (fieldInfo(currentSectionIndex) & Numeric
| 0 | ||||||||||||||||||
1664 | if (ke->text().at(0).isNumber()
| 0 | ||||||||||||||||||
1665 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1666 | } never executed: else if (ke->text().at(0).isLetterOrNumber()end of block
| 0 | ||||||||||||||||||
1667 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1668 | } | - | ||||||||||||||||||
1669 | return never executed: separators.at(currentSectionIndex + 1).contains(ke->text());return separators.at(currentSectionIndex + 1).contains(ke->text()); never executed: return separators.at(currentSectionIndex + 1).contains(ke->text()); | 0 | ||||||||||||||||||
1670 | } | - | ||||||||||||||||||
1671 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
1672 | } | - | ||||||||||||||||||
1673 | - | |||||||||||||||||||
1674 | void QDateTimeEditPrivate::initCalendarPopup(QCalendarWidget *cw) | - | ||||||||||||||||||
1675 | { | - | ||||||||||||||||||
1676 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1677 | if (!monthCalendar
| 0 | ||||||||||||||||||
1678 | monthCalendar = new QCalendarPopup(q, cw); | - | ||||||||||||||||||
1679 | monthCalendar->setObjectName(QLatin1String("qt_datetimedit_calendar")); | - | ||||||||||||||||||
1680 | QObject::connect(monthCalendar, qFlagLocation("2""newDateSelected(QDate)" "\0" __FILE__ ":" "2515"), q, qFlagLocation("1""setDate(QDate)" "\0" __FILE__ ":" "2515")); | - | ||||||||||||||||||
1681 | QObject::connect(monthCalendar, qFlagLocation("2""hidingCalendar(QDate)" "\0" __FILE__ ":" "2516"), q, qFlagLocation("1""setDate(QDate)" "\0" __FILE__ ":" "2516")); | - | ||||||||||||||||||
1682 | QObject::connect(monthCalendar, qFlagLocation("2""activated(QDate)" "\0" __FILE__ ":" "2517"), q, qFlagLocation("1""setDate(QDate)" "\0" __FILE__ ":" "2517")); | - | ||||||||||||||||||
1683 | QObject::connect(monthCalendar, qFlagLocation("2""activated(QDate)" "\0" __FILE__ ":" "2518"), monthCalendar, qFlagLocation("1""close()" "\0" __FILE__ ":" "2518")); | - | ||||||||||||||||||
1684 | QObject::connect(monthCalendar, qFlagLocation("2""resetButton()" "\0" __FILE__ ":" "2519"), q, qFlagLocation("1""_q_resetButton()" "\0" __FILE__ ":" "2519")); | - | ||||||||||||||||||
1685 | } never executed: else if (cwend of block
| 0 | ||||||||||||||||||
1686 | monthCalendar->setCalendarWidget(cw); | - | ||||||||||||||||||
1687 | } never executed: end of block | 0 | ||||||||||||||||||
1688 | syncCalendarWidget(); | - | ||||||||||||||||||
1689 | } never executed: end of block | 0 | ||||||||||||||||||
1690 | - | |||||||||||||||||||
1691 | void QDateTimeEditPrivate::positionCalendarPopup() | - | ||||||||||||||||||
1692 | { | - | ||||||||||||||||||
1693 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1694 | QPoint pos = (
| 0 | ||||||||||||||||||
1695 | QPoint pos2 = (
| 0 | ||||||||||||||||||
1696 | pos = q->mapToGlobal(pos); | - | ||||||||||||||||||
1697 | pos2 = q->mapToGlobal(pos2); | - | ||||||||||||||||||
1698 | QSize size = monthCalendar->sizeHint(); | - | ||||||||||||||||||
1699 | QRect screen = QApplication::desktop()->availableGeometry(pos); | - | ||||||||||||||||||
1700 | - | |||||||||||||||||||
1701 | if (q->layoutDirection() == Qt::RightToLeft
| 0 | ||||||||||||||||||
1702 | pos.setX(pos.x()-size.width()); | - | ||||||||||||||||||
1703 | pos2.setX(pos2.x()-size.width()); | - | ||||||||||||||||||
1704 | if (pos.x() < screen.left()
| 0 | ||||||||||||||||||
1705 | pos.setX(qMax(pos.x(), screen.left())); never executed: pos.setX(qMax(pos.x(), screen.left())); | 0 | ||||||||||||||||||
1706 | else if (pos.x()+size.width() > screen.right()
| 0 | ||||||||||||||||||
1707 | pos.setX(qMax(pos.x()-size.width(), screen.right()-size.width())); never executed: pos.setX(qMax(pos.x()-size.width(), screen.right()-size.width())); | 0 | ||||||||||||||||||
1708 | } never executed: else {end of block | 0 | ||||||||||||||||||
1709 | if (pos.x()+size.width() > screen.right()
| 0 | ||||||||||||||||||
1710 | pos.setX(screen.right()-size.width()); never executed: pos.setX(screen.right()-size.width()); | 0 | ||||||||||||||||||
1711 | pos.setX(qMax(pos.x(), screen.left())); | - | ||||||||||||||||||
1712 | } never executed: end of block | 0 | ||||||||||||||||||
1713 | if (pos.y() + size.height() > screen.bottom()
| 0 | ||||||||||||||||||
1714 | pos.setY(pos2.y() - size.height()); never executed: pos.setY(pos2.y() - size.height()); | 0 | ||||||||||||||||||
1715 | else if (pos.y() < screen.top()
| 0 | ||||||||||||||||||
1716 | pos.setY(screen.top()); never executed: pos.setY(screen.top()); | 0 | ||||||||||||||||||
1717 | if (pos.y() < screen.top()
| 0 | ||||||||||||||||||
1718 | pos.setY(screen.top()); never executed: pos.setY(screen.top()); | 0 | ||||||||||||||||||
1719 | if (pos.y()+size.height() > screen.bottom()
| 0 | ||||||||||||||||||
1720 | pos.setY(screen.bottom()-size.height()); never executed: pos.setY(screen.bottom()-size.height()); | 0 | ||||||||||||||||||
1721 | monthCalendar->move(pos); | - | ||||||||||||||||||
1722 | } never executed: end of block | 0 | ||||||||||||||||||
1723 | - | |||||||||||||||||||
1724 | bool QDateTimeEditPrivate::calendarPopupEnabled() const | - | ||||||||||||||||||
1725 | { | - | ||||||||||||||||||
1726 | return never executed: (calendarPopupreturn (calendarPopup && (sections & (DateSectionMask)));
never executed: return (calendarPopup && (sections & (DateSectionMask))); | 0 | ||||||||||||||||||
1727 | } | - | ||||||||||||||||||
1728 | - | |||||||||||||||||||
1729 | void QDateTimeEditPrivate::syncCalendarWidget() | - | ||||||||||||||||||
1730 | { | - | ||||||||||||||||||
1731 | QDateTimeEdit * const q = q_func(); | - | ||||||||||||||||||
1732 | if (monthCalendar
| 0 | ||||||||||||||||||
1733 | const QSignalBlocker blocker(monthCalendar); | - | ||||||||||||||||||
1734 | monthCalendar->setDateRange(q->minimumDate(), q->maximumDate()); | - | ||||||||||||||||||
1735 | monthCalendar->setDate(q->date()); | - | ||||||||||||||||||
1736 | } never executed: end of block | 0 | ||||||||||||||||||
1737 | } never executed: end of block | 0 | ||||||||||||||||||
1738 | - | |||||||||||||||||||
1739 | QCalendarPopup::QCalendarPopup(QWidget * parent, QCalendarWidget *cw) | - | ||||||||||||||||||
1740 | : QWidget(parent, Qt::Popup) | - | ||||||||||||||||||
1741 | { | - | ||||||||||||||||||
1742 | setAttribute(Qt::WA_WindowPropagation); | - | ||||||||||||||||||
1743 | - | |||||||||||||||||||
1744 | dateChanged = false; | - | ||||||||||||||||||
1745 | if (!cw
| 0 | ||||||||||||||||||
1746 | verifyCalendarInstance(); | - | ||||||||||||||||||
1747 | } never executed: else {end of block | 0 | ||||||||||||||||||
1748 | setCalendarWidget(cw); | - | ||||||||||||||||||
1749 | } never executed: end of block | 0 | ||||||||||||||||||
1750 | } | - | ||||||||||||||||||
1751 | - | |||||||||||||||||||
1752 | QCalendarWidget *QCalendarPopup::verifyCalendarInstance() | - | ||||||||||||||||||
1753 | { | - | ||||||||||||||||||
1754 | if (calendar.isNull()
| 0 | ||||||||||||||||||
1755 | QCalendarWidget *cw = new QCalendarWidget(this); | - | ||||||||||||||||||
1756 | cw->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader); | - | ||||||||||||||||||
1757 | - | |||||||||||||||||||
1758 | - | |||||||||||||||||||
1759 | - | |||||||||||||||||||
1760 | - | |||||||||||||||||||
1761 | setCalendarWidget(cw); | - | ||||||||||||||||||
1762 | return never executed: cw;return cw; never executed: return cw; | 0 | ||||||||||||||||||
1763 | } else { | - | ||||||||||||||||||
1764 | return never executed: calendar.data();return calendar.data(); never executed: return calendar.data(); | 0 | ||||||||||||||||||
1765 | } | - | ||||||||||||||||||
1766 | } | - | ||||||||||||||||||
1767 | - | |||||||||||||||||||
1768 | void QCalendarPopup::setCalendarWidget(QCalendarWidget *cw) | - | ||||||||||||||||||
1769 | { | - | ||||||||||||||||||
1770 | ((!(cw)) ? qt_assert("cw",__FILE__,2605) : qt_noop()); | - | ||||||||||||||||||
1771 | QVBoxLayout *widgetLayout = qobject_cast<QVBoxLayout*>(layout()); | - | ||||||||||||||||||
1772 | if (!widgetLayout
| 0 | ||||||||||||||||||
1773 | widgetLayout = new QVBoxLayout(this); | - | ||||||||||||||||||
1774 | widgetLayout->setMargin(0); | - | ||||||||||||||||||
1775 | widgetLayout->setSpacing(0); | - | ||||||||||||||||||
1776 | } never executed: end of block | 0 | ||||||||||||||||||
1777 | delete calendar.data(); | - | ||||||||||||||||||
1778 | calendar = QPointer<QCalendarWidget>(cw); | - | ||||||||||||||||||
1779 | widgetLayout->addWidget(cw); | - | ||||||||||||||||||
1780 | - | |||||||||||||||||||
1781 | connect(cw, qFlagLocation("2""activated(QDate)" "\0" __FILE__ ":" "2616"), this, qFlagLocation("1""dateSelected(QDate)" "\0" __FILE__ ":" "2616")); | - | ||||||||||||||||||
1782 | connect(cw, qFlagLocation("2""clicked(QDate)" "\0" __FILE__ ":" "2617"), this, qFlagLocation("1""dateSelected(QDate)" "\0" __FILE__ ":" "2617")); | - | ||||||||||||||||||
1783 | connect(cw, qFlagLocation("2""selectionChanged()" "\0" __FILE__ ":" "2618"), this, qFlagLocation("1""dateSelectionChanged()" "\0" __FILE__ ":" "2618")); | - | ||||||||||||||||||
1784 | - | |||||||||||||||||||
1785 | cw->setFocus(); | - | ||||||||||||||||||
1786 | } never executed: end of block | 0 | ||||||||||||||||||
1787 | - | |||||||||||||||||||
1788 | - | |||||||||||||||||||
1789 | void QCalendarPopup::setDate(const QDate &date) | - | ||||||||||||||||||
1790 | { | - | ||||||||||||||||||
1791 | oldDate = date; | - | ||||||||||||||||||
1792 | verifyCalendarInstance()->setSelectedDate(date); | - | ||||||||||||||||||
1793 | } never executed: end of block | 0 | ||||||||||||||||||
1794 | - | |||||||||||||||||||
1795 | void QCalendarPopup::setDateRange(const QDate &min, const QDate &max) | - | ||||||||||||||||||
1796 | { | - | ||||||||||||||||||
1797 | QCalendarWidget *cw = verifyCalendarInstance(); | - | ||||||||||||||||||
1798 | cw->setMinimumDate(min); | - | ||||||||||||||||||
1799 | cw->setMaximumDate(max); | - | ||||||||||||||||||
1800 | } never executed: end of block | 0 | ||||||||||||||||||
1801 | - | |||||||||||||||||||
1802 | void QCalendarPopup::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||
1803 | { | - | ||||||||||||||||||
1804 | QDateTimeEdit *dateTime = qobject_cast<QDateTimeEdit *>(parentWidget()); | - | ||||||||||||||||||
1805 | if (dateTime
| 0 | ||||||||||||||||||
1806 | QStyleOptionComboBox opt; | - | ||||||||||||||||||
1807 | opt.init(dateTime); | - | ||||||||||||||||||
1808 | QRect arrowRect = dateTime->style()->subControlRect(QStyle::CC_ComboBox, &opt, | - | ||||||||||||||||||
1809 | QStyle::SC_ComboBoxArrow, dateTime); | - | ||||||||||||||||||
1810 | arrowRect.moveTo(dateTime->mapToGlobal(arrowRect .topLeft())); | - | ||||||||||||||||||
1811 | if (arrowRect.contains(event->globalPos())
| 0 | ||||||||||||||||||
1812 | setAttribute(Qt::WA_NoMouseReplay); never executed: setAttribute(Qt::WA_NoMouseReplay); | 0 | ||||||||||||||||||
1813 | } never executed: end of block | 0 | ||||||||||||||||||
1814 | QWidget::mousePressEvent(event); | - | ||||||||||||||||||
1815 | } never executed: end of block | 0 | ||||||||||||||||||
1816 | - | |||||||||||||||||||
1817 | void QCalendarPopup::mouseReleaseEvent(QMouseEvent*) | - | ||||||||||||||||||
1818 | { | - | ||||||||||||||||||
1819 | resetButton(); | - | ||||||||||||||||||
1820 | } never executed: end of block | 0 | ||||||||||||||||||
1821 | - | |||||||||||||||||||
1822 | bool QCalendarPopup::event(QEvent *event) | - | ||||||||||||||||||
1823 | { | - | ||||||||||||||||||
1824 | if (event->type() == QEvent::KeyPress
| 0 | ||||||||||||||||||
1825 | QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); | - | ||||||||||||||||||
1826 | if (keyEvent->matches(QKeySequence::Cancel)
| 0 | ||||||||||||||||||
1827 | dateChanged = false; never executed: dateChanged = false; | 0 | ||||||||||||||||||
1828 | } never executed: end of block | 0 | ||||||||||||||||||
1829 | return never executed: QWidget::event(event);return QWidget::event(event); never executed: return QWidget::event(event); | 0 | ||||||||||||||||||
1830 | } | - | ||||||||||||||||||
1831 | - | |||||||||||||||||||
1832 | void QCalendarPopup::dateSelectionChanged() | - | ||||||||||||||||||
1833 | { | - | ||||||||||||||||||
1834 | dateChanged = true; | - | ||||||||||||||||||
1835 | newDateSelected(verifyCalendarInstance()->selectedDate()); | - | ||||||||||||||||||
1836 | } never executed: end of block | 0 | ||||||||||||||||||
1837 | void QCalendarPopup::dateSelected(const QDate &date) | - | ||||||||||||||||||
1838 | { | - | ||||||||||||||||||
1839 | dateChanged = true; | - | ||||||||||||||||||
1840 | activated(date); | - | ||||||||||||||||||
1841 | close(); | - | ||||||||||||||||||
1842 | } never executed: end of block | 0 | ||||||||||||||||||
1843 | - | |||||||||||||||||||
1844 | void QCalendarPopup::hideEvent(QHideEvent *) | - | ||||||||||||||||||
1845 | { | - | ||||||||||||||||||
1846 | resetButton(); | - | ||||||||||||||||||
1847 | if (!dateChanged
| 0 | ||||||||||||||||||
1848 | hidingCalendar(oldDate); never executed: hidingCalendar(oldDate); | 0 | ||||||||||||||||||
1849 | } never executed: end of block | 0 | ||||||||||||||||||
1850 | - | |||||||||||||||||||
1851 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |