[PyQt] QGraphicsItem absolute position
TheLonelyStar
nabble2 at lonely-star.org
Mon Jul 13 18:29:07 BST 2009
Attila Csipa-3 wrote:
>
> On Monday 13 July 2009 16:41:21 TheLonelyStar wrote:
>> I have a QGraphicsScene to which I add QGraphicsItems using
> ^^^^^
>>
>> newItem=QtGui.QGraphicsEllipseItem(event.scenePos().x()-10,event.scenePos()
>>.y()-10,20,20)
>
> Are you sure you added the item ? You *created* it but from the code you
> can't
> see that it has been actually *added* to the scene, and until you do that,
> the null parent/scene means a pos of (0,0) if I understand correctly.
>
I add it afterwards, yes. And I can also see it, it appears under the mouse.
I do not ask for its position directly, but do:
for i in self.featureSpace.items():
here i.scenePos().x()==0 and i.scenePos().y()==0
I find a lot of objects in that loop, but scenePos()==(0,0) always!
--
View this message in context: http://www.nabble.com/QGraphicsItem-absolute-position-tp24463034p24465955.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt
mailing list