Karl schrieb:
Hi!
Approx. 2 years ago, me and some collegues created a program in
university using Python and Qt 2. It worked then, now I want to try to
port it to Qt 3 and then finish/improve it.
I found some very strange behaviour and would ask, whether anyone knows
what is wrong?
Problem description:
I have a Canvas, on this Canvas, I put some Items.
To do this, I created a class that is called "ClassItem" (the program is
a case tool, ClassItem represents a class) that inherits
QCanvasRectangle and a Class called Item that has some logical stuff
about my items.
This is a short excerpt from the constructor of ClassItem:
>class ClassItem (QCanvasRectangle, Item):
> def __init__(self, guiManager, clsId):
> Item.__init__(self, guiManager, CLASSTYPE, clsId, 1)
> QCanvasRectangle.__init__(self, self.canvas)
Now, when I create my ClassItems, they should be added to the Canvas
just when the constructor calls QCanvasRectangle.__init__(...), right?
But somehow, not all these Items are added to the canvas as *ClassItem*,
but e.g. as QCanvasPolygon.
Excerpt from my debug output:
>.adding class
>..class created: <ClassItem.ClassItem object at 0x00912FC0>
>..items now on Canvas: [<ClassItem.ClassItem object at 0x00912FC0>]
>.adding class
>..class created: <ClassItem.ClassItem object at 0x00917030>
>..items now on Canvas: [<ClassItem.ClassItem object at 0x00917030>,
<ClassItem.ClassItem object at 0x00912FC0>]
>.adding class
>..class created: <ClassItem.ClassItem object at 0x009170C0>
>..items now on Canvas: [<ClassItem.ClassItem object at 0x00917030>,
<__main__.qtcanvas.QCanvasPolygon object at 0x009170F0>,
<ClassItem.ClassItem object at 0x00912FC0>]
As you can see, the third ClassItem is in fact created as ClassItem, but
it is added to the Canvas as QCanvasPolygon.
I don't see any difference between these items and don't understand, why
the program behaves this way...
In the following, the QCanvas.collisions()-method results this
QCanvasPolygon, on which I cannot call the methods, that are specific
for ClassItem, therefore, there is no difference for me, if this
ClassItem is present or not, I cannot work with it...
Can anyone help, please?
Tnx in advance
Karl
That kind problem appeared in very early snapshots of sip4 (pre-rc2 or
so, I think, maybe you just have to update your versions of sip & PyQt?
greetings
Torsten
--
Torsten Marek <[EMAIL PROTECTED]>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146 894C 7CC5 451E A244 C858
www.keyserver.net -- wwwkeys.eu.pgp.net
signature.asc
Description: PGP signature
signature.asc
Description: OpenPGP digital signature