From 3b54ea67f43228448274d34310fa55653ff42bd1 Mon Sep 17 00:00:00 2001 From: mkr Date: Thu, 31 Jan 2008 15:37:34 +0000 Subject: [PATCH] Debug: #23 and modifications to forbid the selection of the node, when it is moved, and, therefore, to avoid showing of the Input Panel. --- src/QxGraph/QxGraph_CanvasView.cxx | 20 ++++++++++++++++---- src/QxGraph/QxGraph_CanvasView.h | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/QxGraph/QxGraph_CanvasView.cxx b/src/QxGraph/QxGraph_CanvasView.cxx index d3873b8fb..be0d7dcbf 100644 --- a/src/QxGraph/QxGraph_CanvasView.cxx +++ b/src/QxGraph/QxGraph_CanvasView.cxx @@ -112,7 +112,8 @@ QxGraph_CanvasView::QxGraph_CanvasView(QxGraph_Canvas* theCanvas, QxGraph_ViewWi QCanvasView(theCanvas, theViewWindow, 0, Qt::WRepaintNoErase), myCurrentItem(0), myHilightedItem(0), - mySelectedItem(0) + mySelectedItem(0), + myMovingDone(false) { printf("Construct QxGraph_CanvasView\n"); setName("QxGraph_CanvasView"); @@ -158,6 +159,11 @@ void QxGraph_CanvasView::contentsMousePressEvent(QMouseEvent* theEvent) return; } + if ( myOperation == WINDOWFIT ) + { // Fit area + return; + } + if ( theEvent->button() == Qt::LeftButton && theEvent->state() == Qt::ControlButton || myOperation == ZOOMVIEW ) @@ -226,11 +232,13 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) //draw new selected rectangle QPen pen(Qt::black,1,Qt::SolidLine); aRect1->setPen(pen); - aRect1->setZ(3); + aRect1->setZ(1E+6); aRect1->show(); mySelectedRect = aRect1; canvas()->update(); + + return; } if ( myOperation == ZOOMVIEW ) @@ -261,6 +269,7 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) if ( anActItem && anActItem->isResizing() ) { // to resize items on canvas view anActItem->resize(aPoint); + myMovingDone = true; return; } @@ -274,9 +283,10 @@ void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) } myCurrentItem->moveBy(aPoint.x() - myPoint.x(), aPoint.y() - myPoint.y()); + myMovingDone = true; myPoint = aPoint; canvas()->update(); - + // scroll contents if mouse is outside QRect r(contentsX(), contentsY(), visibleWidth(), visibleHeight()); if (!r.contains(theEvent->pos())) { @@ -525,7 +535,7 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) } } - if ( theEvent->button() == LeftButton ) + if ( theEvent->button() == LeftButton && !myMovingDone ) { // Selection mechanism QCanvasItemList aList = canvas()->collisions(aPoint); @@ -553,6 +563,8 @@ void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) } } } + + myMovingDone = false; } void QxGraph_CanvasView::contentsMouseDoubleClickEvent(QMouseEvent* theEvent) diff --git a/src/QxGraph/QxGraph_CanvasView.h b/src/QxGraph/QxGraph_CanvasView.h index 36cac2201..f14e1277e 100644 --- a/src/QxGraph/QxGraph_CanvasView.h +++ b/src/QxGraph/QxGraph_CanvasView.h @@ -75,6 +75,7 @@ class QXGRAPH_EXPORT QxGraph_CanvasView : public QCanvasView { QCanvasItem* myCurrentItem; QPoint myPoint; QPoint myGlobalPoint; + bool myMovingDone; // for control toolbar actions OperationType myOperation; -- 2.39.2