From ff530a2093c294a1093e1b00fb66ab0a98851c04 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 7 Apr 2021 20:30:18 +0300 Subject: qt: Use GUIUtil::ThemedLabel class This change fixes the GUI when changing appearance on macOS. --- src/qt/bitcoingui.cpp | 10 +++++----- src/qt/bitcoingui.h | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/qt') diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 48fc09bfdf..5c3f16aab0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -150,8 +150,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setSpacing(3); unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle); - labelWalletEncryptionIcon = new QLabel(); - labelWalletHDStatusIcon = new QLabel(); + labelWalletEncryptionIcon = new GUIUtil::ThemedLabel(platformStyle); + labelWalletHDStatusIcon = new GUIUtil::ThemedLabel(platformStyle); labelProxyIcon = new GUIUtil::ClickableLabel(); connectionsControl = new GUIUtil::ClickableLabel(); labelBlocksIcon = new GUIUtil::ClickableLabel(); @@ -1266,7 +1266,7 @@ bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) void BitcoinGUI::setHDStatus(bool privkeyDisabled, int hdEnabled) { - labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(privkeyDisabled ? ":/icons/eye" : hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelWalletHDStatusIcon->setThemedPixmap(privkeyDisabled ? QStringLiteral(":/icons/eye") : hdEnabled ? QStringLiteral(":/icons/hd_enabled") : QStringLiteral(":/icons/hd_disabled"), STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE); labelWalletHDStatusIcon->setToolTip(privkeyDisabled ? tr("Private key disabled") : hdEnabled ? tr("HD key generation is enabled") : tr("HD key generation is disabled")); labelWalletHDStatusIcon->show(); // eventually disable the QLabel to set its opacity to 50% @@ -1285,7 +1285,7 @@ void BitcoinGUI::setEncryptionStatus(int status) break; case WalletModel::Unlocked: labelWalletEncryptionIcon->show(); - labelWalletEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelWalletEncryptionIcon->setThemedPixmap(QStringLiteral(":/icons/lock_open"), STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE); labelWalletEncryptionIcon->setToolTip(tr("Wallet is encrypted and currently unlocked")); encryptWalletAction->setChecked(true); changePassphraseAction->setEnabled(true); @@ -1293,7 +1293,7 @@ void BitcoinGUI::setEncryptionStatus(int status) break; case WalletModel::Locked: labelWalletEncryptionIcon->show(); - labelWalletEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelWalletEncryptionIcon->setThemedPixmap(QStringLiteral(":/icons/lock_closed"), STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE); labelWalletEncryptionIcon->setToolTip(tr("Wallet is encrypted and currently locked")); encryptWalletAction->setChecked(true); changePassphraseAction->setEnabled(true); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 147f19e68d..d1cfa547bd 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -9,6 +9,7 @@ #include #endif +#include #include #include @@ -121,8 +122,8 @@ private: WalletFrame* walletFrame = nullptr; UnitDisplayStatusBarControl* unitDisplayControl = nullptr; - QLabel* labelWalletEncryptionIcon = nullptr; - QLabel* labelWalletHDStatusIcon = nullptr; + GUIUtil::ThemedLabel* labelWalletEncryptionIcon = nullptr; + GUIUtil::ThemedLabel* labelWalletHDStatusIcon = nullptr; GUIUtil::ClickableLabel* labelProxyIcon = nullptr; GUIUtil::ClickableLabel* connectionsControl = nullptr; GUIUtil::ClickableLabel* labelBlocksIcon = nullptr; -- cgit v1.2.3