Skip to content

Commit 253e500

Browse files
committed
GUI/Intro: Use QFontMetrics::horizontalAdvance in Qt 5.11+ rather than deprecated QFontMetrics::width
1 parent c204771 commit 253e500

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/qt/intro.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ Intro::Intro(QWidget *parent, int64_t blockchain_size_gb, int64_t chain_state_si
188188
}
189189
{
190190
// TODO: Ideally, we would include actual margins here (instead of extra digits), but this seems non-trivial
191+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
192+
const int text_width = ui->assumevalidBlock->fontMetrics().horizontalAdvance(QStringLiteral("4")) * (64 + 4);
193+
#else
191194
const int text_width = ui->assumevalidBlock->fontMetrics().width(QStringLiteral("4")) * (64 + 4);
195+
#endif
192196
ui->assumevalidBlock->setFixedWidth(text_width);
193197
}
194198

0 commit comments

Comments
 (0)