Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I optimize the performance of a QGraphicsView-based app?
    text
    copied!<p>I have an app which is based on the Qt Graphics View framework.<br> It's a jigsaw puzzle game which basically cuts a pixmap into smaller pixmaps (puzzle pieces) and displays them as <code>QGraphicsItem</code>s in a <code>QGraphicsView</code>. I want this app to run on smartphones and tablets. <em>(It already runs on the Nokia N900 and some Symbian phones. Not optimized for Symbian^3 yet.)</em><br> The source is <a href="https://gitorious.org/colorful-apps/puzzle-master" rel="nofollow">on Gitorious</a>.</p> <p>The items inherit <code>QGraphicsItem</code> and <code>QObject</code>, and have <code>Q_PROPERTY</code> macros for the <code>pos()</code> and <code>rotation()</code> of the <code>QGraphicsItem</code> to enable animating them with the Qt Animation framework.<br> I perform transformations on the items, such as scaling and rotating (the latter only in the in-development multitouch branch), and I also use <code>QGraphicsDropShadowEffect</code> on them.</p> <p>I use a <code>QGLWidget</code> as viewport of the <code>QGraphicsView</code> in order to enable OpenGL acceleration for the app.</p> <p>The problem is that despite being OpenGL-accelerated, the app is not smooth at all. (Especially the animations and especially since I added the rotation transform to the multitouch branch.) There are not many graphics items displayed, and there are no 3D operations or anything serious, just 2D drawing.<br> I'm not a graphics expert at all, so I have no idea why this app runs slowly. I've seen other games with lot more complicated effects run a lot smoother than this.</p> <p>What's the secret? How could I optimize this app?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload