summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qlineedit_p.cpp
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@idiap.ch>2018-11-25 21:58:47 +0100
committerSamuel Gaist <samuel.gaist@idiap.ch>2019-02-12 15:29:49 +0000
commitdd1a6308719929b0798447244b401376d983cfbf (patch)
tree65fc14cf1b1c5be0a973bbde6e3d842e0a2387af /src/widgets/widgets/qlineedit_p.cpp
parentdf2b76046de4af7a47fa8303d5f261e3c5d120fe (diff)
QLineEdit: don't emit editingFinished if nothing was done
When a modal dialog is called from a slot connected to the editingFinished signal, the chain of events resulting from the focus returning to this widget will make the editingFinished signal emitted again. This patch uses a new variable to keep track of the fact that there was a modification. Once editingFinished was emitted, that flag is cleared so next time the signal will be emitted again only if a modification was made to the line edit content. [ChangeLog][QtWidget][QLineEdit] Behavior change: now the editingFinished signal is emitted only once after the line edit content was edited. Fixes: QTBUG-40 Change-Id: Ia4760bad8717f1758c3939132c446b4b4c6cd498 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/widgets/qlineedit_p.cpp')
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 2a5a0c34dc..21e70db0ac 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -127,6 +127,7 @@ void QLineEditPrivate::_q_handleWindowActivate()
void QLineEditPrivate::_q_textEdited(const QString &text)
{
Q_Q(QLineEdit);
+ edited = true;
emit q->textEdited(text);
#if QT_CONFIG(completer)
if (control->completer()
@@ -272,6 +273,12 @@ void QLineEditPrivate::setCursorVisible(bool visible)
q->update();
}
+void QLineEditPrivate::setText(const QString& text)
+{
+ edited = true;
+ control->setText(text);
+}
+
void QLineEditPrivate::updatePasswordEchoEditing(bool editing)
{
Q_Q(QLineEdit);