
QGraphicsPixmapItem.mouseReleaseEvent(self, event)Ĭlass LoadPicture(QWidget, Ui_GraphicsArea): QGraphicsPixmapItem.mouseMoveEvent(self, event) QGraphicsPixmapItem.mousePressEvent(self, event) QGraphicsPixmapItem.hoverLeaveEvent(self, event) QGraphicsPixmapItem.hoverMoveEvent(self, event) QGraphicsPixmapItem._init_(self, *args, **kwargs)Ĭolor = QColor(self.pixmap().toImage().pixel(point.x(), point.y())) MousePixmapSignal = pyqtSignal(QPoint, QColor)ĭef _init_(self, log, *args, **kwargs): ("Successfully Loaded: ".format(color.blue()))

PicturePath = QStandardPaths.standardLocations(QStandardPaths.PicturesLocation)įilenames, _ = QFileDialog.getOpenFileNames(self, "Open File", PicturePath, "JPEG File (*.png)", options=options) Options |= QFileDialog.DontUseNativeDialog NormalCursor = QAction(QIcon("icons/cursor-normal.png"), "NormalCursor", self)ĬrosshairCursor = QAction(QIcon("icons/crosshair.png"), "CrosshairCursor", self) Save = QAction(QIcon("icons/save.bmp"), "save", self) Open = QAction(QIcon("icons/open.bmp"), "open", self) QMainWindow._init_(self, *args, **kwargs)

I would also like the rectangle to stay there until the user clicks on the picture a second time.Ĭurrent Code class MainWindow(QMainWindow, Ui_MainWindow): I would like to be able to click and drag on a picture that I have loaded into QGraphicsand have it draw a box and then in the status bar output the X and Y coordinates of both points of the rectangle.

I have put some breakpoints in and it doesn't seem to be going into the mouseMoveEvent function, but I am not sure why. I found a few examples that I tried to follow but nothing seems to work and I am not sure why or how to go about fixing it. I'm confused on how to click and draw a rectangle over a picture that the user has loaded in.
