mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 13:43:43 +01:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user