PDA

View Full Version : How to place a QGraphicsPixmapItem in Pyqt mainwindow?



sai subramani
9th January 2020, 10:33
Hi i am trying to place a QGraphicsPixmapItem to a Position of x y in a GraphicsScene. I had used this command

"self.item.setPos(QtCore.QPointF(20,50))" its not working.


is there any way to move the QGraphics Item as Qlabel support label.move(x,y)

d_stranz
9th January 2020, 18:32
"self.item.setPos(QtCore.QPointF(20,50))" its not working

And what isn't working? It is in the wrong position? It doesn't appear at all? What are the dimensions of your QGraphicsScene? Of your QGraphicsView? Is the QGraphicsPixmapItem a top-level item in the scene, or is it a child of another QGraphicsItem?

ChrisW67
11th January 2020, 01:10
is there any way to move the QGraphics Item as Qlabel support label.move(x,y)
Yes. QGraphicsItem::setPos() (https://doc.qt.io/qt-5/qgraphicsitem.html#setPos)