Skip to content

Commit

Permalink
chore: Fix QFontMetrics::width deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
pktiuk committed Jul 26, 2022
1 parent 6c5b02b commit 3689171
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gui/flashbuttonwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ void FlashButtonWidget::paintEvent(QPaintEvent *event)
QFontMetrics fm(tempScaledFont);

bool reduce = false;

#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
while ((this->width() < fm.horizontalAdvance(text())) && (tempScaledFont.pointSize() >= 7))
#else
while ((this->width() < fm.width(text())) && (tempScaledFont.pointSize() >= 7))
#endif
{
tempScaledFont.setPointSize(tempScaledFont.pointSize() - 1);
painter.setFont(tempScaledFont);
Expand Down

0 comments on commit 3689171

Please sign in to comment.