From fd493423c1446de55d105dec0bd472b0c1cbb036 Mon Sep 17 00:00:00 2001 From: mkr Date: Mon, 16 Apr 2007 06:02:44 +0000 Subject: [PATCH] Activate selection process on release left button. --- src/QxGraph/QxGraph_CanvasView.cxx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/QxGraph/QxGraph_CanvasView.cxx b/src/QxGraph/QxGraph_CanvasView.cxx index dbcf62a54..b09654846 100644 --- a/src/QxGraph/QxGraph_CanvasView.cxx +++ b/src/QxGraph/QxGraph_CanvasView.cxx @@ -476,11 +476,31 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) if ( theEvent->button() == LeftButton ) { - if ( canvas()->collisions(aPoint).empty() && mySelectedItem ) + // Selection mechanism + QCanvasItemList aList = canvas()->collisions(aPoint); + + if ( aList.empty() && mySelectedItem ) { mySelectedItem->select(aPoint, false); mySelectedItem = 0; } + else + { + for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { + QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); + if (anActItem) + { + anActItem->select(aPoint); + if (anActItem != mySelectedItem) + { + if (mySelectedItem) + mySelectedItem->select(aPoint, false); + mySelectedItem = anActItem; + } + break; + } + } + } } } -- 2.39.2