diff options
author | axis <qt-info@nokia.com> | 2009-11-11 12:54:27 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-11-16 09:31:36 (GMT) |
commit | 2b60b542a5f51cb983e4ad99c5fdf4e962b59b89 (patch) | |
tree | 3133828c0f3ef1eb9f28d006449f96c0217a6ae8 | |
parent | 89848ba3306c808bce412429a9d2539881cb4193 (diff) | |
download | Qt-2b60b542a5f51cb983e4ad99c5fdf4e962b59b89.zip Qt-2b60b542a5f51cb983e4ad99c5fdf4e962b59b89.tar.gz Qt-2b60b542a5f51cb983e4ad99c5fdf4e962b59b89.tar.bz2 |
Made widgets not clear their contents after losing edit focus.
This is a behavior change from Qt 4.5. The motivation for the change
is the following use case: A user types into a line or text edit, and
gets interrupted by for example phone call or an SMS. This causes the
active application to lose focus, which again causes edit focus to be
lost. When resuming the application the focus gets set back, but the
edit focus does not (nor should it). However, when the user types the
next character, the line edit will erase *all* contents of the widget
because it did not have edit focus. This is extremely destructive for
a mobile phone user, especially since undo is not easily available.
Another reason for doing that fix is that it seems that this is the
mode of operation that most existing phones use.
The fix is enabled for Symbian only at the moment, but will be
followed by a patch for all platforms which will go into 4.7.
Task: QTBUG-5698
RevBy: Jason Barron
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qtextedit.cpp | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index f5dbe1c..9372ddd 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1594,7 +1594,9 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) && !isReadOnly()) { setEditFocus(true); +#ifndef Q_OS_SYMBIAN clear(); +#endif } else { event->ignore(); return; @@ -1651,7 +1653,9 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) && hasFocus() && !hasEditFocus() && !e->preeditString().isEmpty()) { setEditFocus(true); +#ifndef Q_OS_SYMBIAN selectAll(); // so text is replaced rather than appended to +#endif } #endif diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 88502e3..14de719 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1210,7 +1210,9 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) if (!hasEditFocus() && !(e->modifiers() & Qt::ControlModifier)) { if (e->text()[0].isPrint()) { setEditFocus(true); +#ifndef Q_OS_SYMBIAN clear(); +#endif } else { e->ignore(); return; @@ -1672,7 +1674,9 @@ void QTextEdit::inputMethodEvent(QInputMethodEvent *e) && QApplication::keypadNavigationEnabled() && !hasEditFocus()) { setEditFocus(true); +#ifndef Q_OS_SYMBIAN selectAll(); // so text is replaced rather than appended to +#endif } #endif d->sendControlEvent(e); |