diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-02-21 20:30:01 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-02-21 21:01:03 +0200 |
commit | 22e0114d055b0ac6cdc47af2968b5dc742ba055a (patch) | |
tree | 7f168a5ac29b2e97b7c468af144cdba8487067eb /src/qt/overviewpage.cpp | |
parent | 623de12d040af89ff7c25de6eb0a19c67179dc5f (diff) | |
download | bitcoin-22e0114d055b0ac6cdc47af2968b5dc742ba055a.tar.xz |
qt: Choose monospaced font in C++ code rather in `*.ui` file
Setting the "Monospace" font family in a `*.ui` file does not work on
macOS, at least on Big Sur with Qt 5.15 (neither via the "font" property
nor via the "styleSheet" property). Qt chooses the ".AppleSystemUIFont"
instead of ".AppleSystemUIFontMonospaced".
This change makes macOS choose the correct monospaced font.
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r-- | src/qt/overviewpage.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index bc542a0833..3a8f7af1bf 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -257,6 +257,8 @@ void OverviewPage::setClientModel(ClientModel *model) // Show warning, for example if this is a prerelease version connect(model, &ClientModel::alertsChanged, this, &OverviewPage::updateAlerts); updateAlerts(model->getStatusBarWarnings()); + + setMonospacedFont(false); } } @@ -321,3 +323,17 @@ void OverviewPage::showOutOfSyncWarning(bool fShow) ui->labelWalletStatus->setVisible(fShow); ui->labelTransactionsStatus->setVisible(fShow); } + +void OverviewPage::setMonospacedFont(bool use_embedded_font) +{ + QFont f = GUIUtil::fixedPitchFont(use_embedded_font); + f.setWeight(QFont::Bold); + ui->labelBalance->setFont(f); + ui->labelUnconfirmed->setFont(f); + ui->labelImmature->setFont(f); + ui->labelTotal->setFont(f); + ui->labelWatchAvailable->setFont(f); + ui->labelWatchPending->setFont(f); + ui->labelWatchImmature->setFont(f); + ui->labelWatchTotal->setFont(f); +} |