QRubberBand do not adjust the position when view resize
-
When I resize the QGraphicsView, the position of the QRubberBand do not adjust as expected.
This is the origin position of the rubberband
After I resize the QGraphicsView
The position of the rubber do not stay at the same position again, I try to solve this problem by override the resizeEvent of QGraphicsView, but it do not work
void img_region_selector::resizeEvent(QResizeEvent *e) { QGraphicsView::resizeEvent(e); auto const old_size = e->oldSize(); auto const cur_size = e->size(); auto const diff = cur_size - old_size; QPoint const offset(diff.width(), diff.height()); rb->move(rb->pos() + offset); }
The img_region_selector is the child of QGraphicsView.
The source codes are located at github.
Thanks