qgraphicspixmapitem

Draggable pixmaps inside a QGraphicsScene of graphic items

陌路散爱 提交于 2019-12-11 16:52:20
问题 I have a scene with a 12*4 grid with blocks of QGraphicsItems ,when i right click on the blocks I have a contexmenu that can add icons inside the blocks my proplem is that I can't fingure out how can I make those icons draggable to the other blocks inside the graphic scene ,I know there is the "Draggable Icons Example" but how can I implement that code to a graphic scene. this is the mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QGraphicsPathItem>

Add ports to the QGraphicsPixmapItem object

纵然是瞬间 提交于 2019-12-01 02:13:59
I've created something like this. I have created a QGraphicsPixmapItem object that I can add to QGraphicsView. I want to add ports to these objects I created. And I want to make connections between these ports and the objects I have created. I don't know how to do it. can you help me ? my code class Part(QGraphicsPixmapItem): def __init__(self, name): super().__init__() self.name = name self.setFlags(self.ItemIsSelectable | self.ItemIsMovable | self.ItemIsFocusable) self.label = QLabel("Deneme") self.pixmap = QPixmap("image/" + name + ".png") self.setPixmap(self.pixmap) self.inputs = {} self

Add ports to the QGraphicsPixmapItem object

余生长醉 提交于 2019-11-30 20:28:41
问题 I've created something like this. I have created a QGraphicsPixmapItem object that I can add to QGraphicsView. I want to add ports to these objects I created. And I want to make connections between these ports and the objects I have created. I don't know how to do it. can you help me ? my code class Part(QGraphicsPixmapItem): def __init__(self, name): super().__init__() self.name = name self.setFlags(self.ItemIsSelectable | self.ItemIsMovable | self.ItemIsFocusable) self.label = QLabel(