[qet] [4030] Minor fix : locked item isn' t moved by arrow key or multiple selections.

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


Revision: 4030
Author:   blacksun
Date:     2015-06-27 18:02:28 +0200 (Sat, 27 Jun 2015)
Log Message:
-----------
Minor fix : locked item isn't moved by arrow key or multiple selections.

Modified Paths:
--------------
    trunk/sources/diagramcontent.cpp
    trunk/sources/diagramcontent.h
    trunk/sources/elementsmover.cpp

Modified: trunk/sources/diagramcontent.cpp
===================================================================
--- trunk/sources/diagramcontent.cpp	2015-06-25 18:23:47 UTC (rev 4029)
+++ trunk/sources/diagramcontent.cpp	2015-06-27 16:02:28 UTC (rev 4030)
@@ -81,6 +81,25 @@
 }
 
 /**
+ * @brief DiagramContent::removeNonMovableItems
+ * Remove all non movable item.
+ * @return : return the numbers of removed item
+ */
+int DiagramContent::removeNonMovableItems()
+{
+	int count_ = 0;
+
+	foreach(Element *elmt, elements)
+		if (!elmt->isMovable()) elements.remove(elmt); ++count_;
+	foreach(DiagramImageItem *img, images)
+		if (!img->isMovable()) images.remove(img); ++count_;
+	foreach (QetShapeItem *shape, shapes)
+		if (!shape->isMovable()) shapes.remove(shape); ++count_;
+
+	return count_;
+}
+
+/**
 	@param filter Types desires
 	@return la liste des items formant le contenu du schema
 */

Modified: trunk/sources/diagramcontent.h
===================================================================
--- trunk/sources/diagramcontent.h	2015-06-25 18:23:47 UTC (rev 4029)
+++ trunk/sources/diagramcontent.h	2015-06-27 16:02:28 UTC (rev 4030)
@@ -78,6 +78,7 @@
 	QString sentence(int = All) const;
 	int count(int = All) const;
 	void clear();
+	int removeNonMovableItems();
 };
 QDebug &operator<<(QDebug, DiagramContent &);
 #endif

Modified: trunk/sources/elementsmover.cpp
===================================================================
--- trunk/sources/elementsmover.cpp	2015-06-25 18:23:47 UTC (rev 4029)
+++ trunk/sources/elementsmover.cpp	2015-06-27 16:02:28 UTC (rev 4030)
@@ -76,6 +76,7 @@
 	current_movement_ = QPointF(0.0, 0.0);
 	
 	moved_content_ = diagram -> selectedContent();
+	moved_content_.removeNonMovableItems();
 
 	if (!moved_content_.count()) return(-1);
 	


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