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->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)



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


  • Moderators

    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();
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.