Help using Graphics Scene "rubber-band" selection...
I have a Scene that I can export as an SVG file fairly happily... but a feature I would like to include is to rubber-band select a region and export that - and the export is clipped to that region. Is there a way to achieve this?
The issues I am concerned about are:
- will items that are only partially within the region be selected at all;
- how can I clip such partial items to the region boundary?
how do you create your SVG file? Something like this?
QPainter painter( &svg );
scene->render( &painter );
If so you can create a QRubberBand object on the viewport and on mouse release you can "map":http://qt-project.org/doc/qt-4.8/qgraphicsview.html#mapToScene the rect of the QRubberBand to the scene rect.
scene->render(&painter, QRectF(), mappedArea );
Yes that is how I'm rendering, essentially.
The map option looks interesting... I'll have a go. Thanks