Qt: deprecation warnings, again

Check Qt version for the QFontMetrics::width vs horizontalAdvance.
Of course can't just #define horizontalAdvance to width, that would
be too easy ...
This commit is contained in:
Pasi Kallinen
2021-08-15 10:58:42 +03:00
parent 29aca6276e
commit 98ec66e00c
7 changed files with 22 additions and 13 deletions
+9
View File
@@ -27,5 +27,14 @@
#pragma GCC diagnostic ignored "-Wshadow"
#endif
#include <QtGlobal>
/* QFontMetrics::width was deprecated in Qt 5.11 */
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
#define QFM_WIDTH(foo) width(foo)
#else
#define QFM_WIDTH(foo) horizontalAdvance(foo)
#endif
/*qt_pre.h*/