PDA

View Full Version : Question about how to do a mouse selection box



aarelovich
10th July 2010, 12:52
Hi:

I'm working on a program that uses QGraphicsView and QGraphicsItem. One of the things I need to do is zoom in on a certain area of the drawing.

My question is quite simple is there an option I can set that will make the mouse create the dotted box while dragging the mouse? I needed it for the user to select an area of the drawing. Or is my only option to write a custom code under the mouseDragEvent of my QGraphicsView?

Thanks for any help.

tbscope
10th July 2010, 12:58
That selection rectangle is called a rubber band.
setDragMode(QGraphicsView::RubberBandDrag);

aarelovich
10th July 2010, 13:01
Thank you very much!