aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-11-19 14:50:51 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-11-19 14:58:39 +0100
commite587ecd8a64e7d56edf00f1761b3dd63a5fdab71 (patch)
tree96dedc2588975fea1244dbb6af70faf7544ef21b /src/qt
parent271061242b0bf2fd0864ffc053f0435eb1dcf992 (diff)
parent0ceab00d16a1d23da06a748889db25662b16bfb3 (diff)
downloadbitcoin-e587ecd8a64e7d56edf00f1761b3dd63a5fdab71.tar.xz
Merge pull request #5296
0ceab00 [Qt, OSX] move QProgressBarMac to guiutil.h (Jonas Schnelli) 6093aa1 [Qt, OSX] QProgressBar CPU-Issue workaround (Jonas Schnelli)
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoingui.cpp2
-rw-r--r--src/qt/guiutil.h17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 450b83a8c6..6a457d361f 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -190,7 +190,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
// Progress bar and label for blocks download
progressBarLabel = new QLabel();
progressBarLabel->setVisible(false);
- progressBar = new QProgressBar();
+ progressBar = new GUIUtil::ProgressBar();
progressBar->setAlignment(Qt::AlignCenter);
progressBar->setVisible(false);
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 5666744bd3..a6ecfbcc82 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -7,9 +7,11 @@
#include "amount.h"
+#include <QEvent>
#include <QHeaderView>
#include <QMessageBox>
#include <QObject>
+#include <QProgressBar>
#include <QString>
#include <QTableView>
@@ -186,6 +188,21 @@ namespace GUIUtil
/* Format a CNodeCombinedStats.dPingTime into a user-readable string or display N/A, if 0*/
QString formatPingTime(double dPingTime);
+
+#ifdef Q_OS_MAC
+ // 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 ProgressBar : public QProgressBar
+ {
+ bool event(QEvent *e) {
+ return (e->type() != QEvent::StyleAnimationUpdate) ? QProgressBar::event(e) : false;
+ }
+ };
+#else
+ typedef QProgressBar ProgressBar;
+#endif
+
} // namespace GUIUtil
#endif // BITCOIN_QT_GUIUTIL_H