From d13937fb408f855cfebabe498a24069ac3ef7dbe Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 24 May 2016 12:43:30 +0300 Subject: [PATCH] Clicking on notselectable object do not clean previous selections. --HG-- branch : develop --- .../vtools/tools/drawTools/toolcurve/vabstractspline.cpp | 7 +++++++ .../toolpoint/toolsinglepoint/vtoolsinglepoint.cpp | 7 +++++++ src/libs/vtools/tools/nodeDetails/vnodepoint.cpp | 7 +++++++ src/libs/vtools/tools/vtooldetail.cpp | 7 +++++++ src/libs/vwidgets/vgraphicssimpletextitem.cpp | 7 +++++++ src/libs/vwidgets/vsimplecurve.cpp | 8 ++++++++ src/libs/vwidgets/vsimplepoint.cpp | 8 ++++++++ 7 files changed, 51 insertions(+) diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index 5a50181b7..57faed240 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -204,6 +204,13 @@ void VAbstractSpline::mousePressEvent(QGraphicsSceneMouseEvent *event) { // Special for not selectable item first need to call standard mousePressEvent then accept event QGraphicsPathItem::mousePressEvent(event); + + // Somehow clicking on notselectable object do not clean previous selections. + if (not (flags() & ItemIsSelectable) && scene()) + { + scene()->clearSelection(); + } + event->accept();// Special for not selectable item first need to call standard mousePressEvent then accept event } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp index 9a88b1835..6a880c460 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp @@ -132,6 +132,13 @@ void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event) { // Special for not selectable item first need to call standard mousePressEvent then accept event QGraphicsEllipseItem::mousePressEvent(event); + + // Somehow clicking on notselectable object do not clean previous selections. + if (not (flags() & ItemIsSelectable) && scene()) + { + scene()->clearSelection(); + } + if (selectionType == SelectionType::ByMouseRelease) { event->accept();// Special for not selectable item first need to call standard mousePressEvent then accept event diff --git a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp index c3942b581..67345803d 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp @@ -234,6 +234,13 @@ void VNodePoint::mousePressEvent(QGraphicsSceneMouseEvent *event) { // Special for not selectable item first need to call standard mousePressEvent then accept event QGraphicsEllipseItem::mousePressEvent(event); + + // Somehow clicking on notselectable object do not clean previous selections. + if (not (flags() & ItemIsSelectable) && scene()) + { + scene()->clearSelection(); + } + event->accept();// Special for not selectable item first need to call standard mousePressEvent then accept event } diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index ba0c053ee..b6e311cf1 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -460,6 +460,13 @@ void VToolDetail::mousePressEvent(QGraphicsSceneMouseEvent *event) { // Special for not selectable item first need to call standard mousePressEvent then accept event VNoBrushScalePathItem::mousePressEvent(event); + + // Somehow clicking on notselectable object do not clean previous selections. + if (not (flags() & ItemIsSelectable) && scene()) + { + scene()->clearSelection(); + } + if (flags() & QGraphicsItem::ItemIsMovable) { if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick) diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index 438133bf9..e9a8ca248 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -207,6 +207,13 @@ void VGraphicsSimpleTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { // Special for not selectable item first need to call standard mousePressEvent then accept event QGraphicsSimpleTextItem::mousePressEvent(event); + + // Somehow clicking on notselectable object do not clean previous selections. + if (not (flags() & ItemIsSelectable) && scene()) + { + scene()->clearSelection(); + } + if (flags() & QGraphicsItem::ItemIsMovable) { if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick) diff --git a/src/libs/vwidgets/vsimplecurve.cpp b/src/libs/vwidgets/vsimplecurve.cpp index ea7f95c97..25d39522c 100644 --- a/src/libs/vwidgets/vsimplecurve.cpp +++ b/src/libs/vwidgets/vsimplecurve.cpp @@ -32,6 +32,7 @@ #include #include +#include //--------------------------------------------------------------------------------------------------------------------- VSimpleCurve::VSimpleCurve(quint32 id, const QColor ¤tColor, Unit patternUnit, qreal *factor, QObject *parent) @@ -92,6 +93,13 @@ void VSimpleCurve::mousePressEvent(QGraphicsSceneMouseEvent *event) { // Special for not selectable item first need to call standard mousePressEvent then accept event QGraphicsPathItem::mousePressEvent(event); + + // Somehow clicking on notselectable object do not clean previous selections. + if (not (flags() & ItemIsSelectable) && scene()) + { + scene()->clearSelection(); + } + if (selectionType == SelectionType::ByMouseRelease) { event->accept();// Special for not selectable item first need to call standard mousePressEvent then accept event diff --git a/src/libs/vwidgets/vsimplepoint.cpp b/src/libs/vwidgets/vsimplepoint.cpp index a4748d61f..8c32e3714 100644 --- a/src/libs/vwidgets/vsimplepoint.cpp +++ b/src/libs/vwidgets/vsimplepoint.cpp @@ -36,6 +36,7 @@ #include #include #include +#include //--------------------------------------------------------------------------------------------------------------------- VSimplePoint::VSimplePoint(quint32 id, const QColor ¤tColor, Unit patternUnit, qreal *factor, QObject *parent) @@ -188,6 +189,13 @@ void VSimplePoint::mousePressEvent(QGraphicsSceneMouseEvent *event) { // Special for not selectable item first need to call standard mousePressEvent then accept event QGraphicsEllipseItem::mousePressEvent(event); + + // Somehow clicking on notselectable object do not clean previous selections. + if (not (flags() & ItemIsSelectable) && scene()) + { + scene()->clearSelection(); + } + if (selectionType == SelectionType::ByMouseRelease) { event->accept();// Special for not selectable item first need to call standard mousePressEvent then accept event