Important: Please read the Qt Code of Conduct -

Adding a QProgressbar makes my app cpu consumption pass from 0% to 75-80% of a core

  • Hi,

    I'm adding a small QProgressbar to my app, but now I'm realizing that it is taking almost a core. I've read about some bugs related but I cant fix or workaround this issue. Any chances?

    -QT 4.8.4
    -Windows 7

  • Moderators

    Maybe you just update it too frequently? Some code would be useful.

  • I never update it, it is only a default QProgressBar added with the QT Designer.

  • @int main(int argc, char *argv[])
    QApplication a(argc, argv);
    pruebasqt w;

    QGraphicsDropShadowEffect* wndShadow = new QGraphicsDropShadowEffect;
    wndShadow->setColor(QColor(0, 0, 0, 90));

    w.setWindowFlags( Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);

    w.setStyleSheet("QWidget{ background: red;}");;
    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)

  • Can anyone reproduce this behaviour? I think this could be a bug.

  • Moderators


    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?


    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();
    QProgressBar* qp = new QProgressBar(w);

    QGraphicsDropShadowEffect* wndShadow = new QGraphicsDropShadowEffect;

    return a.exec();

Log in to reply