Important: Please read the Qt Code of Conduct -

Regarding CPU % shooting up ,while vertical scrollbar handle moving.(Platform : TI am335x Sitara Board)

  • In my Qt 4.8 application for embedded board( TI am335x Sitara Board ,256 MB RAM ), there are 7 static QWidgtes(contains 4 children viz. 1 QPushButton and 3 QLable ) as follows in a vertical Layout along with a vertical scrollbar

    | QPushButton | QLabel | QLabel | QLabel | vertical
    | QPushButton | QLabel | QLabel | QLabel | scrollbar

    Case 1:
    on vertical scrollbar handle moving, i'm changing the text of the pushbutton and QLables of 7 rows. The CPU% shoots up to 97%.

    Case 2:
    If i keep moving vertical scrollbar handle and wil not setText of any of the Row , however the CPU% shoots up to 67%.

    What could be the reason behind it and how to control it.
    Your suggestion will be appreciated.

    • Are they in an scrollarea or do you handle the scrolling manually?
    • Are they pure QPushButton/QLabel or are they subclasses, if so, do you reimplement painting on any of them?
    • How do you connect the scroll bar movement to the text change?

  • @VRonin

    • They are not in the scroll area and i am doing it manually only.
    • They are pure QPushButton/QLabel
    • i'm catching scrollbar actionTrigerred signal and based on that i change the value of the QPushButton/QLabel

  • @Sudo007 said:

    am doing it manually only.

    My money is on this being the bottleneck. Could you try replacing your manual handling with a QScrollArea?

    basically create a QWidget with:
    | QPushButton | QLabel | QLabel | QLabel
    | QPushButton | QLabel | QLabel | QLabel

    then call QScrollArea::setwidget to put in the scroll area.
    you can then use QScrollArea::verticalScrollBar()::valueChanged() signal to handle the text change

Log in to reply