equal
deleted
inserted
replaced
28 |
28 |
29 #include "hblineedit.h" |
29 #include "hblineedit.h" |
30 #include "hbdatetimevalidator_p.h" |
30 #include "hbdatetimevalidator_p.h" |
31 #include "hbdatetimeedit.h" |
31 #include "hbdatetimeedit.h" |
32 #include "hbdatetimeedit_p.h" |
32 #include "hbdatetimeedit_p.h" |
|
33 #include "hbevent.h" |
33 |
34 |
34 /*! |
35 /*! |
35 @alpha |
36 @alpha |
36 @hbwidgets |
37 @hbwidgets |
37 \brief The HbDateTimeEdit class provides a widget for editing dates and times. |
38 \brief The HbDateTimeEdit class provides a widget for editing dates and times. |
232 } |
233 } |
233 |
234 |
234 /*! |
235 /*! |
235 \reimp |
236 \reimp |
236 */ |
237 */ |
237 void HbDateTimeEdit::focusOutEvent(QFocusEvent *event) |
238 bool HbDateTimeEdit::event(QEvent* event) |
238 { |
239 { |
239 Q_D(HbDateTimeEdit); |
240 Q_D(HbDateTimeEdit); |
240 |
241 |
241 if(d->validator->fixDate(&d->cursor, true)) { |
242 if (event->type() == HbEvent::InputMethodFocusOut) { |
242 // fixing so restore focus to editor |
243 d->validator->fixDate(&d->cursor, true); |
243 // do it asynchronously by private slot: |
|
244 int metodIndex = metaObject()->indexOfMethod("_q_regainFocus()"); |
|
245 if (metodIndex<0) { |
|
246 qWarning("HbDateTimeEdit::focusOutEvent private method " |
|
247 "_q_regainFocus() NOT FOUND"); |
|
248 } else { |
|
249 if (!metaObject()->method(metodIndex).invoke(this, Qt::QueuedConnection)) { |
|
250 qWarning("HbDateTimeEdit::focusOutEvent failed to call " |
|
251 "private method _q_regainFocus()"); |
|
252 } |
|
253 } |
|
254 // prevent emmiting signal editingFinished so omnit HbLineEdit |
|
255 HbAbstractEdit::focusOutEvent(event); |
|
256 } else { |
|
257 HbLineEdit::focusOutEvent(event); |
|
258 } |
244 } |
259 } |
245 |
|
246 return HbLineEdit::event(event); |
|
247 } |
|
248 |