Important: Please read the Qt Code of Conduct -

[Solved] Performance QLabel

  • I'm trying to test the performance of the text drawing of Qt.

    In our application we need to update up to 10 values around every 200 ms.
    Therefore I created a test application which consists of 32 Labels aligned in a GridLayout (which is set to the central widget of the main window). They are updated with random values every 200 ms.

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(UpdateLabel()));

    void MainWindow::UpdateLabel()

    Now the CPU loads seem to be quite high, when I draw it with OpenGL, it the CPU 1 load is around 20, the CPU 2 load is around 35.
    When drawing it with the raster engine, the CPU 1 load is around 10, the CPU 2 load is around 45.

    I replaced the QLabels with an own widget which holds a QStaticText (even though it says in the documentation that this should be used when the text and its layout is updated rarely). But the CPU 1 load is around 17 and the CPU 2 load is around 25.

    Now I wanted to know if there is a way of improving the performance of the drawing of the texts?

    If you need some further information or more code please tell me.

  • May be each change of labels text invoke recalculation positions of all other QLabels, because GridLayout adjust cells width.
    Try to set fixed size of QLabel's

  • That improved the performance a lot. Thank you!

Log in to reply