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>
bb10
J-P Nurmi 2013-12-02 20:40:57 +01:00 committed by The Qt Project
parent 3e549f5daa
commit b808461854
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -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) {