[PyQt] Bug with QGraphicsTextItem in pagedesigner.pyw (Mark Summerfield's script)?

Mark Summerfield mark at qtrac.eu
Tue Mar 25 09:15:28 GMT 2008


On 2008-03-23, alteo_gange wrote:
> Hi, all.
>
> Why the Mark Summerfield's script, pyqt/chap12/pagedesigner.pyw which is an
> file example of his book «Rapid Gui Programming With Python and Qt», bugs
> when i try to delete, rotate, copy, or cut any text (in fact
> QGraphicsTextItem)?
>
> example:
> Button «Add Text» >> enter text in the QTextEdit() of QDialog() >> Button
> «Ok»
>
> >> Button «Delete» >> «Delete 1 item?» >> Button «Yes» >> BUG! >>
>
> «QGraphicsScene::removeItem: item 0x85baa90's scene ((nil)) is different
> from this scene (0x8324f10)
> Erreur de segmentation (core dumped)»
>
> other example:
> Button «Add Pixmap» >> select image >> Button «Open» >> Button «Delete» >>
> No Problem
>
> Why there is a bug with texts and not with images?
> Yet texts and images are both provided to QGraphicsScene with respectively
> QGraphicsTextItem and QGraphicsPixmapItem which inherit of QGraphicsItem.
> Moreover, in theory, QGraphicsScene.removeItem(QGraphicsItem * item )
> can «removes the item item and all its children from the scene» (and
> «Delete» Button uses this method).
>
> I don't understand. Have you an idea?

This example works fine for me and I tested it on Linux (Fedora +
Kubuntu), Windows XP, and Mac OS X.

Which versions of PyQt, Qt, and Python are you using? What operating
system are you using? As I mention at the beginning of chapter 12, this
example needs PyQt 4.1 (ideally PyQt 4.2) or later and Qt 4.2 or later.

-- 
Mark Summerfield, Qtrac Ltd., www.qtrac.eu





More information about the PyQt mailing list