Fix the cursor position of an empty QLineEdit with a placeholder text

Task-number: QTBUG-32061
Change-Id: I43b689d8d7bc3c93036de48518f7a0f9f2aa33cf
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
J-P Nurmi 2013-06-27 15:42:08 +02:00 committed by The Qt Project
parent cb6fec8515
commit cfd207212d

View File

@ -1808,9 +1808,9 @@ void QLineEdit::paintEvent(QPaintEvent *)
col.setAlpha(128);
QPen oldpen = p.pen();
p.setPen(col);
lineRect.adjust(minLB, 0, 0, 0);
QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width());
p.drawText(lineRect, va, elidedText);
QRect ph = lineRect.adjusted(minLB, 0, 0, 0);
QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, ph.width());
p.drawText(ph, va, elidedText);
p.setPen(oldpen);
}
}