<div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 3, 2013 at 2:15 PM, Clemens Brunner <span dir="ltr"><<a href="mailto:clemens.brunner@tugraz.at" target="_blank">clemens.brunner@tugraz.at</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
I've also posted this question as a bug report at <a href="http://qt-project.org" target="_blank">qt-project.org</a> (<a href="https://bugreports.qt-project.org/browse/PYSIDE-151" target="_blank">https://bugreports.qt-project.org/browse/PYSIDE-151</a>), but this is also a PyQt issue.<br>
<br>
QGraphicsView is apparently very slow under Linux and Mac OS X. I've attached an example program (runs with PySide or PyQt). The signals should be updated every 25ms; the actual timer intervals are displayed on the console. Now under Linux and Mac OS X, the graphics get slower with increasing window size. In full screen, the timer intervals are around 100ms instead of 25ms on my machines.<br>
<br>
This problem does not exist under Windows. Here, the intervals are not affected by window size, and the intervals stay at the given values. Interestingly, the program runs perfectly fast even in a Windows inside a VM.<br>
<br>
Furthermore, this problem is PySide (or PyQt) specific, because this behavior does not occur when I use Qt from C+. In C+, the program works as expected on all three platforms.<br></blockquote><div><br></div><div><div>first of all, QTimer gives you no guarantee that it'll fire exactly after the given amount of time. In particular not with such small timeouts and when having non-trivial paint functions like yours. QTimer is bound to the event loop, hence cannot fire if the loop is being blocked by something. If you simplify the paint function the effect will be much less dramatic.</div>
<div><br></div><div>That being said, here with Qt4.8 even a full-screen window will not cause a significant slowdown, except during the resize phase. Once the resize is done the timer fires every 25 ms again. So I guess the calculation inside the paint function simply take some time and once the widget doesn't resize anymore the paint function is not called anymore. </div>
<div><br></div><div>If you need high precision timers then you'll need to write platform-specific code. QTimer is not meant for that.</div><div><br></div><div style>Why this works better on Windows with Py(Qt/Side) can have many reasons, the whole graphicsstack is different there, the QTimer might be implemented differently there. Maybe windows delays the painting during resize somewhat more so that there are less repaint-events given to Qt or maybe the functions used in your paint() are more optimized on Windows.</div>
<div><br></div><div>Andreas</div></div><div> </div></div></div></div>