ifdef QFontMetrics::horizontalAdvance to make it work with older Qt

This commit is contained in:
Jonas Kvinge
2019-07-08 23:27:45 +02:00
parent 4150e3efde
commit 5f7efee00e
10 changed files with 52 additions and 2 deletions

View File

@@ -87,7 +87,11 @@ void TrackSliderPopup::paintEvent(QPaintEvent*) {
void TrackSliderPopup::UpdatePixmap() {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
const int text_width = qMax(font_metrics_.horizontalAdvance(text_), small_font_metrics_.horizontalAdvance(small_text_));
#else
const int text_width = qMax(font_metrics_.width(text_), small_font_metrics_.width(small_text_));
#endif
const QRect text_rect1(kBlurRadius + kTextMargin, kBlurRadius + kTextMargin, text_width + 2, font_metrics_.height());
const QRect text_rect2(kBlurRadius + kTextMargin, text_rect1.bottom(), text_width, small_font_metrics_.height());