How fast is Qt styling code

7 views
Skip to first unread message

Terry Brown

unread,
Oct 24, 2011, 10:05:53 PM10/24/11
to leo-e...@googlegroups.com
Here's an amusing hack to test the speed of Qt styling code

import re

flippy = re.compile(r"#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})")

sheet = str(c.frame.top.leo_ui.styleSheet())

sheet = re.sub('(?i)white', '#ffffcc', sheet)
sheet = re.sub('(?i)#ffffff', '#ffccff', sheet)

for i in range(10):
sheet = flippy.sub(r'#\3\1\2', sheet)
c.frame.top.leo_ui.setStyleSheet(sheet)

copy it into a node and run it repeatedly. That's how fast Qt can
apply Leo's current stylesheet 10 times.

It cycles RGB to BRG repeatedly, so running it three times, 30 cycles,
brings you back to where you started, except that first it perturbs
white colors slightly, because RGB #ffffff moved to BRG is still
#ffffff.

I see a slight delay doing it 10 times, but of course it only needs to
be done once.

Cheers -Terry

Reply all
Reply to author
Forward
0 new messages