From f032df223fd7383df28dae153d455c4a01a19e90 Mon Sep 17 00:00:00 2001 From: Stefan Merettig Date: Thu, 26 Mar 2015 16:53:58 +0100 Subject: [PATCH] Screen grabber: Fix position of handles with negative selection When you clicked, and then move towards top-left with the cursor, and release, the handles were displayed inside the resulting rectangle, instead of outside. --- src/widget/tool/screengrabberchooserrectitem.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/widget/tool/screengrabberchooserrectitem.cpp b/src/widget/tool/screengrabberchooserrectitem.cpp index 8e133110d..3ca40b3f2 100644 --- a/src/widget/tool/screengrabberchooserrectitem.cpp +++ b/src/widget/tool/screengrabberchooserrectitem.cpp @@ -169,12 +169,20 @@ void ScreenGrabberChooserRectItem::mouseRelease(QGraphicsSceneMouseEvent* event) } else { + QRect normalized = chosenRect(); + + rectWidth = normalized.width(); + rectHeight = normalized.height(); + setPos(normalized.x(), normalized.y()); + mainRect->setRect(0, 0, rectWidth, rectHeight); + + updateHandlePositions(); showHandles(); } emit regionChosen(chosenRect()); - this->state = None; - this->mainRect->ungrabMouse(); + state = None; + mainRect->ungrabMouse(); } }