diff --git a/src/libs/vpropertyexplorer/plugins/vtextproperty.cpp b/src/libs/vpropertyexplorer/plugins/vtextproperty.cpp index 0e9ae1d1d..69d1a9781 100644 --- a/src/libs/vpropertyexplorer/plugins/vtextproperty.cpp +++ b/src/libs/vpropertyexplorer/plugins/vtextproperty.cpp @@ -39,7 +39,11 @@ void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar) #else // compute the size of a char in double-precision static constexpr int bigNumber = 1000; // arbitrary big number. +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + const int many_char_width = fontMetrics.horizontalAdvance(testString.repeated(bigNumber)); +#else const int many_char_width = fontMetrics.width(testString.repeated(bigNumber)); +#endif const double singleCharWidthDouble = many_char_width / double(bigNumber); // set the tab stop with double precision edit->setTabStopDistance(tabWidthChar * singleCharWidthDouble); diff --git a/src/libs/vtools/dialogs/dialogtoolbox.cpp b/src/libs/vtools/dialogs/dialogtoolbox.cpp index ef757a014..45b950c2e 100644 --- a/src/libs/vtools/dialogs/dialogtoolbox.cpp +++ b/src/libs/vtools/dialogs/dialogtoolbox.cpp @@ -501,7 +501,11 @@ void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar) #else // compute the size of a char in double-precision static constexpr int bigNumber = 1000; // arbitrary big number. +#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) + const int many_char_width = fontMetrics.horizontalAdvance(testString.repeated(bigNumber)); +#else const int many_char_width = fontMetrics.width(testString.repeated(bigNumber)); +#endif const double singleCharWidthDouble = many_char_width / double(bigNumber); // set the tab stop with double precision edit->setTabStopDistance(tabWidthChar * singleCharWidthDouble);