Skip to content

Commit c231254

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

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);
@@ -243,6 +243,20 @@ void TransactionView::setModel(WalletModel *_model)
243243
}
244244
}
245245

246+
void TransactionView::changeEvent(QEvent* e)
247+
{
248+
#ifdef Q_OS_MACOS
249+
if (e->type() == QEvent::PaletteChange) {
250+
watchOnlyWidget->setItemIcon(
251+
TransactionFilterProxy::WatchOnlyFilter_Yes,
252+
m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_plus")));
253+
watchOnlyWidget->setItemIcon(
254+
TransactionFilterProxy::WatchOnlyFilter_No,
255+
m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_minus")));
256+
}
257+
#endif
258+
}
259+
246260
void TransactionView::chooseDate(int idx)
247261
{
248262
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)