I want to create a GUI where an image that the user selected previously is drawn in the background and the user now has a couple selection rects and a polyline consisting of some points (these are pre-drawn in a somewhat default placement). The user can set one of these active with a exclusive checkbox (the selected is highlighted). The user shall be able to resize and drag these in the typical way (drag when mouse is in the middle of the shape, resize when on a edge and resize proportional when on a corner). Aim is that the user marks certain areas in a face being the eyes (or rather the iris), the brows, the nose, the mouth and the chin.
Here is a mockup (background image is not properly resized to fit the layout size):

This is a QHBoxLayout with a widget and a QGroupbox. The widget currently is a custom widget that basically has three layers (background, inactive, active), all of them being images that are drawn on top of each other in a paintEvent (in combination with mousePress/Move/Release). Currently I can redraw the shapes (except for the polyline, that is not implemented yet), but not resize and drag. I have the feeling though that I'm not doing this in a good way and I'm not sure that I can achieve what I want like this, so my question is: what would be a good way to do this?
I've read that GraphicsView is good for doing stuff like this, but I'm rather unexperienced with Qt. Also, is it better to have the selection shapes to be standalone widgets?
Currently there is also some offset when drawing a rect between the corner of the rect and where my mouse actually is that I can't quite figure out why.
This is the header of the custom widget:
class DrawMap : public QWidget
{
Q_OBJECT
public:
DrawMap(QWidget *parent = 0);
~DrawMap();
void setBackgroundImage(QImage bG);
private:
bool mPressed;
QPoint mInitial;
QPoint mFinal;
QPen pen;
QList<QRect> seletionRects;
QPoint chinContour[5];
QImage *backgroundImage;
QImage *inactiveImage;
QImage *activeImage;
int active;
void drawRectangle();
void drawRectangle(QPainter &painter, QRect *rect);
void drawCircle();
void drawCircle(QPainter &painter, QRect *rect);
void drawChin(QPainter &painter);
void fillInactiveImage();
void fillActiveImage();
protected:
void paintEvent(QPaintEvent *ev);
void mousePressEvent(QMouseEvent *ev);
void mouseReleaseEvent(QMouseEvent *ev);
void mouseMoveEvent(QMouseEvent *ev);
public slots:
void changeActive(int id);
};
If there is some good resource for this kind of stuff that would be nice too, I couldn't find anything fitting.