summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qsplashscreen.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-03-30 11:39:18 +0200
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-04-15 20:36:28 +0000
commit98ad498a46471d43a745cc61fd53e08e8a6b56dc (patch)
tree1884e11e847c7a59bb53430e58572a8f5b9d637a /src/widgets/widgets/qsplashscreen.cpp
parent53f52edb2acfbfd956361b69c5363aba1f35fca6 (diff)
QSplashScreen: honor alignment when message contains html
When the message contained html, the alignment was not honored and the text was drawn topLeft instead. Use a similar algorithm like it is done in qt_format_text to move the text to the correct aligned position. Task-number: QTBUG-43081 Change-Id: I570efd0f3f339b26b102ac52983887197d7d63e2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qsplashscreen.cpp')
-rw-r--r--src/widgets/widgets/qsplashscreen.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index 468fc272b5..3dc396395f 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -327,7 +327,13 @@ void QSplashScreen::drawContents(QPainter *painter)
cursor.select(QTextCursor::Document);
QTextBlockFormat fmt;
fmt.setAlignment(Qt::Alignment(d->currAlign));
+ fmt.setLayoutDirection(layoutDirection());
cursor.mergeBlockFormat(fmt);
+ const QSizeF txtSize = doc.size();
+ if (d->currAlign & Qt::AlignBottom)
+ r.setTop(r.height() - txtSize.height());
+ else if (d->currAlign & Qt::AlignVCenter)
+ r.setTop(r.height() / 2 - txtSize.height() / 2);
painter->save();
painter->translate(r.topLeft());
doc.drawContents(painter);