qt: Use GUIUtil::ThemedLabel class

This change fixes the GUI when changing appearance on macOS.
This commit is contained in:
Hennadii Stepanov committed 2021-05-01 15:07:10 +03:00
1 parent d99ef327a8
commit ff530a2093
2 files changed
+8 -7

No files matched your search

+5 -5
View File
@@ -150,8 +150,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setContentsMargins(3,0,3,0);
frameBlocksLayout->setSpacing(3); frameBlocksLayout->setSpacing(3);
unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle); unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle);
labelWalletEncryptionIcon = new QLabel(); labelWalletEncryptionIcon = new GUIUtil::ThemedLabel(platformStyle);
labelWalletHDStatusIcon = new QLabel(); labelWalletHDStatusIcon = new GUIUtil::ThemedLabel(platformStyle);
labelProxyIcon = new GUIUtil::ClickableLabel(); labelProxyIcon = new GUIUtil::ClickableLabel();
connectionsControl = new GUIUtil::ClickableLabel(); connectionsControl = new GUIUtil::ClickableLabel();
labelBlocksIcon = new GUIUtil::ClickableLabel(); labelBlocksIcon = new GUIUtil::ClickableLabel();
@@ -1266,7 +1266,7 @@ bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
void BitcoinGUI::setHDStatus(bool privkeyDisabled, int hdEnabled) 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 <b>disabled</b>") : hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>")); labelWalletHDStatusIcon->setToolTip(privkeyDisabled ? tr("Private key <b>disabled</b>") : hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>"));
labelWalletHDStatusIcon->show(); labelWalletHDStatusIcon->show();
// eventually disable the QLabel to set its opacity to 50% // eventually disable the QLabel to set its opacity to 50%
@@ -1285,7 +1285,7 @@ void BitcoinGUI::setEncryptionStatus(int status)
break; break;
case WalletModel::Unlocked: case WalletModel::Unlocked:
labelWalletEncryptionIcon->show(); 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 <b>encrypted</b> and currently <b>unlocked</b>")); labelWalletEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
encryptWalletAction->setChecked(true); encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true); changePassphraseAction->setEnabled(true);
@@ -1293,7 +1293,7 @@ void BitcoinGUI::setEncryptionStatus(int status)
break; break;
case WalletModel::Locked: case WalletModel::Locked:
labelWalletEncryptionIcon->show(); 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 <b>encrypted</b> and currently <b>locked</b>")); labelWalletEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
encryptWalletAction->setChecked(true); encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true); changePassphraseAction->setEnabled(true);
+3 -2
View File
@@ -9,6 +9,7 @@
#include <config/bitcoin-config.h> #include <config/bitcoin-config.h>
#endif #endif
#include <qt/guiutil.h>
#include <qt/optionsdialog.h> #include <qt/optionsdialog.h>
#include <amount.h> #include <amount.h>
@@ -121,8 +122,8 @@ private:
WalletFrame* walletFrame = nullptr; WalletFrame* walletFrame = nullptr;
UnitDisplayStatusBarControl* unitDisplayControl = nullptr; UnitDisplayStatusBarControl* unitDisplayControl = nullptr;
QLabel* labelWalletEncryptionIcon = nullptr; GUIUtil::ThemedLabel* labelWalletEncryptionIcon = nullptr;
QLabel* labelWalletHDStatusIcon = nullptr; GUIUtil::ThemedLabel* labelWalletHDStatusIcon = nullptr;
GUIUtil::ClickableLabel* labelProxyIcon = nullptr; GUIUtil::ClickableLabel* labelProxyIcon = nullptr;
GUIUtil::ClickableLabel* connectionsControl = nullptr; GUIUtil::ClickableLabel* connectionsControl = nullptr;
GUIUtil::ClickableLabel* labelBlocksIcon = nullptr; GUIUtil::ClickableLabel* labelBlocksIcon = nullptr;