Avoid extra space in tooltips

When using QTextDocument to check the natutal size of a text, one has
to remove the text margin, which is not useful here.

Fixes bug #11353.
This commit is contained in:
Jean-Marc Lasgouttes 2018-11-04 13:53:36 -10:00
parent 70e2f09c4f
commit 7db99672e6

View File

@ -645,6 +645,7 @@ QString formatToolTip(QString text, int em)
QTextDocument td("");
td.setHtml(text);
td.setDefaultFont(QToolTip::font());
td.setDocumentMargin(0);
td.setTextWidth(px_width);
double best_width = td.idealWidth();
// Set the line wrapping with appropriate width