Merge pull request #57 from simulton/master

Fix PR #44
This commit is contained in:
githubuser0xFFFF 2019-09-09 15:16:19 +02:00 committed by GitHub
commit 3fcf05fb29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,11 @@ QSize CElidingLabel::minimumSizeHint() const
return QLabel::minimumSizeHint();
}
const QFontMetrics &fm = fontMetrics();
#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();
#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;
}