diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2014-11-17 15:51:33 +0100 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2014-11-17 15:59:33 +0100 |
commit | 6093aa1bb03b03331cc2f48d8f6b749f8817c016 (patch) | |
tree | 77fd6c9d072756b10419709d9c5b6f6f99afbbb8 /src | |
parent | 09481eec887fde9771db7fcf2cae510cf730bf21 (diff) |
[Qt, OSX] QProgressBar CPU-Issue workaround
fixes #5295
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/bitcoingui.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 450b83a8c6..06e53ea1e6 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -58,6 +58,20 @@ #include <QUrlQuery> #endif +#ifdef Q_OS_MAC +#include <QEvent> + +// workaround for Qt OSX Bug: +// https://bugreports.qt-project.org/browse/QTBUG-15631 +// QProgressBar uses around 10% CPU even when app is in background +class QProgressBarMac : public QProgressBar +{ + bool event(QEvent *e) { + return (e->type() != QEvent::StyleAnimationUpdate) ? QProgressBar::event(e) : false; + } +}; +#endif + const QString BitcoinGUI::DEFAULT_WALLET = "~Default"; BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) : @@ -190,7 +204,11 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) : // Progress bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(false); +#ifdef Q_OS_MAC + progressBar = new QProgressBarMac(); +#else progressBar = new QProgressBar(); +#endif progressBar->setAlignment(Qt::AlignCenter); progressBar->setVisible(false); |