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

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4030 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-06-27 16:02:28 +00:00
parent c2b97439a9
commit 20f4985f7a
3 changed files with 21 additions and 0 deletions

View File

@@ -80,6 +80,25 @@ void DiagramContent::clear() {
otherConductors.clear(); otherConductors.clear();
} }
/**
* @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 @param filter Types desires
@return la liste des items formant le contenu du schema @return la liste des items formant le contenu du schema

View File

@@ -78,6 +78,7 @@ class DiagramContent {
QString sentence(int = All) const; QString sentence(int = All) const;
int count(int = All) const; int count(int = All) const;
void clear(); void clear();
int removeNonMovableItems();
}; };
QDebug &operator<<(QDebug, DiagramContent &); QDebug &operator<<(QDebug, DiagramContent &);
#endif #endif

View File

@@ -76,6 +76,7 @@ int ElementsMover::beginMovement(Diagram *diagram, QGraphicsItem *driver_item) {
current_movement_ = QPointF(0.0, 0.0); current_movement_ = QPointF(0.0, 0.0);
moved_content_ = diagram -> selectedContent(); moved_content_ = diagram -> selectedContent();
moved_content_.removeNonMovableItems();
if (!moved_content_.count()) return(-1); if (!moved_content_.count()) return(-1);