diff options
author | Sami Merila <sami.merila@nokia.com> | 2009-12-21 11:28:47 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2009-12-21 11:28:47 (GMT) |
commit | 71ee64f5a44dc310272b14fe6cd913b2e75672ed (patch) | |
tree | f38b4617a0d886d802e8bb33aa2e3db02053519c | |
parent | 3e45dbcc89a9f2284d8ab89e0c75bd7b275e6b61 (diff) | |
download | Qt-71ee64f5a44dc310272b14fe6cd913b2e75672ed.zip Qt-71ee64f5a44dc310272b14fe6cd913b2e75672ed.tar.gz Qt-71ee64f5a44dc310272b14fe6cd913b2e75672ed.tar.bz2 |
Edit focus should not be lost unless by explicit action
Currently non-touch devices lose edit focus if window switch
happens. I.e. in cases when screensaver activates, an incoming call
occurs, a global notification is shown...
With this fix, edit focus remain active, until user removes the
focus explicitly.
Task-number: 4792
Reviewed-by: axis
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qtextcontrol.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index bd13423..4165c95 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2096,7 +2096,11 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) if (prev) { #ifdef QT_KEYPAD_NAVIGATION if (QApplication::keypadNavigationEnabled()) { - if (prev->hasEditFocus() && reason != Qt::PopupFocusReason) + if (prev->hasEditFocus() && reason != Qt::PopupFocusReason +#ifdef Q_OS_SYMBIAN + && reason != Qt::ActiveWindowFocusReason +#endif + ) prev->setEditFocus(false); } #endif diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index f96f66b..f523226 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1938,7 +1938,11 @@ void QTextControlPrivate::focusEvent(QFocusEvent *e) emit q->updateRequest(q->selectionRect()); if (e->gotFocus()) { #ifdef QT_KEYPAD_NAVIGATION - if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && e->reason() == Qt::PopupFocusReason)) { + if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason +#ifdef Q_OS_SYMBIAN + || e->reason() == Qt::ActiveWindowFocusReason +#endif + ))) { #endif cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard); if (interactionFlags & Qt::TextEditable) { diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index 15dcda2..573b2b5 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1761,7 +1761,11 @@ void QLineEdit::focusInEvent(QFocusEvent *e) d->clickCausedFocus = 1; } #ifdef QT_KEYPAD_NAVIGATION - if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && e->reason() == Qt::PopupFocusReason)){ + if (!QApplication::keypadNavigationEnabled() || (hasEditFocus() && ( e->reason() == Qt::PopupFocusReason +#ifdef Q_OS_SYMBIAN + || e->reason() == Qt::ActiveWindowFocusReason +#endif + ))) { #endif d->control->setCursorBlinkPeriod(QApplication::cursorFlashTime()); QStyleOptionFrameV2 opt; |