Skip to content

Commit

Permalink
qt: Use GUIUtil::ThemedLabel class
Browse files Browse the repository at this point in the history
This change fixes the GUI when changing appearance on macOS.
  • Loading branch information
hebasto committed May 1, 2021
1 parent d99ef32 commit ff530a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 <b>disabled</b>") : hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>"));
labelWalletHDStatusIcon->show();
// eventually disable the QLabel to set its opacity to 50%
Expand All @@ -1285,15 +1285,15 @@ 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 <b>encrypted</b> and currently <b>unlocked</b>"));
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
encryptWalletAction->setEnabled(false);
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 <b>encrypted</b> and currently <b>locked</b>"));
encryptWalletAction->setChecked(true);
changePassphraseAction->setEnabled(true);
Expand Down
5 changes: 3 additions & 2 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <config/bitcoin-config.h>
#endif

#include <qt/guiutil.h>
#include <qt/optionsdialog.h>

#include <amount.h>
Expand Down Expand Up @@ -121,8 +122,8 @@ class BitcoinGUI : public QMainWindow
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;
Expand Down

0 comments on commit ff530a2

Please sign in to comment.