[LyX/master] address deprecation warning

Juergen Spitzmueller spitz at lyx.org
Thu Aug 27 12:17:31 UTC 2020


commit 4fdcf0e9293c4fbf79ff2dc4279cdf7941783592
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Aug 27 14:43:23 2020 +0200

    address deprecation warning
---
 src/frontends/qt/qt_helpers.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp
index 2e5e7da..fc1f961 100644
--- a/src/frontends/qt/qt_helpers.cpp
+++ b/src/frontends/qt/qt_helpers.cpp
@@ -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);


More information about the lyx-cvs mailing list