From 53ec8b896a1adfe4fafd2c485bdbec23556a2f5f Mon Sep 17 00:00:00 2001 From: Tibo Clausen Date: Mon, 9 Sep 2019 14:05:37 +0100 Subject: [PATCH] Replace deprecated function call --- src/ElidingLabel.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ElidingLabel.cpp b/src/ElidingLabel.cpp index 8e6ea56..73b46b4 100644 --- a/src/ElidingLabel.cpp +++ b/src/ElidingLabel.cpp @@ -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; }