[PyQt] Syntax for connecting to QGraphicsScene.changed signal?
phil at riverbankcomputing.com
Fri Oct 15 09:12:17 BST 2010
On Thu, 14 Oct 2010 15:37:02 -0700, TP <wingusr at gmail.com> wrote:
> QGraphicsScene's changed signal is documented as:
> void changed (const QList<QRectF>&)
> The "Qt Utility classes and their Python equivalents" section of
> "Chapter 10 Qt Class Hierarchy" of GUI Programming with Python: QT
> Edition (from http://www.commandprompt.com/community/pyqt/x3738) says:
> "You can always use a Python list wherever a QList is needed".
That book si for PyQt3.
> But defining a signal as:
> sceneChanged = QtCore.pyqtSignal(list)
> and then doing:
> results in the following exception:
> "TypeError: connect() failed between changed(QList<QRectF>) and
> As a workaround, I was able to do the following:
> def changed (self, rects):
> With the following connect() statement:
> But how can I directly connect my signal to QGraphicScene's changed
> signal without going through an intermediate python method?
Use the C++ type as a string...
sceneChanged = QtCore.pyqtSignal('QList<QRectF>')
More information about the PyQt