forked from qt-creator/qt-creator
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:
committed by
Eike Ziller
parent
55bfa4401f
commit
cb62258ee3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user