cesarblum / sizegripitem

A size grip QGraphicsItem for interactive resizing.
Other
30 stars 19 forks source link

Resizing when parent QGraphicsItem is selected #2

Open ruisebastiao opened 10 years ago

ruisebastiao commented 10 years ago

Hello,

I want to resize the parent QGraphicsItem even when it is selected so i set setFlag(QGraphicsItem::ItemIsSelectable,true) in my main GraphicsItem but when i drag the handler the parent GraphicsItem moves rather then being resized. How can i do the resizing even when the parent GraphicsItem is selected?

Best regards, Rui

davelab6 commented 9 years ago

@ruisebastiao did you resolve this? :)

technic commented 7 years ago

set flag ItemIsMovable = false of the parent before doing resize. for example in mousePressEvent of HandleItem.

SurKM9 commented 4 years ago

In case if any body is wondering how to solve this.

I solved it with something like parent_->parentItem()->setSelected(false); inside SizeGripItem::HandleItem::hoverEnterEvent(QGraphicsSceneHoverEvent* event) and resetting it to parent_->parentItem()->setSelected(true); inside SizeGripItem::HandleItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)

setAcceptHoverEvents(true) needs to be set.