Browse Source

[Qt, OSX] QProgressBar CPU-Issue workaround

fixes #5295
0.10
Jonas Schnelli 10 years ago
parent
commit
6093aa1bb0
  1. 18
      src/qt/bitcoingui.cpp

18
src/qt/bitcoingui.cpp

@ -58,6 +58,20 @@
#include <QUrlQuery> #include <QUrlQuery>
#endif #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"; const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) : 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 // Progress bar and label for blocks download
progressBarLabel = new QLabel(); progressBarLabel = new QLabel();
progressBarLabel->setVisible(false); progressBarLabel->setVisible(false);
#ifdef Q_OS_MAC
progressBar = new QProgressBarMac();
#else
progressBar = new QProgressBar(); progressBar = new QProgressBar();
#endif
progressBar->setAlignment(Qt::AlignCenter); progressBar->setAlignment(Qt::AlignCenter);
progressBar->setVisible(false); progressBar->setVisible(false);

Loading…
Cancel
Save