summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-12-02 20:40:57 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-05 13:50:50 +0100
commitb8084618545570a8832d344a2e9586e1226cc697 (patch)
treef22ce8fd2972d0140b84a91470c182656e1a190f /src
parent3e549f5daa55464512ee2763558f3a7ffd45c545 (diff)
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 <Friedemann.Kleint@digia.com> Reviewed-by: Tasuku Suzuki <stasuku@gmail.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qlineedit.cpp2
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
2 files changed, 2 insertions, 2 deletions
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) {