[qet] qet/qet: [5274] Minor diagram editor : fix minor wrong behavior when naviagte with the arrow key

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


Revision: 5274
Author:   blacksun
Date:     2018-03-24 15:29:43 +0100 (Sat, 24 Mar 2018)
Log Message:
-----------
Minor diagram editor : fix minor wrong behavior when naviagte with the arrow key

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

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2018-03-24 13:45:48 UTC (rev 5273)
+++ trunk/sources/diagramview.cpp	2018-03-24 14:29:43 UTC (rev 5274)
@@ -625,11 +625,15 @@
 */
 void DiagramView::scrollOnMovement(QKeyEvent *e)
 {
-			QList<QGraphicsItem *> selected_elmts = DiagramContent(m_diagram).items(DiagramContent::All);
+			const QList<QGraphicsItem *> selected_elmts = DiagramContent(m_diagram).items(DiagramContent::All);
 			QRectF viewed_scene = viewedSceneRect();
-			foreach (QGraphicsItem *qgi, selected_elmts){
-				if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
-				if (qgraphicsitem_cast<QetShapeItem *>(qgi)) continue;
+			for (QGraphicsItem *qgi : selected_elmts)
+			{
+				if (qgraphicsitem_cast<Conductor *>(qgi))
+					continue;
+				if(qgi->parentItem() && qgi->parentItem()->isSelected())
+					continue;
+				
 				qreal x = qgi->pos().x();
 				qreal y = qgi->pos().y();
 				qreal bottom = viewed_scene.bottom();
@@ -640,12 +644,15 @@
 				qreal elmt_bottom = y + qgi->boundingRect().bottom();
 				qreal elmt_right = x + qgi->boundingRect().right();
 				qreal elmt_left = x + qgi->boundingRect().left();
+				
 				bool elmt_right_of_left_margin = elmt_left>=left;
 				bool elmt_left_of_right_margin = elmt_right<=right;
-				bool elmt_below_top_margin = elmt_top>=top;
-				bool elmt_above_bottom_margin = elmt_bottom<=bottom;
+				bool elmt_below_top_margin     = elmt_top>=top;
+				bool elmt_above_bottom_margin  = elmt_bottom<=bottom;
+				
 				if (!(elmt_right_of_left_margin && elmt_left_of_right_margin) ||
-					!(elmt_below_top_margin    && elmt_above_bottom_margin )  ) {
+					!(elmt_below_top_margin    && elmt_above_bottom_margin )  )
+				{
 						QScrollBar *h = horizontalScrollBar();
 						QScrollBar *v = verticalScrollBar();
 						int h_increment=0;


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