changeset 1 | f7ac710697a9 |
parent 0 | 16d8024aca5e |
child 2 | 06ff229162e9 |
0:16d8024aca5e | 1:f7ac710697a9 |
---|---|
26 #include "hbdatetimepicker_p.h" |
26 #include "hbdatetimepicker_p.h" |
27 #include "hbdatetimepicker.h" |
27 #include "hbdatetimepicker.h" |
28 #include "hbstyleoption.h" |
28 #include "hbstyleoption.h" |
29 |
29 |
30 /*! |
30 /*! |
31 @alpha |
31 @beta |
32 @hbwidgets |
|
33 \class HbDateTimePicker |
32 \class HbDateTimePicker |
34 \brief HbDateTimePicker class provides a widget for picking the date, time, date and time. |
33 \brief HbDateTimePicker class provides a widget for picking the date, time, date and time. |
35 By default datetime picker will be created, with date functionality only. |
34 By default date picker will be created, with date functionality only. |
36 For exclusive time or date picker creation, use QTime or QDate variable as parameter for the constructor. |
35 For exclusive time or datetime picker creation, use QTime or QDateTime variable as parameter for the constructor. |
37 \li Date and Time |
36 \li Date and Time |
38 \li Date |
37 \li Date |
39 \li Time |
38 \li Time |
40 |
39 |
41 \snippet{ultimatecodesnippet/ultimatecodesnippet.cpp,51} |
40 \snippet{ultimatecodesnippet/ultimatecodesnippet.cpp,51} |
52 |
51 |
53 /*! |
52 /*! |
54 \fn void dateChanged(const QDate &date) |
53 \fn void dateChanged(const QDate &date) |
55 |
54 |
56 This signal is emitted when item selection changes in any of the date pickers in the datetimepicker widget. |
55 This signal is emitted when item selection changes in any of the date pickers in the datetimepicker widget. |
57 \a date selected by the user. |
56 |
57 \param date selected by the user. |
|
58 |
58 |
59 */ |
59 */ |
60 |
60 |
61 /*! |
61 /*! |
62 \fn void timeChanged(const QTime &time) |
62 \fn void timeChanged(const QTime &time) |
63 |
63 |
64 This signal is emitted when item selection changes in any of the time pickers in the datetimepicker widget. |
64 This signal is emitted when item selection changes in any of the time pickers in the datetimepicker widget. |
65 \a time selected by the user. |
65 \param time selected by the user. |
66 |
66 |
67 */ |
67 */ |
68 |
68 |
69 /*! |
69 /*! |
70 \fn void dateTimeChanged(const QDateTime &datetime) |
70 \fn void dateTimeChanged(const QDateTime &datetime) |
71 |
71 |
72 This signal is emitted when item selection changes in any of the pickers in the datetimepicker widget. |
72 This signal is emitted when item selection changes in any of the pickers in the datetimepicker widget. |
73 \a datetime selected by the user. |
73 \param datetime selected by the user. |
74 |
74 |
75 */ |
75 */ |
76 |
76 |
77 /*! |
77 /*! |
78 Constructs date picker widget by default. |
78 Constructs date picker widget by default. |
79 |
|
80 \param parent parent item. |
|
79 */ |
81 */ |
80 HbDateTimePicker::HbDateTimePicker( QGraphicsItem *parent ): |
82 HbDateTimePicker::HbDateTimePicker( QGraphicsItem *parent ): |
81 HbWidget(*new HbDateTimePickerPrivate, parent) |
83 HbWidget(*new HbDateTimePickerPrivate, parent) |
82 { |
84 { |
83 Q_D(HbDateTimePicker); |
85 Q_D(HbDateTimePicker); |
88 setDateTime(QDateTime::currentDateTime()); |
90 setDateTime(QDateTime::currentDateTime()); |
89 } |
91 } |
90 |
92 |
91 /*! |
93 /*! |
92 Constructs datetime picker widget. |
94 Constructs datetime picker widget. |
95 |
|
96 \param datetime QDateTime value. |
|
93 */ |
97 */ |
94 HbDateTimePicker::HbDateTimePicker(const QDateTime &datetime, QGraphicsItem *parent ): |
98 HbDateTimePicker::HbDateTimePicker(const QDateTime &datetime, QGraphicsItem *parent ): |
95 HbWidget(*new HbDateTimePickerPrivate, parent) |
99 HbWidget(*new HbDateTimePickerPrivate, parent) |
96 { |
100 { |
97 Q_D(HbDateTimePicker); |
101 Q_D(HbDateTimePicker); |
100 setDateTime(datetime); |
104 setDateTime(datetime); |
101 } |
105 } |
102 |
106 |
103 /*! |
107 /*! |
104 Constructs date picker widget with default locale's date format. |
108 Constructs date picker widget with default locale's date format. |
109 |
|
110 \param date QDate value. |
|
105 */ |
111 */ |
106 HbDateTimePicker::HbDateTimePicker(const QDate &date, QGraphicsItem *parent ): |
112 HbDateTimePicker::HbDateTimePicker(const QDate &date, QGraphicsItem *parent ): |
107 HbWidget(*new HbDateTimePickerPrivate, parent) |
113 HbWidget(*new HbDateTimePickerPrivate, parent) |
108 { |
114 { |
109 Q_D(HbDateTimePicker); |
115 Q_D(HbDateTimePicker); |
112 setDate(date); |
118 setDate(date); |
113 } |
119 } |
114 |
120 |
115 /*! |
121 /*! |
116 Constructs time picker widget with default locale's time format. |
122 Constructs time picker widget with default locale's time format. |
123 |
|
124 \param time QTime value. |
|
117 */ |
125 */ |
118 HbDateTimePicker::HbDateTimePicker(const QTime &time, QGraphicsItem *pParent ): |
126 HbDateTimePicker::HbDateTimePicker(const QTime &time, QGraphicsItem *pParent ): |
119 HbWidget(*new HbDateTimePickerPrivate, pParent) |
127 HbWidget(*new HbDateTimePickerPrivate, pParent) |
120 { |
128 { |
121 Q_D(HbDateTimePicker); |
129 Q_D(HbDateTimePicker); |
137 Q_D(HbDateTimePicker); |
145 Q_D(HbDateTimePicker); |
138 |
146 |
139 d->init(QVariant::DateTime); |
147 d->init(QVariant::DateTime); |
140 } |
148 } |
141 |
149 |
150 /*! |
|
151 \reimp |
|
152 */ |
|
142 bool HbDateTimePicker::event(QEvent *e) |
153 bool HbDateTimePicker::event(QEvent *e) |
143 { |
154 { |
144 Q_D(HbDateTimePicker); |
|
145 bool result = HbWidget::event(e); |
155 bool result = HbWidget::event(e); |
146 if (e->type()==QEvent::LayoutRequest) { |
156 if (e->type()==QEvent::LayoutRequest) { |
147 updatePrimitives(); |
157 updatePrimitives(); |
148 d->updateDividers(); |
|
149 } |
158 } |
150 return result; |
159 return result; |
151 } |
160 } |
152 |
161 |
153 /*! |
162 /*! |
157 { |
166 { |
158 } |
167 } |
159 |
168 |
160 /*! |
169 /*! |
161 Returns current display format as QString value. |
170 Returns current display format as QString value. |
171 |
|
172 \return display format. |
|
162 |
173 |
163 \sa setDisplayFormat() |
174 \sa setDisplayFormat() |
164 */ |
175 */ |
165 QString HbDateTimePicker::displayFormat() const |
176 QString HbDateTimePicker::displayFormat() const |
166 { |
177 { |
197 </TABLE> |
208 </TABLE> |
198 |
209 |
199 NOTE:setDisplayFormat works only when the seperators are mentioned in the format like 'dd.mm.yy' or 'dd mm yy', this |
210 NOTE:setDisplayFormat works only when the seperators are mentioned in the format like 'dd.mm.yy' or 'dd mm yy', this |
200 will be fixed in the future versions. |
211 will be fixed in the future versions. |
201 |
212 |
213 \param format is the display format in QString format. |
|
214 |
|
202 \sa displayFormat() |
215 \sa displayFormat() |
203 */ |
216 */ |
204 void HbDateTimePicker::setDisplayFormat(const QString &format) |
217 void HbDateTimePicker::setDisplayFormat(const QString &format) |
205 { |
218 { |
206 Q_D(HbDateTimePicker); |
219 Q_D(HbDateTimePicker); |
214 } |
227 } |
215 |
228 |
216 /*! |
229 /*! |
217 Returns the current date in QDate format. |
230 Returns the current date in QDate format. |
218 |
231 |
232 \return Date Picker's current date. |
|
233 |
|
219 \sa setDate |
234 \sa setDate |
220 */ |
235 */ |
221 QDate HbDateTimePicker::date() const |
236 QDate HbDateTimePicker::date() const |
222 { |
237 { |
223 Q_D(const HbDateTimePicker); |
238 Q_D(const HbDateTimePicker); |
226 } |
241 } |
227 |
242 |
228 /*! |
243 /*! |
229 Sets the current \a date in the form of QDate. |
244 Sets the current \a date in the form of QDate. |
230 |
245 |
246 \param date date in QDate format |
|
247 |
|
231 \sa date |
248 \sa date |
232 */ |
249 */ |
233 void HbDateTimePicker::setDate(const QDate& date) |
250 void HbDateTimePicker::setDate(const QDate& date) |
234 { |
251 { |
235 Q_D(HbDateTimePicker); |
252 Q_D(HbDateTimePicker); |
237 } |
254 } |
238 |
255 |
239 /*! |
256 /*! |
240 Returns minimum date in QDate format. |
257 Returns minimum date in QDate format. |
241 |
258 |
259 \return Minimum date in QDate format. |
|
260 |
|
242 \sa setMinimumDate |
261 \sa setMinimumDate |
243 */ |
262 */ |
244 QDate HbDateTimePicker::minimumDate()const |
263 QDate HbDateTimePicker::minimumDate()const |
245 { |
264 { |
246 Q_D(const HbDateTimePicker); |
265 Q_D(const HbDateTimePicker); |
247 return d->mMinimumDate.date(); |
266 return d->mMinimumDate.date(); |
248 } |
267 } |
249 |
268 |
250 /*! |
269 /*! |
251 Sets minimum \a date in QDate format. |
270 Sets minimum \a date in QDate format. |
271 |
|
272 \param Minimum date in QDate format. |
|
252 |
273 |
253 \sa minimumDate |
274 \sa minimumDate |
254 */ |
275 */ |
255 void HbDateTimePicker::setMinimumDate(const QDate& date) |
276 void HbDateTimePicker::setMinimumDate(const QDate& date) |
256 { |
277 { |
259 } |
280 } |
260 |
281 |
261 /*! |
282 /*! |
262 Returns maximum date in QDate format. |
283 Returns maximum date in QDate format. |
263 |
284 |
285 \return Maximum Date in QDate format. |
|
286 |
|
264 \sa setMaximumDate |
287 \sa setMaximumDate |
265 */ |
288 */ |
266 QDate HbDateTimePicker::maximumDate()const |
289 QDate HbDateTimePicker::maximumDate()const |
267 { |
290 { |
268 Q_D(const HbDateTimePicker); |
291 Q_D(const HbDateTimePicker); |
270 } |
293 } |
271 |
294 |
272 /*! |
295 /*! |
273 Sets maximum \a date in QDate format. |
296 Sets maximum \a date in QDate format. |
274 |
297 |
298 \param date Maximum date in QDate format. |
|
299 |
|
275 \sa maximumDate |
300 \sa maximumDate |
276 */ |
301 */ |
277 void HbDateTimePicker::setMaximumDate(const QDate& date) |
302 void HbDateTimePicker::setMaximumDate(const QDate& date) |
278 { |
303 { |
279 Q_D(HbDateTimePicker); |
304 Q_D(HbDateTimePicker); |
280 setMaximumDateTime(QDateTime(date, d->mMaximumDate.time())); |
305 setMaximumDateTime(QDateTime(date, d->mMaximumDate.time())); |
281 } |
306 } |
282 |
307 |
283 /*! |
308 /*! |
284 Sets minimum \a minDate and maximum \a maxDate dates in QDate format. |
309 Sets minimum \a minDate and maximum \a maxDate dates in QDate format. |
310 |
|
311 \param minDate Minimum date in QDate format. |
|
312 \param maxDate Maximum date in QDate format. |
|
285 |
313 |
286 \sa setMinimumDate \sa setMaximumDate |
314 \sa setMinimumDate \sa setMaximumDate |
287 */ |
315 */ |
288 void HbDateTimePicker::setDateRange(const QDate &minDate, const QDate &maxDate) |
316 void HbDateTimePicker::setDateRange(const QDate &minDate, const QDate &maxDate) |
289 { |
317 { |
293 } |
321 } |
294 |
322 |
295 /*! |
323 /*! |
296 Returns the current datetime in QDateTime format. |
324 Returns the current datetime in QDateTime format. |
297 |
325 |
326 \return date and time value in QDateTime format. |
|
327 |
|
298 \sa setDateTime |
328 \sa setDateTime |
299 */ |
329 */ |
300 QDateTime HbDateTimePicker::dateTime()const |
330 QDateTime HbDateTimePicker::dateTime()const |
301 { |
331 { |
302 Q_D(const HbDateTimePicker); |
332 Q_D(const HbDateTimePicker); |
304 } |
334 } |
305 |
335 |
306 /*! |
336 /*! |
307 Sets the current \a datetime in the form of QDateTime. |
337 Sets the current \a datetime in the form of QDateTime. |
308 |
338 |
339 \param datetime in QDateTime format. |
|
340 |
|
309 \sa dateTime |
341 \sa dateTime |
310 */ |
342 */ |
311 void HbDateTimePicker::setDateTime(const QDateTime &datetime) |
343 void HbDateTimePicker::setDateTime(const QDateTime &datetime) |
312 { |
344 { |
313 Q_D(HbDateTimePicker); |
345 Q_D(HbDateTimePicker); |
314 d->setDateTime(datetime); |
346 d->setDateTime(datetime); |
315 } |
347 } |
316 |
348 |
317 /*! |
349 /*! |
318 Returns minimum date time in QDateTime format. |
350 Returns minimum date time in QDateTime format. |
351 |
|
352 \return Minimum date and minimum time in QDateTime format. |
|
319 |
353 |
320 \sa setMinimumDateTime |
354 \sa setMinimumDateTime |
321 */ |
355 */ |
322 QDateTime HbDateTimePicker::minimumDateTime()const |
356 QDateTime HbDateTimePicker::minimumDateTime()const |
323 { |
357 { |
328 /*! |
362 /*! |
329 Sets minimum \a datetime in QDateTime format. |
363 Sets minimum \a datetime in QDateTime format. |
330 <b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now |
364 <b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now |
331 would be similar to using combination of \sa setMinimumDate and \sa setMinimumTime |
365 would be similar to using combination of \sa setMinimumDate and \sa setMinimumTime |
332 |
366 |
367 \param datetime minimum date and minimum time in QDateTime format. |
|
368 |
|
333 \sa minimumDateTime \sa setMinimumDate \sa setMinimumTime |
369 \sa minimumDateTime \sa setMinimumDate \sa setMinimumTime |
334 */ |
370 */ |
335 void HbDateTimePicker::setMinimumDateTime(const QDateTime& datetime) |
371 void HbDateTimePicker::setMinimumDateTime(const QDateTime& datetime) |
336 { |
372 { |
337 Q_D(HbDateTimePicker); |
373 Q_D(HbDateTimePicker); |
338 d->setMinimumDateTime(datetime); |
374 d->setMinimumDateTime(datetime); |
339 } |
375 } |
340 |
376 |
341 /*! |
377 /*! |
342 Returns maximum date time in QDateTime format. |
378 Returns maximum date time in QDateTime format. |
379 |
|
380 \return Maximum date and maximum time in QDateTime format. |
|
343 |
381 |
344 \sa setMaximumDate |
382 \sa setMaximumDate |
345 */ |
383 */ |
346 QDateTime HbDateTimePicker::maximumDateTime()const |
384 QDateTime HbDateTimePicker::maximumDateTime()const |
347 { |
385 { |
353 Sets maximum \a datetime in QDateTime format. |
391 Sets maximum \a datetime in QDateTime format. |
354 |
392 |
355 <b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now |
393 <b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now |
356 would be similar to using combination of \sa setMaximumDate and \sa setMaximumTime |
394 would be similar to using combination of \sa setMaximumDate and \sa setMaximumTime |
357 |
395 |
396 \param date Maximum date and maximum time in QDateTime format. |
|
397 |
|
358 \sa maximumDateTime \sa setMaximumDate \sa setMaximumTime |
398 \sa maximumDateTime \sa setMaximumDate \sa setMaximumTime |
359 */ |
399 */ |
360 void HbDateTimePicker::setMaximumDateTime(const QDateTime& date) |
400 void HbDateTimePicker::setMaximumDateTime(const QDateTime& date) |
361 { |
401 { |
362 Q_D(HbDateTimePicker); |
402 Q_D(HbDateTimePicker); |
366 /*! |
406 /*! |
367 Sets minimum \a minDatetime and maximum \a maxDatetime datetimes in QDateTime format. |
407 Sets minimum \a minDatetime and maximum \a maxDatetime datetimes in QDateTime format. |
368 |
408 |
369 <b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now |
409 <b><i>Note:</i></b> There's no link between Date and time in this API, using this API as of now |
370 would be similar to using combination of \sa setMinimumDate \sa setMaximumTime and |
410 would be similar to using combination of \sa setMinimumDate \sa setMaximumTime and |
371 \sa setMinimumTime, \sa setMaximumTime |
411 \sa setMinimumTime, \sa setMaximumTime. |
412 |
|
413 \param minDateTime minimum date and time in QDateTime format. |
|
414 \param maxDateTime maximum date and time in QDateTime format. |
|
372 |
415 |
373 \sa setMinimumDateTime \sa setMaximumDateTime \sa setMinimumDate \sa setMaximumDate |
416 \sa setMinimumDateTime \sa setMaximumDateTime \sa setMinimumDate \sa setMaximumDate |
374 \sa setMinimumTime \sa setMaximumTime |
417 \sa setMinimumTime \sa setMaximumTime |
375 */ |
418 */ |
376 void HbDateTimePicker::setDateTimeRange(const QDateTime &minDateTime, const QDateTime &maxDateTime) |
419 void HbDateTimePicker::setDateTimeRange(const QDateTime &minDateTime, const QDateTime &maxDateTime) |
380 } |
423 } |
381 |
424 |
382 /*! |
425 /*! |
383 Returns the current time in QTime format. |
426 Returns the current time in QTime format. |
384 |
427 |
428 \return time in QTime format. |
|
429 |
|
385 \sa setTime |
430 \sa setTime |
386 */ |
431 */ |
387 QTime HbDateTimePicker::time() const |
432 QTime HbDateTimePicker::time() const |
388 { |
433 { |
389 Q_D(const HbDateTimePicker); |
434 Q_D(const HbDateTimePicker); |
391 } |
436 } |
392 |
437 |
393 /*! |
438 /*! |
394 Sets the current \a time in the form of QTime. |
439 Sets the current \a time in the form of QTime. |
395 |
440 |
441 \param time in QTime format. |
|
442 |
|
396 \sa time |
443 \sa time |
397 */ |
444 */ |
398 void HbDateTimePicker::setTime(const QTime &time) |
445 void HbDateTimePicker::setTime(const QTime &time) |
399 { |
446 { |
400 Q_D(HbDateTimePicker); |
447 Q_D(HbDateTimePicker); |
402 } |
449 } |
403 |
450 |
404 /*! |
451 /*! |
405 Returns minimum time in QTime format. |
452 Returns minimum time in QTime format. |
406 |
453 |
454 \return Minimum time in QTime format. |
|
455 |
|
407 \sa setMinimumTime |
456 \sa setMinimumTime |
408 */ |
457 */ |
409 QTime HbDateTimePicker::minimumTime()const |
458 QTime HbDateTimePicker::minimumTime()const |
410 { |
459 { |
411 Q_D(const HbDateTimePicker); |
460 Q_D(const HbDateTimePicker); |
413 } |
462 } |
414 |
463 |
415 /*! |
464 /*! |
416 Sets minimum \a time in QTime format. |
465 Sets minimum \a time in QTime format. |
417 |
466 |
467 \param time minimum time in QTime format. |
|
468 |
|
418 \sa minimumTime |
469 \sa minimumTime |
419 */ |
470 */ |
420 void HbDateTimePicker::setMinimumTime(const QTime& time) |
471 void HbDateTimePicker::setMinimumTime(const QTime& time) |
421 { |
472 { |
422 Q_D(HbDateTimePicker); |
473 Q_D(HbDateTimePicker); |
424 } |
475 } |
425 |
476 |
426 /*! |
477 /*! |
427 Returns maximum time in QTime format. |
478 Returns maximum time in QTime format. |
428 |
479 |
480 \return maximum time in QTime format. |
|
481 |
|
429 \sa setMaximumTime |
482 \sa setMaximumTime |
430 */ |
483 */ |
431 QTime HbDateTimePicker::maximumTime()const |
484 QTime HbDateTimePicker::maximumTime()const |
432 { |
485 { |
433 Q_D(const HbDateTimePicker); |
486 Q_D(const HbDateTimePicker); |
435 } |
488 } |
436 |
489 |
437 /*! |
490 /*! |
438 Sets maximum \a time in QTime format. |
491 Sets maximum \a time in QTime format. |
439 |
492 |
493 \param time maximum time in QTime format |
|
494 |
|
440 \sa maximumTime |
495 \sa maximumTime |
441 */ |
496 */ |
442 void HbDateTimePicker::setMaximumTime(const QTime& time) |
497 void HbDateTimePicker::setMaximumTime(const QTime& time) |
443 { |
498 { |
444 Q_D(HbDateTimePicker); |
499 Q_D(HbDateTimePicker); |
445 setMaximumDateTime(QDateTime(d->mMaximumDate.date(), time)); |
500 setMaximumDateTime(QDateTime(d->mMaximumDate.date(), time)); |
446 } |
501 } |
447 |
502 |
448 /*! |
503 /*! |
449 Sets minimum \a minTime and maximum \a maxTime in QTime format. |
504 Sets minimum \a minTime and maximum \a maxTime in QTime format. |
505 |
|
506 \param minTime minimum time in QTime format. |
|
507 \param maxTime maximum time in QTime format. |
|
450 |
508 |
451 \sa setMinimumTime \sa setMaximumTime |
509 \sa setMinimumTime \sa setMaximumTime |
452 */ |
510 */ |
453 void HbDateTimePicker::setTimeRange(const QTime &minTime, const QTime &maxTime) |
511 void HbDateTimePicker::setTimeRange(const QTime &minTime, const QTime &maxTime) |
454 { |
512 { |
455 Q_D(HbDateTimePicker); |
513 Q_D(HbDateTimePicker); |
456 setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime), |
514 setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime), |
457 QDateTime(d->mMinimumDate.date(), maxTime)); |
515 QDateTime(d->mMinimumDate.date(), maxTime)); |
458 } |
516 } |
459 |
517 |
518 /*! |
|
519 sets the \a interval for the corresponding \a section. |
|
520 |
|
521 Note: Only MinuteSection is supported at this time. |
|
522 |
|
523 \param section can be a MinuteSection. |
|
524 \param interval to be set on each picker. |
|
525 */ |
|
526 void HbDateTimePicker::setInterval(QDateTimeEdit::Section section,int interval) |
|
527 { |
|
528 Q_D(HbDateTimePicker); |
|
529 |
|
530 //Currently supporting interval for minute section. If other sections should be enabled in future,remove the |
|
531 //below validation for minute section. |
|
532 if(section != QDateTimeEdit::MinuteSection){ |
|
533 d->mIntervals[section] = 1; |
|
534 return; |
|
535 } |
|
536 |
|
537 d->mIntervals[section] = interval; |
|
538 |
|
539 if((section == QDateTimeEdit::MinuteSection) && (d->mMinuteModel)){ |
|
540 |
|
541 d->mMinuteModel->removeRows(0, d->mMinuteModel->rowCount()); |
|
542 |
|
543 d->resizeModel(d->mMinuteModel, d->mMinimumDate.time().minute(), d->mMaximumDate.time().minute(), |
|
544 d->mMinimumDate.time().minute(), d->mMaximumDate.time().minute(),&HbDateTimePickerPrivate::localeMinute, interval); |
|
545 } |
|
546 } |
|
547 |
|
548 /*! |
|
549 returns the \a interval for the corresponding \a section. |
|
550 |
|
551 Note: Only MinuteSection is supported at this time. |
|
552 |
|
553 \return interval or duration set on a particular \a section. |
|
554 */ |
|
555 int HbDateTimePicker::interval(QDateTimeEdit::Section section) const |
|
556 { |
|
557 Q_D(const HbDateTimePicker); |
|
558 |
|
559 return d->mIntervals[section]; |
|
560 } |
|
561 |
|
562 /*! |
|
563 |
|
564 \deprecated HbDateTimePicker::primitive(HbStyle::Primitive) |
|
565 is deprecated. |
|
566 |
|
567 \reimp |
|
568 */ |
|
460 QGraphicsItem *HbDateTimePicker::primitive(HbStyle::Primitive primitive) const |
569 QGraphicsItem *HbDateTimePicker::primitive(HbStyle::Primitive primitive) const |
461 { |
570 { |
462 Q_D(const HbDateTimePicker); |
571 Q_D(const HbDateTimePicker); |
463 switch(primitive) { |
572 switch(primitive) { |
464 case HbStyle::P_DateTimePicker_background: |
573 case HbStyle::P_DateTimePicker_background: |
465 return d->mBackground; |
574 return d->mBackground; |
575 |
|
466 case HbStyle::P_DateTimePicker_frame: |
576 case HbStyle::P_DateTimePicker_frame: |
467 return d->mFrame; |
577 return d->mFrame; |
578 |
|
579 case HbStyle::P_TumbleView_highlight: |
|
580 return d->mHighlight; |
|
581 |
|
468 default: |
582 default: |
469 return HbWidget::primitive(primitive); |
583 return HbWidget::primitive(primitive); |
470 } |
584 } |
471 } |
585 } |
472 |
586 |
587 /*! |
|
588 \reimp |
|
589 */ |
|
473 void HbDateTimePicker::setGeometry(const QRectF &rect) |
590 void HbDateTimePicker::setGeometry(const QRectF &rect) |
474 { |
591 { |
475 HbWidget::setGeometry(rect); |
592 HbWidget::setGeometry(rect); |
476 updatePrimitives(); |
593 updatePrimitives(); |
477 } |
594 } |
478 |
595 |
596 /*! |
|
597 \reimp |
|
598 */ |
|
479 void HbDateTimePicker::updatePrimitives() |
599 void HbDateTimePicker::updatePrimitives() |
480 { |
600 { |
481 Q_D(HbDateTimePicker); |
601 Q_D(HbDateTimePicker); |
482 HbStyleOption option; |
602 HbStyleOption option; |
483 initStyleOption(&option); |
603 initStyleOption(&option); |
485 style()->updatePrimitive(d->mBackground,HbStyle::P_DateTimePicker_background,&option); |
605 style()->updatePrimitive(d->mBackground,HbStyle::P_DateTimePicker_background,&option); |
486 } |
606 } |
487 if(d->mFrame) { |
607 if(d->mFrame) { |
488 style()->updatePrimitive(d->mFrame,HbStyle::P_DateTimePicker_frame,&option); |
608 style()->updatePrimitive(d->mFrame,HbStyle::P_DateTimePicker_frame,&option); |
489 } |
609 } |
610 |
|
611 if(d->mHighlight) { |
|
612 style()->updatePrimitive(d->mHighlight,HbStyle::P_TumbleView_highlight,&option); |
|
613 } |
|
490 } |
614 } |
491 |
615 |
492 #include "moc_hbdatetimepicker.cpp" |
616 #include "moc_hbdatetimepicker.cpp" |