[Qt-interest] Push Button response very very bad...

Andreas Pakulat apaku at gmx.de
Thu Jul 30 13:09:28 CEST 2009


On 30.07.09 03:44:02, Agus Syawal wrote:
> Hello,
> 
> I made an SVG viewer, sized 1280x800. The SVG is loaded into QSvgWidget. Above the QSvgWidget, hovered a row of buttons. Those buttons is collected into QButtonGroup. I connect the signal 'buttonClicked' from the QButtonGroup to my made slots.
> I assign style script for the button for normal/default mode, and state when the button is pressed.
> 
> The case is, when I load a complex SVG (which have big size), the respon of the button is lame. I press the button, there is 1-2sec idle before the button show response that it is pressed.
> I try connect the 'buttonPressed' signal to a separate slot and put debug inside it. The debug statement is printed after that 1-2sec idle time.
> 
> The idle time differ for different SVG. If the SVG is less complex, the button response time is also rapid.
> 
> But this 'idling' make not very good user interface. I need to find out and make the button response rapid.
> 
> Any suggestion to resolve, or at least some explanation why is this happening?

Don't load big SVG's. Loading an SVG takes some time to parse and render
it, this all happens in the GUI thread that is also responsible for
reacting to user events. I see two options:

- disable the buttons while an SVG is being loaded
- try wether you can load and render the SVG to an offscreen QImage in a
  background thread and then copy it to the GUI thread and display it once
  its rendered

Andreas

-- 
Your supervisor is thinking about you.



More information about the Qt-interest-old mailing list