fixes #5295
I know it’s a bit of a hack. But it saves a lot of CPU ticks on OSX. You might decide to take this in because it does the job and the QTBUG-15631 seams to be open and untouched since 2010.
fixes #5295
I know it’s a bit of a hack. But it saves a lot of CPU ticks on OSX. You might decide to take this in because it does the job and the QTBUG-15631 seams to be open and untouched since 2010.
fixes #5295
I’m not too happy about more and more platform-specific code, but if this is really required, fine with me.
Please do move the implementation to guiutil, though.
@Diapolo i did search for a qt patch but could nothing found. I also followed the idea of writing a qt patch (root cause fixing) but didn’t succeed.
I just think we owe the user a more or less bug free bitcoin-qt client. This pull does not follow a state of the art architecture but makes the enduser experience better.
I try now to move it to guiutil
and try to follow sipa’s advice with the typedef
approach
typedef
“switch”. But IMO it more unclear then. I would recommend to keep it as it was with the #ifdef
directly while instantiating the object. I think it is better understandable and the code is shorter.
What do you think?
Agree with @sipa; something like
0#include <QProgressBar>
1#ifdef Q_OS_MAC
2#include <QEvent>
3
4// workaround for Qt OSX Bug:
5// https://bugreports.qt-project.org/browse/QTBUG-15631
6// QProgressBar uses around 10% CPU even when app is in background
7class ProgressBar : public QProgressBar
8{
9 bool event(QEvent *e) {
10 return (e->type() != QEvent::StyleAnimationUpdate) ? QProgressBar::event(e) : false;
11 }
12};
13#else
14typedef QProgressBar ProgressBar;
15#endif
Then in the code you can just do
0progressBar = new GUIUtil::ProgressBar();
…would contain the platform specific code this to just guiutil.h. We just define our own progress bar class which happens to be different on a certain OS.
Making all in src CXX libbitcoin_util_a-clientversion.o AR libbitcoin_util.a CXX qt/qt_libbitcoinqt_a-bitcoingui.o In file included from qt/bitcoingui.cpp:10: ./qt/guiutil.h:199:42: error: no member named ‘StyleAnimationUpdate’ in ‘QEvent’ return (e->type() != QEvent::StyleAnimationUpdate) ? QProg… ~~~~~~~~^ 1 error generated. make[2]: *** [qt/qt_libbitcoinqt_a-bitcoingui.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all-recursive] Error 1
Got this with current commit a574189e2acdaa03658bfe495740b2d722984467