diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qdatetimeedit.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol_p.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit_p.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit_p.h | 3 |
7 files changed, 29 insertions, 11 deletions
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 5ddf7f7..cb76876 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -1086,10 +1086,6 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event) //hide cursor d->edit->d_func()->setCursorVisible(false); - if (d->edit->d_func()->cursorTimer > 0) - killTimer(d->edit->d_func()->cursorTimer); - d->edit->d_func()->cursorTimer = 0; - d->setSelected(0); } } diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index f68d287..d90d53b 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1295,7 +1295,7 @@ bool QLineControl::processEvent(QEvent* ev) } if ((ev->type() == QEvent::KeyRelease) && !isReadOnly() - && deleteAllTimer) { + && m_deleteAllTimer) { killTimer(m_deleteAllTimer); m_deleteAllTimer = 0; backspace(); @@ -1701,12 +1701,12 @@ void QLineControl::processKeyEvent(QKeyEvent* event) if (text().length() == 0) { setText(m_cancelText); - if (passwordEchoEditing) + if (passwordEchoEditing()) updatePasswordEchoEditing(false); - setEditFocus(false); - } else if (!deleteAllTimer) { - deleteAllTimer = startTimer(750); + emit editFocusChange(false); + } else if (!m_deleteAllTimer) { + m_deleteAllTimer = startTimer(750); } } else { unknown = true; diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 9cad857..e047cb0 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -343,6 +343,9 @@ Q_SIGNALS: void editingFinished(); void updateNeeded(const QRect &); +#ifdef QT_KEYPAD_NAVIGATION + void editFocusChange(bool); +#endif protected: virtual void timerEvent(QTimerEvent *event); diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index e0f5bc9..9f315fd 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1669,7 +1669,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) selectAll(); } #ifdef QT_KEYPAD_NAVIGATION - if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)) + if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){ #endif int cft = QApplication::cursorFlashTime(); d->control->setCursorBlinkPeriod(cft/2); @@ -1683,7 +1683,8 @@ void QLineEdit::focusInEvent(QFocusEvent *e) qt_mac_secure_keyboard(true); #endif #ifdef QT_KEYPAD_NAVIGATION - d->control->setCancelText(d->text); + d->control->setCancelText(d->control->text()); + } #endif #ifndef QT_NO_COMPLETER if (d->control->completer()) { diff --git a/src/gui/widgets/qlineedit.h b/src/gui/widgets/qlineedit.h index daac6a7..32ef6a4 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/gui/widgets/qlineedit.h @@ -273,6 +273,9 @@ private: #ifndef QT_NO_COMPLETER Q_PRIVATE_SLOT(d_func(), void _q_completionHighlighted(QString)) #endif +#ifdef QT_KEYPAD_NAVIGATION + Q_PRIVATE_SLOT(d_func(), void _q_editFocusChange(bool)) +#endif }; #endif // QT_NO_LINEEDIT diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index f0ec8ad..aed454e 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -126,6 +126,14 @@ void QLineEditPrivate::_q_cursorPositionChanged(int from, int to) emit q->cursorPositionChanged(from, to); } +#ifdef QT_KEYPAD_NAVIGATION +void QLineEditPrivate::_q_editFocusChange(bool e) +{ + Q_Q(QLineEdit); + q->setEditFocus(e); +} +#endif + void QLineEditPrivate::init(const QString& txt) { Q_Q(QLineEdit); @@ -142,6 +150,10 @@ void QLineEditPrivate::init(const QString& txt) q, SIGNAL(returnPressed())); QObject::connect(control, SIGNAL(editingFinished()), q, SIGNAL(editingFinished())); +#ifdef QT_KEYPAD_NAVIGATION + QObject::connect(control, SIGNAL(editFocusChange(bool)), + q, SLOT(_q_editFocusChange(bool))); +#endif // for now, going completely overboard with updates. QObject::connect(control, SIGNAL(selectionChanged()), diff --git a/src/gui/widgets/qlineedit_p.h b/src/gui/widgets/qlineedit_p.h index 230023d..976e31f 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/gui/widgets/qlineedit_p.h @@ -125,6 +125,9 @@ public: void _q_deleteSelected(); void _q_textEdited(const QString &); void _q_cursorPositionChanged(int, int); +#ifdef QT_KEYPAD_NAVIGATION + void _q_editFocusChange(bool); +#endif #ifndef QT_NO_COMPLETER void _q_completionHighlighted(QString); |