summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-11-05 11:22:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-05 17:37:05 +0100
commit71ce869825a0af3fec66c4cd29083ec5d0d76eda (patch)
tree25b0e3cef3b97206cb8f5e2b45ccbdb1fa18f1f1 /src
parent94ad841ab547e98da111ac41f235cb94cf2d0a45 (diff)
Fix placeholder text in QTextBrowser
Task-number: QTBUG-34051 Change-Id: Ief55cda861ef293a5fdeb2e5fa287b835c729894 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/widgets/qtextedit.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 0f61eb487f..49e05e8e14 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -1513,6 +1513,14 @@ void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e)
if (layout)
layout->setViewport(QRect());
+
+ if (!placeholderText.isEmpty() && doc->isEmpty()) {
+ QColor col = control->palette().text().color();
+ col.setAlpha(128);
+ p->setPen(col);
+ const int margin = int(doc->documentMargin());
+ p->drawText(viewport->rect().adjusted(margin, margin, -margin, -margin), Qt::AlignTop | Qt::TextWordWrap, placeholderText);
+ }
}
/*! \fn void QTextEdit::paintEvent(QPaintEvent *event)
@@ -1528,13 +1536,6 @@ void QTextEdit::paintEvent(QPaintEvent *e)
Q_D(QTextEdit);
QPainter p(d->viewport);
d->paint(&p, e);
- if (!d->placeholderText.isEmpty() && d->control->document()->isEmpty()) {
- QColor col = palette().text().color();
- col.setAlpha(128);
- p.setPen(col);
- const int margin = int(document()->documentMargin());
- p.drawText(d->viewport->rect().adjusted(margin, margin, -margin, -margin), Qt::AlignTop | Qt::TextWordWrap, d->placeholderText);
- }
}
void QTextEditPrivate::_q_currentCharFormatChanged(const QTextCharFormat &fmt)