mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-26 17:51:16 +02:00
qt: Make OverviewPage aware of runtime palette change
This change fixes the GUI when changing appearance on macOS.
This commit is contained in:
@@ -78,6 +78,7 @@ public:
|
|||||||
{
|
{
|
||||||
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
|
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
|
||||||
QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
|
QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
|
||||||
|
iconWatchonly = platformStyle->TextColorIcon(iconWatchonly);
|
||||||
iconWatchonly.paint(painter, watchonlyRect);
|
iconWatchonly.paint(painter, watchonlyRect);
|
||||||
address_rect_min_width += 5 + watchonlyRect.width();
|
address_rect_min_width += 5 + watchonlyRect.width();
|
||||||
}
|
}
|
||||||
@@ -143,6 +144,7 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
|
|||||||
ui(new Ui::OverviewPage),
|
ui(new Ui::OverviewPage),
|
||||||
clientModel(nullptr),
|
clientModel(nullptr),
|
||||||
walletModel(nullptr),
|
walletModel(nullptr),
|
||||||
|
m_platform_style{platformStyle},
|
||||||
txdelegate(new TxViewDelegate(platformStyle, this))
|
txdelegate(new TxViewDelegate(platformStyle, this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@@ -150,7 +152,7 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
|
|||||||
m_balances.balance = -1;
|
m_balances.balance = -1;
|
||||||
|
|
||||||
// use a SingleColorIcon for the "out of sync warning" icon
|
// use a SingleColorIcon for the "out of sync warning" icon
|
||||||
QIcon icon = platformStyle->SingleColorIcon(":/icons/warning");
|
QIcon icon = m_platform_style->SingleColorIcon(QStringLiteral(":/icons/warning"));
|
||||||
ui->labelTransactionsStatus->setIcon(icon);
|
ui->labelTransactionsStatus->setIcon(icon);
|
||||||
ui->labelWalletStatus->setIcon(icon);
|
ui->labelWalletStatus->setIcon(icon);
|
||||||
|
|
||||||
@@ -298,6 +300,17 @@ void OverviewPage::setWalletModel(WalletModel *model)
|
|||||||
updateDisplayUnit();
|
updateDisplayUnit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverviewPage::changeEvent(QEvent* e)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
if (e->type() == QEvent::PaletteChange) {
|
||||||
|
QIcon icon = m_platform_style->SingleColorIcon(QStringLiteral(":/icons/warning"));
|
||||||
|
ui->labelTransactionsStatus->setIcon(icon);
|
||||||
|
ui->labelWalletStatus->setIcon(icon);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void OverviewPage::updateDisplayUnit()
|
void OverviewPage::updateDisplayUnit()
|
||||||
{
|
{
|
||||||
if(walletModel && walletModel->getOptionsModel())
|
if(walletModel && walletModel->getOptionsModel())
|
||||||
|
@@ -45,6 +45,9 @@ Q_SIGNALS:
|
|||||||
void transactionClicked(const QModelIndex &index);
|
void transactionClicked(const QModelIndex &index);
|
||||||
void outOfSyncWarningClicked();
|
void outOfSyncWarningClicked();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void changeEvent(QEvent* e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::OverviewPage *ui;
|
Ui::OverviewPage *ui;
|
||||||
ClientModel *clientModel;
|
ClientModel *clientModel;
|
||||||
@@ -52,6 +55,8 @@ private:
|
|||||||
interfaces::WalletBalances m_balances;
|
interfaces::WalletBalances m_balances;
|
||||||
bool m_privacy{false};
|
bool m_privacy{false};
|
||||||
|
|
||||||
|
const PlatformStyle* m_platform_style;
|
||||||
|
|
||||||
TxViewDelegate *txdelegate;
|
TxViewDelegate *txdelegate;
|
||||||
std::unique_ptr<TransactionFilterProxy> filter;
|
std::unique_ptr<TransactionFilterProxy> filter;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user