Replace deprecated function call

This commit is contained in:
Tibo Clausen 2019-09-09 14:05:37 +01:00
parent 6e6c1512a6
commit 53ec8b896a

View File

@ -157,7 +157,11 @@ QSize CElidingLabel::minimumSizeHint() const
return QLabel::minimumSizeHint();
}
const QFontMetrics &fm = fontMetrics();
QSize size(fm.width(d->Text.left(2) + ""), fm.height());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
QSize size(fm.horizontalAdvance(d->Text.left(2) + ""), fm.height());
#else
QSize size(fm.width(d->Text.left(2) + ""), fm.height());
#endif
return size;
}
@ -170,7 +174,11 @@ QSize CElidingLabel::sizeHint() const
return QLabel::sizeHint();
}
const QFontMetrics& fm = fontMetrics();
QSize size(fm.width(d->Text), QLabel::sizeHint().height());
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
QSize size(fm.horizontalAdvance(d->Text), QLabel::sizeHint().height());
#else
QSize size(fm.width(d->Text), QLabel::sizeHint().height());
#endif
return size;
}