28 #include "hbstyleoption_p.h" |
28 #include "hbstyleoption_p.h" |
29 |
29 |
30 /*! |
30 /*! |
31 @beta |
31 @beta |
32 \class HbDateTimePicker |
32 \class HbDateTimePicker |
33 \brief HbDateTimePicker class provides a widget for picking the date, time, date and time. <br> |
33 \brief The HbDateTimePicker class provides a widget that has multiple vertical tumblers |
34 |
34 for selecting a date, time, or date and time by flick, drag and tap gestures. |
35 By default date picker will be created, with date functionality only. |
35 |
36 For exclusive time or datetime picker creation, use QTime or QDateTime variable as parameter for the constructor. |
36 The number of tumblers depends on the display format. The default constructor creates |
37 \li Date and Time |
37 a widget for selecting a date by internally setting the display format to the default |
38 \li Date |
38 locale's short date format. Other constructors enable you to create a widget |
39 \li Time |
39 for selecting a time or date and time by passing a QTime or QDateTime variable as an |
40 |
40 argument. Internally these constructors set the display format to the default locale's |
41 Below is a sample code snippet for datetime picker creation: |
41 short time or date and time format, respectively. |
42 \snippet{ultimatecodesnippet/ultimatecodesnippet.cpp,51} |
42 |
43 |
43 Use setDisplayFormat() to set the display format. Be aware that changing the display format |
44 By default, display format is from HbExtendedLocale. User can set the format using setDisplayFormat API. \sa setDisplayFormat.<br> |
44 can change the widget from one for selecting the date to one for selecting the time, for |
45 Based on the display format the tumblers or sections will be rearranged.<br> |
45 example. |
46 For each tumbler(TumbleView) in datetime picker, loopingEnabled property is always true.<br> |
46 |
47 |
47 Looping is enabled in the tumblers. The general appearance of the widget depends on the |
48 HbDateTimePicker provides various date and time range functionalities.<br> |
48 theme that is in use. |
49 Currently the date range is independent of the time range. |
49 |
50 \sa setDateRange \sa setTimeRange \sa setDateTimeRange |
50 <TABLE border="0"> |
51 \sa setMinimumTime \sa setMaximumTime \sa setMinimumDate \sa setMaximumDate |
51 <TR><TD>\image html hbdatetimepicker_date.png "Display format: d.MMMM"</TD> |
52 \sa setMinimumDateTime \sa setMaximumDateTime |
52 <TD></TD> |
53 |
53 <TD>\image html hbdatetimepicker_time.png "Display format: h.m.AP"</TD></TR> |
54 \image html hbdatetimepicker_date.png "Datetime picker with date functionalities, in d/MMMM format" |
54 </TABLE> |
55 \image html hbdatetimepicker_time.png "Datetime picker with time functionalities, in h.m.AP format" |
55 |
56 |
56 You can set the range of values available in the tumblers by defining minimum and maximum |
57 <b>Note:</b>Graphics in the above images varies depending on theme. |
57 values or using convenience range functions. If you change the range, if necessary |
58 */ |
58 the widget changes the displayed values so that they are within the new range. Users |
59 |
59 cannot select a value outside the range. One effect of this is that if you set, |
60 /*! |
60 for example, an afternoon time range, users cannot scroll to the AM value when the |
61 \fn void dateChanged(const QDate &date) |
61 display format includes an AM/PM tumbler. The date range is currently independent of the |
62 |
62 time range. |
63 This signal is emitted when item selection changes in any of the date pickers(day, month, year) in the datetimepicker widget. |
63 |
64 |
64 You can use setInterval() to define the increments for the minute tumbler. This is |
65 \param date selected by the user. |
65 useful when you want users to be able to set the time in 15 minute increments, for example. |
66 |
66 |
67 */ |
67 The number of rows displayed depends on how much space is available. To change the number |
68 |
68 of rows shown when the widget is is in a layout, for example, use |
69 /*! |
69 QGraphicsLayoutItem::setPreferredHeight() to increase the space available. The widget then |
70 \fn void timeChanged(const QTime &time) |
70 increases the number of rows to occupy the available space. |
71 |
71 |
72 This signal is emitted when item selection changes in any of the time pickers(hour, minute, second, am/pm) in the datetimepicker widget. |
72 %HbDateTimePicker emits a dateChanged(), timeChanged() or dateTimeChanged() signal when |
73 \param time selected by the user. |
73 the user selects a new value. The selected date, time, or date and time value is passed |
74 |
74 in a QDate, QTime, or QDateTime argument. |
75 */ |
75 |
76 |
76 \section _usecases_hbdatetimepicker Using HbDateTimePicker |
77 /*! |
77 |
78 \fn void dateTimeChanged(const QDateTime &datetime) |
78 The following example demonstrates creating a widget for selecting a date: |
79 |
79 |
80 This signal is emitted when item selection changes in any of the date and time pickers in the datetimepicker widget. |
80 \code |
81 \param datetime selected by the user. |
81 // Use the default constructor to create a widget for selecting a date. |
82 |
82 HbDateTimePicker *datePicker = new HbDateTimePicker(); |
83 */ |
83 |
84 |
84 // Set the minumum and maximum dates to display. |
85 /*! |
85 datePicker->setMinimumDate(QDate::currentDate()); |
86 Constructs date picker widget by default. |
86 datePicker->setMaximumDate(QDate::currentDate().addDays(365)); |
87 |
87 |
88 \param parent parent item for datetime picker widget. |
88 // Specify the display format. |
|
89 datePicker->setDisplayFormat("dd.MMMM.yyyy"); |
|
90 \endcode |
|
91 |
|
92 The following example demonstrates connecting the dateChanged() signal to a slot |
|
93 on an object, \a d, of a class (not shown). This has a \c setMeetingDate() function |
|
94 that takes a QDate argument. |
|
95 |
|
96 \code |
|
97 QObject::connect(datePicker, SIGNAL(dateChanged(const QDate&)), |
|
98 d, SLOT(setMeetingDate(const QDate&))); |
|
99 \endcode |
|
100 |
|
101 The following example demonstrates creating a widget for selecting a time: |
|
102 |
|
103 \code |
|
104 // Create a widget for selecting a time. |
|
105 HbDateTimePicker *timePicker = new HbDateTimePicker(QTime()); |
|
106 |
|
107 // Set the minimum and maximum times using the convenience range method. |
|
108 timePicker->setTimeRange(QTime::currentTime(), |
|
109 QTime::currentTime().addSecs(10*60*60)); |
|
110 |
|
111 // Set the time interval to be 15 minutes. |
|
112 timePicker->setInterval(QDateTimeEdit::MinuteSection, 15); |
|
113 |
|
114 // Specify the display format. |
|
115 timePicker->setDisplayFormat("hh:mm.ap"); |
|
116 \endcode |
|
117 |
|
118 The following example demonstrates creating a widget for selecting a date and time: |
|
119 |
|
120 \code |
|
121 // Create a widget for selecting a date and time. |
|
122 HbDateTimePicker *dateTimePicker = |
|
123 new HbDateTimePicker(QDateTime::currentDateTime()); |
|
124 |
|
125 // Specify the display format. |
|
126 dateTimePicker->setDisplayFormat("dd.MM.yyyy.hh.mm.ap"); |
|
127 \endcode |
|
128 |
|
129 The properties that hold the minimum and maximum values take a QDate, QTime |
|
130 or QDateTime object as an argument. DocML does not directly support properties that |
|
131 use QDate, QTime or QDateTime as a parameter. This means that when you add an \b %HbDateTimePicker |
|
132 widget in Application Designer, you must pass the date, time and date and time to these |
|
133 properties as a string in a valid ISO 8601 extended format. For example, YYYY-MM-DD for dates, |
|
134 hh:mm:ss for times, and YYYY-MM-DDTHH:MM:SS for combined dates and times. |
|
135 |
|
136 Here is an example of the \c maximumTime property defined in DocML: |
|
137 |
|
138 \code |
|
139 <widget name="t:dtp" type="HbDateTimePicker"> |
|
140 <!-- 'maximumTime' is a QTime property of HbDateTimePicker. --> |
|
141 <string name ="displayFormat" value="hh:mm:ss" /> |
|
142 <string name="maximumTime" value="08:30:00" /> |
|
143 </widget> |
|
144 \endcode |
|
145 |
|
146 \section _methodgroups_HbDateTimePicker Function groups |
|
147 |
|
148 \li \b Range: setDateRange(), setTimeRange(), setDateTimeRange() |
|
149 \li \b Minimum \b value: setMinimumDate(), setMinimumTime(), setMinimumDateTime() |
|
150 \li \b Maximum \b value: setMaximumDate(), setMaximumTime(), setMaximumDateTime() |
|
151 \li \b Time \b interval: setInterval() |
|
152 |
|
153 \sa HbDateTimeEdit, HbTumbleView, HbExtendedLocale |
|
154 */ |
|
155 |
|
156 /*! |
|
157 \fn void HbDateTimePicker::dateChanged(const QDate &date); |
|
158 |
|
159 This signal is emitted when there is a change in the day, month or year selected. |
|
160 The new date is passed in \a date. |
|
161 |
|
162 */ |
|
163 |
|
164 /*! |
|
165 \fn void HbDateTimePicker::timeChanged(const QTime &time); |
|
166 |
|
167 This signal is emitted when there is a change in the hour, minute, second, or AM/PM |
|
168 selected. The new time is passed in \a time. |
|
169 |
|
170 */ |
|
171 |
|
172 /*! |
|
173 \fn void HbDateTimePicker::dateTimeChanged(const QDateTime &datetime); |
|
174 |
|
175 This signal is emitted when there is a change in the value selected in any of the |
|
176 tumblers in a date and time picker. The new date and time are passed in \a dateTime. |
|
177 |
|
178 */ |
|
179 |
|
180 /*! |
|
181 Constructs an %HbDateTimePicker object with the locale's default short date display format |
|
182 and with parent \a parent. |
|
183 |
89 */ |
184 */ |
90 HbDateTimePicker::HbDateTimePicker( QGraphicsItem *parent ): |
185 HbDateTimePicker::HbDateTimePicker( QGraphicsItem *parent ): |
91 HbWidget(*new HbDateTimePickerPrivate, parent) |
186 HbWidget(*new HbDateTimePickerPrivate, parent) |
92 { |
187 { |
93 Q_D(HbDateTimePicker); |
188 Q_D(HbDateTimePicker); |
233 d->emitDateTimeChange(); |
336 d->emitDateTimeChange(); |
234 }//End If format is valid |
337 }//End If format is valid |
235 } |
338 } |
236 |
339 |
237 /*! |
340 /*! |
238 Returns the current date in QDate format. |
341 Returns the currently selected date in QDate format. |
239 |
342 |
240 \return current selected date in datetime picker. |
343 \note DocML does not directly support properties that use QDate as a parameter. For these |
241 |
344 properties, pass the date as a string in a valid ISO 8601 extended format, |
242 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
345 such as YYYY-MM-DD. |
243 as a string, in a valid ISO date format. |
346 |
244 |
347 \code |
245 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
|
246 |
|
247 \code |
|
248 ... |
|
249 <widget name="t:dtp" type="HbDateTimePicker"> |
348 <widget name="t:dtp" type="HbDateTimePicker"> |
250 <!-- 'date' is a QDate property of HbDateTimePicker. --> |
349 <!-- 'date' is a QDate property of HbDateTimePicker. --> |
251 <string name="date" value="02-02-15" /> |
350 <string name="date" value="02-02-15" /> |
252 </widget> |
351 </widget> |
253 ... |
352 \endcode |
254 \endcode |
353 |
255 |
354 \sa setDate() |
256 \sa setDate |
|
257 */ |
355 */ |
258 QDate HbDateTimePicker::date() const |
356 QDate HbDateTimePicker::date() const |
259 { |
357 { |
260 Q_D(const HbDateTimePicker); |
358 Q_D(const HbDateTimePicker); |
261 |
359 |
262 return d->mDateTime.date(); |
360 return d->mDateTime.date(); |
263 } |
361 } |
264 |
362 |
265 /*! |
363 /*! |
266 Sets the current \a date in the form of QDate. |
364 Sets the current date to \a date. |
267 |
365 |
268 \param date date to be set on the datetime picker in QDate format |
366 \param date The date in QDate format. |
269 |
367 |
270 \sa date |
368 \sa date() |
271 */ |
369 */ |
272 void HbDateTimePicker::setDate(const QDate& date) |
370 void HbDateTimePicker::setDate(const QDate& date) |
273 { |
371 { |
274 Q_D(HbDateTimePicker); |
372 Q_D(HbDateTimePicker); |
275 setDateTime(QDateTime(date,d->mDateTime.time())); |
373 setDateTime(QDateTime(date,d->mDateTime.time())); |
276 } |
374 } |
277 |
375 |
278 /*! |
376 /*! |
279 Returns minimum date in QDate format. |
377 Returns the minimum date in QDate format. |
280 |
378 |
281 \return Minimum date set on datetime picker in QDate format. |
379 \note DocML does not directly support properties that use QDate as a parameter. For these |
282 |
380 properties, pass the date as a string in a valid ISO 8601 extended format, such as YYYY-MM-DD. |
283 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
381 |
284 as a string, in a valid ISO date format. |
382 \code |
285 |
|
286 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
|
287 |
|
288 \code |
|
289 ... |
|
290 <widget name="t:dtp" type="HbDateTimePicker"> |
383 <widget name="t:dtp" type="HbDateTimePicker"> |
291 <!-- 'minimumDate' is a QDate property of HbDateTimePicker. --> |
384 <!-- 'minimumDate' is a QDate property of HbDateTimePicker. --> |
292 <string name="minimumDate" value="02-02-15" /> |
385 <string name="minimumDate" value="02-02-15" /> |
293 </widget> |
386 </widget> |
294 ... |
387 \endcode |
295 \endcode |
388 |
296 |
389 \sa setMinimumDate() |
297 \sa setMinimumDate |
|
298 */ |
390 */ |
299 QDate HbDateTimePicker::minimumDate()const |
391 QDate HbDateTimePicker::minimumDate()const |
300 { |
392 { |
301 Q_D(const HbDateTimePicker); |
393 Q_D(const HbDateTimePicker); |
302 return d->mMinimumDate.date(); |
394 return d->mMinimumDate.date(); |
303 } |
395 } |
304 |
396 |
305 /*! |
397 /*! |
306 Sets minimum \a date in QDate format. |
398 Sets the minimum date to \a date. |
307 |
399 |
308 \param Minimum date to be set on datetime picker in QDate format. |
400 \param date The minimum date in QDate format. |
309 |
401 |
310 \sa minimumDate |
402 \sa minimumDate(), setDateRange() |
311 */ |
403 */ |
312 void HbDateTimePicker::setMinimumDate(const QDate& date) |
404 void HbDateTimePicker::setMinimumDate(const QDate& date) |
313 { |
405 { |
314 Q_D(HbDateTimePicker); |
406 Q_D(HbDateTimePicker); |
315 setMinimumDateTime(QDateTime(date, d->mMinimumDate.time())); |
407 setMinimumDateTime(QDateTime(date, d->mMinimumDate.time())); |
316 } |
408 } |
317 |
409 |
318 /*! |
410 /*! |
319 Returns maximum date in QDate format. |
411 Returns the maximum date in QDate format. |
320 |
412 |
321 \return Maximum Date set on datetime picker in QDate format. |
413 \note DocML does not directly support properties that use QDate as a parameter. For these |
322 |
414 properties, pass the date as a string in a valid ISO 8601 extended format, such as YYYY-MM-DD. |
323 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
415 |
324 as a string, in a valid ISO date format. |
416 \code |
325 |
|
326 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
|
327 |
|
328 \code |
|
329 ... |
|
330 <widget name="t:dtp" type="HbDateTimePicker"> |
417 <widget name="t:dtp" type="HbDateTimePicker"> |
331 <!-- 'maximumDate' is a QDate property of HbDateTimePicker. --> |
418 <!-- 'maximumDate' is a QDate property of HbDateTimePicker. --> |
332 <string name="maximumDate" value="02-02-15" /> |
419 <string name="maximumDate" value="02-02-15" /> |
333 </widget> |
420 </widget> |
334 ... |
421 \endcode |
335 \endcode |
422 |
336 |
423 \sa setMaximumDate() |
337 \sa setMaximumDate |
|
338 */ |
424 */ |
339 QDate HbDateTimePicker::maximumDate()const |
425 QDate HbDateTimePicker::maximumDate()const |
340 { |
426 { |
341 Q_D(const HbDateTimePicker); |
427 Q_D(const HbDateTimePicker); |
342 return d->mMaximumDate.date(); |
428 return d->mMaximumDate.date(); |
343 } |
429 } |
344 |
430 |
345 /*! |
431 /*! |
346 Sets maximum \a date in QDate format. |
432 Sets the maximum date to \a date. |
347 |
433 |
348 \param date Maximum date to be set on datetime picker in QDate format. |
434 \param date The maximum date in QDate format. |
349 |
435 |
350 \sa maximumDate |
436 \sa maximumDate(), setDateRange() |
351 */ |
437 */ |
352 void HbDateTimePicker::setMaximumDate(const QDate& date) |
438 void HbDateTimePicker::setMaximumDate(const QDate& date) |
353 { |
439 { |
354 Q_D(HbDateTimePicker); |
440 Q_D(HbDateTimePicker); |
355 setMaximumDateTime(QDateTime(date, d->mMaximumDate.time())); |
441 setMaximumDateTime(QDateTime(date, d->mMaximumDate.time())); |
356 } |
442 } |
357 |
443 |
358 /*! |
444 /*! |
359 Sets minimum \a minDate and maximum \a maxDate dates in QDate format. This will allow user to set date range on datetime picker. |
445 Sets the minimum and maximum dates. |
360 |
446 |
361 \param minDate Minimum date in QDate format. |
447 \param minDate The minimum date in QDate format. |
362 \param maxDate Maximum date in QDate format. |
448 \param maxDate The maximum date in QDate format. |
363 |
449 |
364 \sa setMinimumDate \sa setMaximumDate |
450 \sa setMinimumDate(), setMaximumDate() |
365 */ |
451 */ |
366 void HbDateTimePicker::setDateRange(const QDate &minDate, const QDate &maxDate) |
452 void HbDateTimePicker::setDateRange(const QDate &minDate, const QDate &maxDate) |
367 { |
453 { |
368 Q_D(HbDateTimePicker); |
454 Q_D(HbDateTimePicker); |
369 setDateTimeRange(QDateTime(minDate, d->mMinimumDate.time()), |
455 setDateTimeRange(QDateTime(minDate, d->mMinimumDate.time()), |
370 QDateTime(maxDate, d->mMaximumDate.time())); |
456 QDateTime(maxDate, d->mMaximumDate.time())); |
371 } |
457 } |
372 |
458 |
373 /*! |
459 /*! |
374 Returns the current date and time value, selected in datetime picker, in QDateTime format. |
460 Returns the currently selected date and time in QDateTime format. |
375 |
461 |
376 \return date and time value in QDateTime format. |
462 \note DocML does not directly support properties that use QDate, QTime or QDateTime as a |
377 |
463 parameter. For these properties, pass the date, time or date and time as a string in a |
378 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
464 valid ISO 8601 extended format. For example, YYYY-MM-DD for dates and YYYY-MM-DDTHH:MM:SS |
379 as a string, in a valid ISO date format. |
465 for combined dates and times. |
380 |
466 |
381 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
467 \code |
382 |
|
383 \code |
|
384 ... |
|
385 <widget name="t:dtp" type="HbDateTimePicker"> |
468 <widget name="t:dtp" type="HbDateTimePicker"> |
386 <!-- 'dateTime' is a QDateTime property of HbDateTimePicker. --> |
469 <!-- 'dateTime' is a QDateTime property of HbDateTimePicker. --> |
387 <string name="dateTime" value="02-02-15T02-15-30" /> |
470 <string name="dateTime" value="02-02-15T02-15-30" /> |
388 </widget> |
471 </widget> |
389 ... |
472 \endcode |
390 \endcode |
473 |
391 |
474 \sa setDateTime() |
392 \sa setDateTime |
|
393 */ |
475 */ |
394 QDateTime HbDateTimePicker::dateTime()const |
476 QDateTime HbDateTimePicker::dateTime()const |
395 { |
477 { |
396 Q_D(const HbDateTimePicker); |
478 Q_D(const HbDateTimePicker); |
397 return d->mDateTime; |
479 return d->mDateTime; |
398 } |
480 } |
399 |
481 |
400 /*! |
482 /*! |
401 Sets the current \a datetime value to be set on datetime picker in QDateTime format. |
483 Sets the current date and time. |
402 |
484 |
403 \param datetime in QDateTime format. |
485 \param datetime The date and time in QDateTime format. |
404 |
486 |
405 \sa dateTime |
487 \sa dateTime() |
406 */ |
488 */ |
407 void HbDateTimePicker::setDateTime(const QDateTime &datetime) |
489 void HbDateTimePicker::setDateTime(const QDateTime &datetime) |
408 { |
490 { |
409 Q_D(HbDateTimePicker); |
491 Q_D(HbDateTimePicker); |
410 d->setDateTime(datetime); |
492 d->setDateTime(datetime); |
411 } |
493 } |
412 |
494 |
413 /*! |
495 /*! |
414 Returns minimum date time value set on datetime picker in QDateTime format. |
496 Returns the minimum date and time in QDateTime format. |
415 |
497 |
416 \return Minimum date and minimum time in QDateTime format. |
498 \note DocML does not directly support properties that use QDate, QTime or QDateTime as a |
417 |
499 parameter. For these properties, pass the date, time or date and time as a string in a |
418 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
500 valid ISO 8601 extended format. For example, YYYY-MM-DD for dates and YYYY-MM-DDTHH:MM:SS |
419 as a string, in a valid ISO date format. |
501 for combined dates and times. |
420 |
502 |
421 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
503 \code |
422 |
|
423 \code |
|
424 ... |
|
425 <widget name="t:dtp" type="HbDateTimePicker"> |
504 <widget name="t:dtp" type="HbDateTimePicker"> |
426 <!-- 'minimumDateTime' is a QDateTime property of HbDateTimePicker. --> |
505 <!-- 'minimumDateTime' is a QDateTime property of HbDateTimePicker. --> |
427 <string name="minimumDateTime" value="02-02-15T02-15-30" /> |
506 <string name="minimumDateTime" value="02-02-15T02-15-30" /> |
428 </widget> |
507 </widget> |
429 ... |
508 \endcode |
430 \endcode |
509 |
431 |
510 \sa setMinimumDateTime() |
432 \sa setMinimumDateTime |
|
433 */ |
511 */ |
434 QDateTime HbDateTimePicker::minimumDateTime()const |
512 QDateTime HbDateTimePicker::minimumDateTime()const |
435 { |
513 { |
436 Q_D(const HbDateTimePicker); |
514 Q_D(const HbDateTimePicker); |
437 return d->mMinimumDate; |
515 return d->mMinimumDate; |
438 } |
516 } |
439 |
517 |
440 /*! |
518 /*! |
441 Sets minimum \a datetime for datetime picker in QDateTime format. |
519 Sets the minimum date and time. |
442 |
520 |
443 <b>Note:</b> There's no link between Date functionality and time functionality in this API. Using this API, for now, |
521 \note The date and time are not linked in this API. This means that |
444 would be similar to using a combination of setMinimumDate and setMinimumTime APIs. |
522 calling this function is similar to calling setMinimumDate() and setMinimumTime(). |
445 |
523 |
446 \param datetime minimum date and minimum time in QDateTime format. |
524 \param datetime The minimum date and time in QDateTime format. |
447 |
525 |
448 \sa minimumDateTime \sa setMinimumDate \sa setMinimumTime |
526 \sa minimumDateTime(), setDateTimeRange() |
449 */ |
527 */ |
450 void HbDateTimePicker::setMinimumDateTime(const QDateTime& datetime) |
528 void HbDateTimePicker::setMinimumDateTime(const QDateTime& datetime) |
451 { |
529 { |
452 Q_D(HbDateTimePicker); |
530 Q_D(HbDateTimePicker); |
453 d->setMinimumDateTime(datetime); |
531 d->setMinimumDateTime(datetime); |
454 } |
532 } |
455 |
533 |
456 /*! |
534 /*! |
457 Returns maximum date time, set on datetime picker, in QDateTime format. |
535 Returns the maximum date and time in QDateTime format. |
458 |
536 |
459 \return Maximum date and maximum time in QDateTime format. |
537 \note DocML does not directly support properties that use QDate, QTime or |
460 |
538 QDateTime as parameters. For these properties, pass the date, time, or date and time |
461 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
539 as a string in a valid ISO 8601 extended format. For example, YYYY-MM-DD for dates |
462 as a string, in a valid ISO date format. |
540 or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
463 |
541 |
464 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
542 \code |
465 |
|
466 \code |
|
467 ... |
|
468 <widget name="t:dtp" type="HbDateTimePicker"> |
543 <widget name="t:dtp" type="HbDateTimePicker"> |
469 <!-- 'maximumDateTime' is a QDateTime property of HbDateTimePicker. --> |
544 <!-- 'maximumDateTime' is a QDateTime property of HbDateTimePicker. --> |
470 <string name="maximumDateTime" value="02-02-15T02-15-30" /> |
545 <string name="maximumDateTime" value="02-02-15T02-15-30" /> |
471 </widget> |
546 </widget> |
472 ... |
547 \endcode |
473 \endcode |
548 |
474 |
549 \sa setMaximumDateTime() |
475 \sa setMaximumDateTime |
|
476 */ |
550 */ |
477 QDateTime HbDateTimePicker::maximumDateTime()const |
551 QDateTime HbDateTimePicker::maximumDateTime()const |
478 { |
552 { |
479 Q_D(const HbDateTimePicker); |
553 Q_D(const HbDateTimePicker); |
480 return d->mMaximumDate; |
554 return d->mMaximumDate; |
481 } |
555 } |
482 |
556 |
483 /*! |
557 /*! |
484 Sets maximum \a datetime, to be set on datetime picker, in QDateTime format. |
558 Sets the maximum date and time. |
485 |
559 |
486 <b>Note:</b> There's no link between Date functionality and time functionality in this API, using this API for now |
560 \note The date and time are not linked in this API. This means that |
487 would be similar to using a combination of setMaximumDate and setMaximumTime APIs. |
561 calling this function is similar to calling setMaximumDate() and setMaximumTime(). |
488 |
562 |
489 \param date Maximum date and maximum time in QDateTime format. |
563 \param date The maximum date and time in QDateTime format. |
490 |
564 |
491 \sa maximumDateTime \sa setMaximumDate \sa setMaximumTime |
565 \sa maximumDateTime(), setDateTimeRange() |
492 */ |
566 */ |
493 void HbDateTimePicker::setMaximumDateTime(const QDateTime& date) |
567 void HbDateTimePicker::setMaximumDateTime(const QDateTime& date) |
494 { |
568 { |
495 Q_D(HbDateTimePicker); |
569 Q_D(HbDateTimePicker); |
496 d->setMaximumDateTime(date); |
570 d->setMaximumDateTime(date); |
497 } |
571 } |
498 |
572 |
499 /*! |
573 /*! |
500 Sets minimum \a minDatetime and maximum \a maxDatetime date and time values, to be set on datetime picker, in QDateTime format. |
574 Sets the minimum and maximum date and time. |
501 This will allow the user to set date and time range on datetime picker. |
575 |
502 |
576 \note The date and time are not linked in this API. This means that calling |
503 <b>Note:</b> There's no link between Date and time in this API, using this API for now |
577 this function is equivalent to calling setMinimumDate(), setMaximumDate(), |
504 would be similar to using a combination of setMinimumDate, setMaximumTime and |
578 setMinimumTime(), and setMaximumTime(). |
505 setMinimumTime, setMaximumTime APIs. |
579 |
506 |
580 \param minDateTime The minimum date and time in QDateTime format. |
507 \param minDateTime minimum date and time in QDateTime format. |
581 \param maxDateTime The maximum date and time in QDateTime format. |
508 \param maxDateTime maximum date and time in QDateTime format. |
582 |
509 |
583 \sa setMinimumDateTime(), setMaximumDateTime() |
510 \sa setMinimumDateTime \sa setMaximumDateTime \sa setMinimumDate \sa setMaximumDate |
|
511 \sa setMinimumTime \sa setMaximumTime |
|
512 */ |
584 */ |
513 void HbDateTimePicker::setDateTimeRange(const QDateTime &minDateTime, const QDateTime &maxDateTime) |
585 void HbDateTimePicker::setDateTimeRange(const QDateTime &minDateTime, const QDateTime &maxDateTime) |
514 { |
586 { |
515 Q_D(HbDateTimePicker); |
587 Q_D(HbDateTimePicker); |
516 d->setDateTimeRange(minDateTime, maxDateTime); |
588 d->setDateTimeRange(minDateTime, maxDateTime); |
517 } |
589 } |
518 |
590 |
519 /*! |
591 /*! |
520 Returns the current time, selected in datetime picker widget, in QTime format. |
592 Returns the currently selected time in QTime format. |
521 |
593 |
522 \return time in QTime format. |
594 \note DocML does not directly support properties that use QTime as a parameter. |
523 |
595 For these properties, pass the time as a string in a valid ISO 8601 extended format; |
524 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
596 for example, HH:MM:SS. |
525 as a string, in a valid ISO date format. |
597 |
526 |
598 \code |
527 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
|
528 |
|
529 \code |
|
530 ... |
|
531 <widget name="t:dtp" type="HbDateTimePicker"> |
599 <widget name="t:dtp" type="HbDateTimePicker"> |
532 <!-- 'time' is a QTime property of HbDateTimePicker. --> |
600 <!-- 'time' is a QTime property of HbDateTimePicker. --> |
533 <string name="time" value="02-15-30" /> |
601 <string name="time" value="02-15-30" /> |
534 </widget> |
602 </widget> |
535 ... |
603 \endcode |
536 \endcode |
604 |
537 |
605 \sa setTime() |
538 \sa setTime |
|
539 */ |
606 */ |
540 QTime HbDateTimePicker::time() const |
607 QTime HbDateTimePicker::time() const |
541 { |
608 { |
542 Q_D(const HbDateTimePicker); |
609 Q_D(const HbDateTimePicker); |
543 return d->mDateTime.time(); |
610 return d->mDateTime.time(); |
544 } |
611 } |
545 |
612 |
546 /*! |
613 /*! |
547 Sets the current \a time, to be set on datetime picker widget, in QTime format. |
614 Sets the current time to \a time. |
548 |
615 |
549 \param time in QTime format. |
616 \param time The time in QTime format. |
550 |
617 |
551 \sa time |
618 \sa time() |
552 */ |
619 */ |
553 void HbDateTimePicker::setTime(const QTime &time) |
620 void HbDateTimePicker::setTime(const QTime &time) |
554 { |
621 { |
555 Q_D(HbDateTimePicker); |
622 Q_D(HbDateTimePicker); |
556 setDateTime(QDateTime(d->mDateTime.date(), time)); |
623 setDateTime(QDateTime(d->mDateTime.date(), time)); |
557 } |
624 } |
558 |
625 |
559 /*! |
626 /*! |
560 Returns minimum time, set on datetime picker, in QTime format. |
627 Returns the minimum time in QTime format. |
561 |
628 |
562 \return Minimum time in QTime format. |
629 \note DocML does not directly support properties that use QTime as a parameter. |
563 |
630 For these properties, pass the time as a string in a valid ISO 8601 extended format; |
564 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
631 for example, HH:MM:SS. |
565 as a string, in a valid ISO date format. |
632 |
566 |
633 \code |
567 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
|
568 |
|
569 \code |
|
570 ... |
|
571 <widget name="t:dtp" type="HbDateTimePicker"> |
634 <widget name="t:dtp" type="HbDateTimePicker"> |
572 <!-- 'minimumTime' is a QTime property of HbDateTimePicker. --> |
635 <!-- 'minimumTime' is a QTime property of HbDateTimePicker. --> |
573 <string name="minimumTime" value="02-15-30" /> |
636 <string name="minimumTime" value="08-00-00" /> |
574 </widget> |
637 </widget> |
575 ... |
638 \endcode |
576 \endcode |
639 |
577 |
640 \sa setMinimumTime() |
578 \sa setMinimumTime |
|
579 */ |
641 */ |
580 QTime HbDateTimePicker::minimumTime()const |
642 QTime HbDateTimePicker::minimumTime()const |
581 { |
643 { |
582 Q_D(const HbDateTimePicker); |
644 Q_D(const HbDateTimePicker); |
583 return d->mMinimumDate.time(); |
645 return d->mMinimumDate.time(); |
584 } |
646 } |
585 |
647 |
586 /*! |
648 /*! |
587 Sets minimum \a time, to be set on datetime picker, in QTime format. |
649 Sets the minimum time to \a time. |
588 |
650 |
589 \param time minimum time in QTime format. |
651 \param time The minimum time in QTime format. |
590 |
652 |
591 \sa minimumTime |
653 \sa minimumTime(), setTimeRange() |
592 */ |
654 */ |
593 void HbDateTimePicker::setMinimumTime(const QTime& time) |
655 void HbDateTimePicker::setMinimumTime(const QTime& time) |
594 { |
656 { |
595 Q_D(HbDateTimePicker); |
657 Q_D(HbDateTimePicker); |
596 setMinimumDateTime(QDateTime(d->mDateTime.date(),time)); |
658 setMinimumDateTime(QDateTime(d->mDateTime.date(),time)); |
597 } |
659 } |
598 |
660 |
599 /*! |
661 /*! |
600 Returns maximum time, set on datetime picker, in QTime format. |
662 Returns the maximum time in QTime format. |
601 |
663 |
602 \return maximum time in QTime format. |
664 \note DocML does not directly support properties that use QTime as a parameter. |
603 |
665 For these properties, pass the time as a string in a valid ISO 8601 extended format; |
604 <b>Note:</b> The DocML does not support directly the properties which uses QDate/QTime/QDateTime as parameters. For the properties to work user has to pass date, time or datetime |
666 for example, HH:MM:SS. |
605 as a string, in a valid ISO date format. |
667 |
606 |
668 \code |
607 ISO 8601 extended format: either YYYY-MM-DD for dates or YYYY-MM-DDTHH:MM:SS for combined dates and times. |
|
608 |
|
609 \code |
|
610 ... |
|
611 <widget name="t:dtp" type="HbDateTimePicker"> |
669 <widget name="t:dtp" type="HbDateTimePicker"> |
612 <!-- 'maximumTime' is a QTime property of HbDateTimePicker. --> |
670 <!-- 'maximumTime' is a QTime property of HbDateTimePicker. --> |
613 <string name="maximumTime" value="02-15-30" /> |
671 <string name="maximumTime" value="18-30-00" /> |
614 </widget> |
672 </widget> |
615 ... |
673 \endcode |
616 \endcode |
674 |
617 |
675 \sa setMaximumTime() |
618 \sa setMaximumTime |
|
619 */ |
676 */ |
620 QTime HbDateTimePicker::maximumTime()const |
677 QTime HbDateTimePicker::maximumTime()const |
621 { |
678 { |
622 Q_D(const HbDateTimePicker); |
679 Q_D(const HbDateTimePicker); |
623 return d->mMaximumDate.time(); |
680 return d->mMaximumDate.time(); |
624 } |
681 } |
625 |
682 |
626 /*! |
683 /*! |
627 Sets maximum \a time, to be set on datetime picker, in QTime format. |
684 Sets the maximum time to \a time. |
628 |
685 |
629 \param time maximum time in QTime format |
686 \param time The maximum time in QTime format. |
630 |
687 |
631 \sa maximumTime |
688 \sa maximumTime(), setTimeRange() |
632 */ |
689 */ |
633 void HbDateTimePicker::setMaximumTime(const QTime& time) |
690 void HbDateTimePicker::setMaximumTime(const QTime& time) |
634 { |
691 { |
635 Q_D(HbDateTimePicker); |
692 Q_D(HbDateTimePicker); |
636 setMaximumDateTime(QDateTime(d->mMaximumDate.date(), time)); |
693 setMaximumDateTime(QDateTime(d->mMaximumDate.date(), time)); |
637 } |
694 } |
638 |
695 |
639 /*! |
696 /*! |
640 Sets minimum \a minTime and maximum \a maxTime in QTime format. This will allow the user to set a time range on datetime picker. |
697 Sets the minimum and maximum time. |
641 |
698 |
642 \param minTime minimum time in QTime format. |
699 \param minTime The minimum time in QTime format. |
643 \param maxTime maximum time in QTime format. |
700 \param maxTime The maximum time in QTime format. |
644 |
701 |
645 \sa setMinimumTime \sa setMaximumTime |
702 \sa setMinimumTime(), setMaximumTime() |
646 */ |
703 */ |
647 void HbDateTimePicker::setTimeRange(const QTime &minTime, const QTime &maxTime) |
704 void HbDateTimePicker::setTimeRange(const QTime &minTime, const QTime &maxTime) |
648 { |
705 { |
649 Q_D(HbDateTimePicker); |
706 Q_D(HbDateTimePicker); |
650 setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime), |
707 setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime), |
651 QDateTime(d->mMinimumDate.date(), maxTime)); |
708 QDateTime(d->mMinimumDate.date(), maxTime)); |
652 } |
709 } |
653 |
710 |
654 /*! |
711 /*! |
655 Sets the \a interval or periodic gap for the corresponding \a section. |
712 Sets the interval or periodic gap for a tumbler. Currently this is |
656 |
713 supported for minute tumblers only. |
657 <b>Note</b>: Only MinuteSection is supported at this time.<br> |
714 |
658 <b>Note</b>: Minute interval must be a divisor of 60. Divisors of 60 are 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 |
715 \param section This identifies the tumbler. This must be QDateTimeEdit::MinuteSection. |
659 |
716 \param interval The interval to set on the tumbler. This must be a divisor of 60; that |
660 \param section can be a MinuteSection. |
717 is, 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, or 30. |
661 \param interval to be set on each picker. |
718 |
|
719 \sa interval() |
662 */ |
720 */ |
663 void HbDateTimePicker::setInterval(QDateTimeEdit::Section section,int interval) |
721 void HbDateTimePicker::setInterval(QDateTimeEdit::Section section,int interval) |
664 { |
722 { |
665 Q_D(HbDateTimePicker); |
723 Q_D(HbDateTimePicker); |
666 |
724 |