[qet] [2932] hover an element when create new shape don't focus him

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2932
Author:   blacksun
Date:     2014-03-18 17:12:51 +0100 (Tue, 18 Mar 2014)
Log Message:
-----------
hover an element when create new shape don't focus him

Modified Paths:
--------------
    trunk/sources/diagramview.cpp

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2014-03-18 12:35:36 UTC (rev 2931)
+++ trunk/sources/diagramview.cpp	2014-03-18 16:12:51 UTC (rev 2932)
@@ -445,9 +445,11 @@
 		switchToVisualisationModeIfNeeded(e);
 		fresh_focus_in_ = false;
 	}
+
 	if (isInteractive() && !scene -> isReadOnly() && e -> buttons() == Qt::LeftButton) {
 		switch (current_behavior) {
 			case noAction:
+				QGraphicsView::mousePressEvent(e);
 				break;
 			case addingText:
 				addDiagramTextAtPos(mapToScene(e -> pos()));
@@ -474,6 +476,7 @@
 				break;
 			case dragView:
 				current_behavior = noAction;
+				QGraphicsView::mousePressEvent(e);
 				break;
 			default:
 				current_behavior = noAction;
@@ -482,13 +485,13 @@
 	}
 	// workaround for drag view with hold wheel click and drag mouse
 	// see also mouseMoveEvent() and mouseReleaseEvent()
-	if (e -> buttons() == Qt::MidButton) {
+	else if (e -> buttons() == Qt::MidButton) {
 		setCursor(Qt::ClosedHandCursor);
 		reference_view_ = mapToScene(e -> pos());
 		center_view_ = mapToScene(this -> viewport() -> rect()).boundingRect().center();
 		return;
 	}
-	QGraphicsView::mousePressEvent(e);
+	else QGraphicsView::mousePressEvent(e);
 }
 
 /**
@@ -502,7 +505,7 @@
 		center_view_ = mapToScene(this -> viewport() -> rect()).boundingRect().center();
 		return;
 	}
-	if ((e -> buttons() & Qt::LeftButton) &&
+	else if ((e -> buttons() & Qt::LeftButton) &&
 		(current_behavior == addingLine || current_behavior == addingRectangle || current_behavior == addingEllipse)) {
 		QRectF rec = QRectF(rubber_band_origin, mapToScene(e->pos())).normalized();
 		scene ->removeItem(newItem);
@@ -511,7 +514,7 @@
 			newItem -> setLineAngle(rubber_band_origin != rec.topLeft() && rubber_band_origin != rec.bottomRight());
 		scene ->addItem(newItem);
 	}
-	QGraphicsView::mouseMoveEvent(e);
+	else QGraphicsView::mouseMoveEvent(e);
 }
 
 /**
@@ -523,7 +526,7 @@
 		setCursor(Qt::ArrowCursor);
 		return;
 	}
-	if (current_behavior == addingLine || current_behavior == addingRectangle || current_behavior == addingEllipse) {
+	else if (current_behavior == addingLine || current_behavior == addingRectangle || current_behavior == addingEllipse) {
 		newItem -> setFullyBuilt(true);
 		// le place a la position pos en gerant l'annulation
 		scene -> undoStack().push(new AddShapeCommand(scene, newItem, rubber_band_origin));
@@ -537,7 +540,7 @@
 		current_behavior = noAction;
 	}
 
-	QGraphicsView::mouseReleaseEvent(e);
+	else QGraphicsView::mouseReleaseEvent(e);
 }
 
 /**


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/