Hi,
I have an application that I give a custom look with stylesheets. However the performance was really bad, and it turned out to be the use of stylesheets that caused the problems. When removing the stylesheets the performance was much better. So far the UI is really simple, just four stacked widgets and a few frames and buttons. The stylesheets are also very simple.
Example:
In each stacked widget I have one of these frames.
inner_frame1->setGeometry(10, 10, 1242, 625);
inner_frame1->setStyleSheet(tr("QFrame { border: 2px solid white; border-radius: 20px; } "));
inner_frame2->setGeometry(10, 10, 242, 125);
inner_frame2->setStyleSheet(tr("QFrame { border: 2px solid white; border-radius: 20px; } "));
inner_frame3->setGeometry(10, 10, 1242, 625);
QFrame inner_frame1 = new QFrame(this);
inner_frame1->setGeometry(10, 10, 1242, 625);
inner_frame1->setStyleSheet(tr("QFrame { border: 2px solid white; border-radius: 20px; } "));
QFrame inner_frame2 = new QFrame(this);
inner_frame2->setGeometry(10, 10, 242, 125);
inner_frame2->setStyleSheet(tr("QFrame { border: 2px solid white; border-radius: 20px; } "));
QFrame inner_frame3 = new QFrame(this);
inner_frame3->setGeometry(10, 10, 1242, 625);
To copy to clipboard, switch view to plain text mode
Changing to the widget with inner_frame1 is much slower than changing to the other two. The combination of a StyleSheet and a bigger area affect performance. I have tried other types of widgets, such as QLabel, with the same result.
Does anyone know:
Is this a known problem and are there any ways to avoid it?
Does the use of stylesheets require much more resources? The performance problems are mainly seen when I run on a computer on module which has a little limited resources.
Thanks,
Fredrik
Bookmarks