PDA

View Full Version : Performace problem with style sheets



Cruz
7th February 2009, 13:20
I have 100 widgets stacked into a parent, all of them are styled by a central style sheet. (QApplication::setStyleSheet()). Now when I click on the parent and it gains focus there is a very disturbing visual effect. A wave goes through all the children widgets one by one and first they seem to lose their margin (defined by the style sheet) and then all of a sudden they regain it. The gui is also blocked during this time, it takes several seconds.

If I take the style sheet away there is no performance issues. I also traced the calls made to the custom layout I use and I can see that the first calls occur only after the style sheet waves are done. Also it happens only on mouse button release. When I click on the parent and keep the mouse pressed, nothing bad happens and then I can see that the layout is calculated 4 times. When I release the button, I get first the style sheet wave and then the 4 layout calculations.

The problem is not directly connected to the large number of widgets. I can see the effect even if I have only 5 children, it's just not as bothersome because the gui doesn't block. There is still always a flicker though after every click.

Any ideas?