address deprecation warning

This commit is contained in:
Juergen Spitzmueller 2020-08-27 14:43:23 +02:00
parent 28dd0e1f21
commit 4fdcf0e929

View File

@ -703,7 +703,11 @@ QString formatToolTip(QString text, int em)
text = Qt::convertFromPlainText(text, Qt::WhiteSpaceNormal);
// Compute desired width in pixels
QFont const font = QToolTip::font();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
int const px_width = em * QFontMetrics(font).horizontalAdvance("M");
#else
int const px_width = em * QFontMetrics(font).width("M");
#endif
// Determine the ideal width of the tooltip
QTextDocument td("");
td.setHtml(text);