Skip to content

Commit a10cae6

Browse files
committed
GUI: Make Peers table aware of runtime palette change
This change fixes the GUI when changing appearance on macOS.
1 parent bc2ffa1 commit a10cae6

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/qt/peertablemodel.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ void PeerTableModel::DrawIcons()
136136
m_icon_conn_out = m_platform_style.TextColorIcon(QIcon(QPixmap::fromImage(icon_out)));
137137
}
138138

139+
void PeerTableModel::updatePalette()
140+
{
141+
m_icon_conn_in = m_platform_style.TextColorIcon(m_icon_conn_in);
142+
m_icon_conn_out = m_platform_style.TextColorIcon(m_icon_conn_out);
143+
if (m_peers_data.empty()) return;
144+
Q_EMIT dataChanged(
145+
createIndex(0, Direction),
146+
createIndex(m_peers_data.size() - 1, Direction),
147+
QVector<int>{Qt::DecorationRole}
148+
);
149+
}
150+
139151
void PeerTableModel::startAutoRefresh()
140152
{
141153
timer->start();

src/qt/peertablemodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class PeerTableModel : public QAbstractTableModel
7676

7777
public Q_SLOTS:
7878
void refresh();
79+
void updatePalette();
7980

8081
Q_SIGNALS:
8182
void changed();

src/qt/rpcconsole.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,8 @@ void RPCConsole::changeEvent(QEvent* e)
896896
QUrl(ICON_MAPPING[i].url),
897897
platformStyle->SingleColorImage(ICON_MAPPING[i].source).scaled(QSize(consoleFontSize * 2, consoleFontSize * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
898898
}
899+
900+
ui->peerWidget->updatePalette();
899901
}
900902
#endif
901903
}

0 commit comments

Comments
 (0)