Skip to content

Commit 5737301

Browse files
committed
qt: Make TransactionView aware of runtime palette change
This change fixes the GUI when changing appearance on macOS.
1 parent cceb6e6 commit 5737301

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/qt/transactionview.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
#include <QUrl>
3838
#include <QVBoxLayout>
3939

40-
TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) :
41-
QWidget(parent)
40+
TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent)
41+
: QWidget(parent), m_platform_style{platformStyle}
4242
{
4343
// Build filter row
4444
setContentsMargins(0,0,0,0);
@@ -264,6 +264,20 @@ void TransactionView::setModel(WalletModel *_model)
264264
}
265265
}
266266

267+
void TransactionView::changeEvent(QEvent* e)
268+
{
269+
#ifdef Q_OS_MACOS
270+
if (e->type() == QEvent::PaletteChange) {
271+
watchOnlyWidget->setItemIcon(
272+
TransactionFilterProxy::WatchOnlyFilter_Yes,
273+
m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_plus")));
274+
watchOnlyWidget->setItemIcon(
275+
TransactionFilterProxy::WatchOnlyFilter_No,
276+
m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_minus")));
277+
}
278+
#endif
279+
}
280+
267281
void TransactionView::chooseDate(int idx)
268282
{
269283
if (!transactionProxyModel) return;

src/qt/transactionview.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class TransactionView : public QWidget
6060
MINIMUM_COLUMN_WIDTH = 23
6161
};
6262

63+
protected:
64+
void changeEvent(QEvent* e) override;
65+
6366
private:
6467
WalletModel *model{nullptr};
6568
TransactionFilterProxy *transactionProxyModel{nullptr};
@@ -85,6 +88,8 @@ class TransactionView : public QWidget
8588

8689
bool eventFilter(QObject *obj, QEvent *event) override;
8790

91+
const PlatformStyle* m_platform_style;
92+
8893
private Q_SLOTS:
8994
void contextualMenu(const QPoint &);
9095
void dateRangeChanged();

0 commit comments

Comments
 (0)