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>bb10
parent
53f52edb2a
commit
98ad498a46
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue