Skip to content

Commit 97a6b5e

Browse files
committed
qt: Make OverviewPage aware of runtime palette change
This change fixes the GUI when changing appearance on macOS.
1 parent d05f1b2 commit 97a6b5e

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/qt/overviewpage.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class TxViewDelegate : public QAbstractItemDelegate
7878
{
7979
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
8080
QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
81+
iconWatchonly = platformStyle->TextColorIcon(iconWatchonly);
8182
iconWatchonly.paint(painter, watchonlyRect);
8283
address_rect_min_width += 5 + watchonlyRect.width();
8384
}
@@ -143,14 +144,15 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
143144
ui(new Ui::OverviewPage),
144145
clientModel(nullptr),
145146
walletModel(nullptr),
147+
m_platform_style{platformStyle},
146148
txdelegate(new TxViewDelegate(platformStyle, this))
147149
{
148150
ui->setupUi(this);
149151

150152
m_balances.balance = -1;
151153

152154
// use a SingleColorIcon for the "out of sync warning" icon
153-
QIcon icon = platformStyle->SingleColorIcon(":/icons/warning");
155+
QIcon icon = m_platform_style->SingleColorIcon(QStringLiteral(":/icons/warning"));
154156
ui->labelTransactionsStatus->setIcon(icon);
155157
ui->labelWalletStatus->setIcon(icon);
156158

@@ -298,6 +300,17 @@ void OverviewPage::setWalletModel(WalletModel *model)
298300
updateDisplayUnit();
299301
}
300302

303+
void OverviewPage::changeEvent(QEvent* e)
304+
{
305+
#ifdef Q_OS_MACOS
306+
if (e->type() == QEvent::PaletteChange) {
307+
QIcon icon = m_platform_style->SingleColorIcon(QStringLiteral(":/icons/warning"));
308+
ui->labelTransactionsStatus->setIcon(icon);
309+
ui->labelWalletStatus->setIcon(icon);
310+
}
311+
#endif
312+
}
313+
301314
void OverviewPage::updateDisplayUnit()
302315
{
303316
if(walletModel && walletModel->getOptionsModel())

src/qt/overviewpage.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,18 @@ public Q_SLOTS:
4545
void transactionClicked(const QModelIndex &index);
4646
void outOfSyncWarningClicked();
4747

48+
protected:
49+
void changeEvent(QEvent* e) override;
50+
4851
private:
4952
Ui::OverviewPage *ui;
5053
ClientModel *clientModel;
5154
WalletModel *walletModel;
5255
interfaces::WalletBalances m_balances;
5356
bool m_privacy{false};
5457

58+
const PlatformStyle* m_platform_style;
59+
5560
TxViewDelegate *txdelegate;
5661
std::unique_ptr<TransactionFilterProxy> filter;
5762

0 commit comments

Comments
 (0)