PDA

View Full Version : What are the methods to Handle for resizing QGraphicsItem



Kingofhearts_sri
19th January 2009, 07:33
Hi,
I want to resize a QGraphicsItem which r placed on to scene in runtime, I want the user to resize the Item after placing it on the scene. So what are methods or wat is the process for getting it.
with regards,

radek.z
19th January 2009, 09:05
Hi,

there is metod for scaling one item
void QGraphicsItem::scale ( qreal sx, qreal sy )
or if you want to scale whole scene then
void QGraphicsView::scale ( qreal sx, qreal sy )

radek.z

Kingofhearts_sri
19th January 2009, 10:39
But I want to resize it with drag event. i want to give user the option to resize. for example there is a line with default size then if user want to resize it then user need to click on line item so that item is ready for draging and user need to drag the ending or starting point to a particular position then the line should scale upto the mouse position.
thanks for replying.

sanjayshelke
19th January 2009, 13:01
U need to handle mouseMoveEvent() to resize ur item. In addition u need to write your own resizeItem() method which will be called from mouseMoveEvent().

And you need to place all your logic of resizing an item in the resizeItem() method.

Regards,
~Sanjay