summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlineedit.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-11-11 12:54:27 (GMT)
committeraxis <qt-info@nokia.com>2009-11-16 09:31:36 (GMT)
commit2b60b542a5f51cb983e4ad99c5fdf4e962b59b89 (patch)
tree3133828c0f3ef1eb9f28d006449f96c0217a6ae8 /src/gui/widgets/qlineedit.cpp
parent89848ba3306c808bce412429a9d2539881cb4193 (diff)
downloadQt-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
Diffstat (limited to 'src/gui/widgets/qlineedit.cpp')
-rw-r--r--src/gui/widgets/qlineedit.cpp4
1 files changed, 4 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