Help browser: Fix overlapping images in old docs

This works around an issue in Qt where line-height will be
interpreted as an absolute height, rather than the minimum,
so if images are larger than the specified size, they will
overlap the text.

The work around is just to change all instances of FixedHeight
to MinimumHeight until the default can be changed in Qt.

Task-number: QTBUG-51962
Change-Id: I343d30c539d434301866a7a659ef5fc300c364d6
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt
2016-04-12 15:26:53 +02:00
committed by Eike Ziller
parent 55bfa4401f
commit cb62258ee3
2 changed files with 18 additions and 0 deletions

View File

@@ -448,3 +448,19 @@ void TextBrowserHelpWidget::mouseReleaseEvent(QMouseEvent *e)
QTextBrowser::mouseReleaseEvent(e);
}
void TextBrowserHelpWidget::setSource(const QUrl &name)
{
QTextBrowser::setSource(name);
QTextCursor cursor(document());
while (!cursor.atEnd()) {
QTextBlockFormat fmt = cursor.blockFormat();
if (fmt.hasProperty(QTextFormat::LineHeightType) && fmt.lineHeightType() == QTextBlockFormat::FixedHeight) {
fmt.setProperty(QTextFormat::LineHeightType, QTextBlockFormat::MinimumHeight);
cursor.setBlockFormat(fmt);
}
if (!cursor.movePosition(QTextCursor::NextBlock))
break;
}
}