0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

qt: Make RPCConsole aware of runtime palette change

This change fixes the GUI when changing appearance on macOS.
This commit is contained in:
Hennadii Stepanov 2021-04-08 12:17:05 +03:00
parent f1083826e3
commit fa18d28e12
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 20 additions and 0 deletions

View file

@ -817,6 +817,25 @@ void RPCConsole::keyPressEvent(QKeyEvent *event)
}
}
void RPCConsole::changeEvent(QEvent* e)
{
#ifdef Q_OS_MACOS
if (e->type() == QEvent::PaletteChange) {
ui->clearButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/remove")));
ui->fontBiggerButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/fontbigger")));
ui->fontSmallerButton->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/fontsmaller")));
ui->promptIcon->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/prompticon")));
for (int i = 0; ICON_MAPPING[i].url; ++i) {
ui->messagesWidget->document()->addResource(
QTextDocument::ImageResource,
QUrl(ICON_MAPPING[i].url),
platformStyle->SingleColorImage(ICON_MAPPING[i].source).scaled(QSize(consoleFontSize * 2, consoleFontSize * 2), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
}
#endif
}
void RPCConsole::message(int category, const QString &message, bool html)
{
QTime time = QTime::currentTime();

View file

@ -74,6 +74,7 @@ public:
protected:
virtual bool eventFilter(QObject* obj, QEvent *event) override;
void keyPressEvent(QKeyEvent *) override;
void changeEvent(QEvent* e) override;
private Q_SLOTS:
void on_lineEdit_returnPressed();