Adding a QProgressbar makes my app cpu consumption pass from 0% to 75-80% of a core
-
Maybe you just update it too frequently? Some code would be useful.
-
@int main(int argc, char *argv[])
{
QApplication a(argc, argv);
pruebasqt w;QGraphicsDropShadowEffect* wndShadow = new QGraphicsDropShadowEffect;
wndShadow->setBlurRadius(9.0);
wndShadow->setColor(QColor(0, 0, 0, 90));
wndShadow->setOffset(5);
w.setGraphicsEffect(wndShadow);w.setWindowFlags( Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
w.setAttribute(Qt::WA_TranslucentBackground);w.setStyleSheet("QWidget{ background: red;}");
w.show();
return a.exec();
}
@Being "pruebasqt" a default QMainWindow with one QProgressBar. This makes 100% of one core in my computer (An Intel Xeon with 8 cores and 26 Gb RAM)
-
Hi,
Does it still happen if you upgrade to Qt 4.8.5?
What happens if you delete lines 6 to 15?
What happens if you don't add the QProgressBar?
What are the related bugs that you've found?
-
https://bugreports.qt-project.org/browse/QTBUG-20880
The problem appears when combining the setGraphicsEffect with a QProgressBar. Can you reproduce this?
-
Full compilable version:
@
#include <QtGui/QApplication>
#include <QGraphicsDropShadowEffect>
#include <QProgressbar>int main(int argc, char *argv[])
{
QApplication a(argc, argv);QWidget* w = new QWidget();
w->setGeometry(40,40,1600,1000);
QProgressBar* qp = new QProgressBar(w);
qp->setValue(99);QGraphicsDropShadowEffect* wndShadow = new QGraphicsDropShadowEffect;
w->setGraphicsEffect(wndShadow);w->show();
return a.exec();
}
@