aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help/textbrowserhelpviewer.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2016-04-12 15:26:53 +0200
committerEike Ziller <eike.ziller@theqtcompany.com>2016-04-13 08:09:44 +0000
commitcb62258ee33fc3cc38dceae14a0f6b8c8ff45de9 (patch)
treeb168fca41de646e0d3ea9bf0adae659ee252ac78 /src/plugins/help/textbrowserhelpviewer.cpp
parent55bfa4401fb3624566a4e245535ea62c9fcec3d0 (diff)
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>
Diffstat (limited to 'src/plugins/help/textbrowserhelpviewer.cpp')
-rw-r--r--src/plugins/help/textbrowserhelpviewer.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/help/textbrowserhelpviewer.cpp b/src/plugins/help/textbrowserhelpviewer.cpp
index 531cfa5c454..64464f5ca4a 100644
--- a/src/plugins/help/textbrowserhelpviewer.cpp
+++ b/src/plugins/help/textbrowserhelpviewer.cpp
@@ -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;
+ }
+}