From b8084618545570a8832d344a2e9586e1226cc697 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 2 Dec 2013 20:40:57 +0100 Subject: Fix QLineEditPrivate::shouldShowPlaceholderText() As stated in commit 46106c4, placeholder text should not be shown when an empty QLineEdit has visual preedit text fed by a composing input method. The same condition applies to setPlaceholderText() in the sense that there is no need to call update() when the placeholder text is not even shown. Change-Id: I2521a119b160e16ae0738d3575fea6d9939d6d2a Reviewed-by: Friedemann Kleint Reviewed-by: Tasuku Suzuki Reviewed-by: Giuseppe D'Angelo Reviewed-by: Marc Mutz --- src/widgets/widgets/qlineedit.cpp | 2 +- src/widgets/widgets/qlineedit_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index e93e94b83d..ee1bd315d2 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1895,7 +1895,7 @@ void QLineEdit::paintEvent(QPaintEvent *) int minLB = qMax(0, -fm.minLeftBearing()); int minRB = qMax(0, -fm.minRightBearing()); - if (d->shouldShowPlaceholderText() && d->control->preeditAreaText().isEmpty()) { + if (d->shouldShowPlaceholderText()) { if (!d->placeholderText.isEmpty()) { QColor col = pal.text().color(); col.setAlpha(128); diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 4428832dd9..782feabac0 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -150,7 +150,7 @@ public: } inline bool shouldShowPlaceholderText() const { - return control->text().isEmpty(); + return control->text().isEmpty() && control->preeditAreaText().isEmpty(); } static inline QLineEditPrivate *get(QLineEdit *lineEdit) { -- cgit v1.2.3