[PyQt] Strange error when using QGraphicsPixmapItem in a

V. Armando Sole sole at esrf.fr
Mon Mar 12 13:39:01 GMT 2007


Hello,

I get a strange error when using QGraphicsView in the way shown below.

The error is:

QObject::startTimer: QTimer can only be used with threads started with QThread

What it leaves me perplex is that the error does not appear if the 
getPixmap function is not defined.
As you may notice, the function is not used at all!

This happens with the most recent sip and PyQt4 snapshots as well as with 
the december snapshots.
It happens on Qt 4.2.2. and Qt 4.2.3, under linux (tested on 4.2.2) and 
under windows (tested with both).

When building PyQt4 for Qt 4.2.3 on windows with mingw, I had to add myself 
to the path the libqpydesigner.a library found under 
C:\Qt\4.2.3\PyQt-win-gpl-4-snapshot-20070310\qpy\QtDesigner\release. If 
not, PyQt4 was not able to finish the build.

Greetings,

Armando
Code follows:

import sys
import PyQt4.Qt as qt

if 1:				#if changed to if 0: the error disappears
     def getPixmap():
         mypixmap = None
         return mypixmap

app   = qt.QApplication([])
qt.QObject.connect(app, qt.SIGNAL("lastWindowClosed()"),
                     app,qt.SLOT("quit()"))
widget = qt.QWidget()
l = qt.QVBoxLayout(widget)
scene = qt.QGraphicsScene()
pixmap = qt.QPixmap()
pixmapItem = qt.QGraphicsPixmapItem(pixmap, None, scene)
view  = qt.QGraphicsView(scene, widget)
l.addWidget(view)
widget.resize(300, 600)
widget.show()
sys.exit(app.exec_())




More information about the PyQt mailing list