Important: Please read the Qt Code of Conduct -

Move rectangle by mouse dragging

  • Hi,
    I would like to draw a rectangle on my jpg image and move the rectangle by mouse dragging
    . I could load my jpg image file on QLabel object by painter.drawImage(QPoint(0, 0), myJpegImage); in paintEvent(). I also could draw Rect using painter->drawRect(myRect). But I don't know how to move my rect by mouse dragging. Any suggestions?

  • QGraphicsView/QGraphicsScene might be what you are looking for.

Log in to reply