diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-04-08 12:17:05 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-05-01 15:07:09 +0300 |
commit | fa18d28e1242c2948814df1082ee12c2fecf5403 (patch) | |
tree | d3237dff4ea4ef025116ef6bcaebd34d2b1c45ac /src/qt | |
parent | f1083826e3e68803da86af6efba21c4080769b5c (diff) | |
download | bitcoin-fa18d28e1242c2948814df1082ee12c2fecf5403.tar.xz |
qt: Make RPCConsole aware of runtime palette change
This change fixes the GUI when changing appearance on macOS.
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/rpcconsole.cpp | 19 | ||||
-rw-r--r-- | src/qt/rpcconsole.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 006f60e7a1..d5fc4b995c 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -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(); diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 5182d60a0d..7ef8b6b0f1 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -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(); |