cherry-pick:

[Qt, OSX] QProgressBar CPU-Issue workaround
6093aa1bb0
0ceab00d16
[Qt, OSX] fix Qt4.8 compatibility with QProgressBar issue
c5a2282855
This commit is contained in:
UdjinM6 2015-02-10 16:45:37 +03:00
parent f9e80690b9
commit 4e94fe1d52
2 changed files with 17 additions and 1 deletions

View File

@ -170,7 +170,7 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, 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);

View File

@ -5,9 +5,11 @@
#ifndef GUIUTIL_H
#define GUIUTIL_H
#include <QEvent>
#include <QHeaderView>
#include <QMessageBox>
#include <QObject>
#include <QProgressBar>
#include <QString>
#include <QTableView>
@ -177,6 +179,20 @@ namespace GUIUtil
/* Convert OS specific boost path to QString through UTF-8 */
QString boostPathToQString(const boost::filesystem::path &path);
#if defined(Q_OS_MAC) && QT_VERSION >= 0x050000
// 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 // GUIUTIL_H