sizegripitem icon indicating copy to clipboard operation
sizegripitem copied to clipboard

Resizing when parent QGraphicsItem is selected

Open ruisebastiao opened this issue 10 years ago • 3 comments

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

ruisebastiao avatar Jun 11 '14 09:06 ruisebastiao

@ruisebastiao did you resolve this? :)

davelab6 avatar Nov 06 '15 11:11 davelab6

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

technic avatar Jan 18 '17 02:01 technic

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.

SurKM9 avatar Apr 07 '20 20:04 SurKM9