Hi, I've also posted this question as a bug report at qt-project.org (https://bugreports.qt-project.org/browse/PYSIDE-151), but this is also a PyQt issue.
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. 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. 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. Thanks, Clemens
import sys from PyQt4 import QtGui, QtCore, QtOpenGL import random import math class SignalItem(QtGui.QGraphicsItem): def __init__(self, nr): super(SignalItem, self).__init__() self.setFlags(QtGui.QGraphicsItem.ItemUsesExtendedStyleOption) self.nr = nr self.fr = random.randint(3, 50) self.bg = QtGui.QColor(random.randint(200,255),random.randint(200,255),random.randint(200,255)) def boundingRect(self): return QtCore.QRectF(0, self.nr*50, 10000, 50) def paint(self, painter, option, widget): painter.fillRect(option.exposedRect, self.bg) self.prevY = math.sin((int(option.exposedRect.left()) - 1)/float(self.fr))*10 + 25 + self.nr*50 for x in range(int(option.exposedRect.left()), int(option.exposedRect.right())): y = math.sin(x/float(self.fr))*10 + 25 + self.nr*50 painter.drawLine(x-1, self.prevY, x, y) self.prevY = y class Dummy(QtCore.QObject): def __init__(self): super(Dummy, self).__init__() self.scene = QtGui.QGraphicsScene() for i in range(40): item = SignalItem(i) self.scene.addItem(item) self.view = QtGui.QGraphicsView(self.scene) self.view.show() self.startTimer(25) self.x = 0 self.lastTimerEvent = None def timerEvent(self,event): self.x += 1 self.view.horizontalScrollBar().setValue(self.x) currentTime = QtCore.QTime.currentTime() if self.lastTimerEvent: print self.lastTimerEvent.msecsTo(currentTime) self.lastTimerEvent = currentTime if __name__ == '__main__': app = QtGui.QApplication(sys.argv) d = Dummy() sys.exit(app.exec_())
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt