From 50f897f68871d0ee6723048de9b17961e186138d Mon Sep 17 00:00:00 2001 From: blacksun Date: Tue, 21 Oct 2014 20:29:16 +0000 Subject: [PATCH] Diagram command : minor imrpovement git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3391 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagramcommands.cpp | 18 +----------------- sources/diagramcommands.h | 8 -------- sources/elementsmover.cpp | 11 ----------- sources/qet.cpp | 2 +- sources/qgimanager.cpp | 1 + 5 files changed, 3 insertions(+), 37 deletions(-) diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index 94def03a8..bc7638ace 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -160,7 +160,7 @@ PasteDiagramCommand::PasteDiagramCommand( QUndoCommand(parent), content(c), diagram(dia), - filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::Images|DiagramContent::ConductorsToMove), + filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::Images|DiagramContent::ConductorsToMove | DiagramContent::Shapes), first_redo(true) { @@ -353,22 +353,6 @@ void MoveElementsCommand::move(const QPointF &actual_movement) { } } -/** - Ajoute un champ de texte de conducteur a deplacer - @param text_item Champ de texte a deplacer - @param old_pos Position du champ de texte avant le deplacement - @param new_pos Position du champ de texte apres le deplacement -*/ -void MoveElementsCommand::addConductorTextItemMovement(ConductorTextItem *text_item, const QPointF &old_pos, const QPointF &new_pos) { - if (moved_conductor_texts_.contains(text_item)) return; - if (!text_item -> wasMovedByUser()) return; - if (new_pos == old_pos) return; - moved_conductor_texts_.insert( - text_item, - qMakePair(old_pos, new_pos) - ); -} - /** * @brief MoveElementsCommand::setupAnimation * Set up the animation for this undo command diff --git a/sources/diagramcommands.h b/sources/diagramcommands.h index 8ff39642b..383cb45f5 100644 --- a/sources/diagramcommands.h +++ b/sources/diagramcommands.h @@ -159,7 +159,6 @@ class MoveElementsCommand : public QUndoCommand { virtual void undo(); virtual void redo(); virtual void move(const QPointF &); - virtual void addConductorTextItemMovement(ConductorTextItem *, const QPointF &, const QPointF &); private: void setupAnimation (QObject * target, const QByteArray &propertyName, const QVariant start, const QVariant end); @@ -174,13 +173,6 @@ class MoveElementsCommand : public QUndoCommand { QPointF movement; ///animation group QParallelAnimationGroup *m_anim_group; - /** - Moving elements impacts their conductors: either they are moved, or their path - needs to be generated again, which in turn tends to move their child text - items. This attribute holds both new and previous positions for each moved - text item. - */ - QHash > moved_conductor_texts_; /// prevent the first call to redo() bool first_redo; }; diff --git a/sources/elementsmover.cpp b/sources/elementsmover.cpp index 2b8a45d9c..db0864751 100644 --- a/sources/elementsmover.cpp +++ b/sources/elementsmover.cpp @@ -155,17 +155,6 @@ void ElementsMover::endMovement() { current_movement_ ); - // Add info needed to the position of conductors texte - foreach(ConductorTextItem *text_item, updated_conductors_text_pos_.keys()) { - if (text_item -> pos() != updated_conductors_text_pos_[text_item]) { - undo_object -> addConductorTextItemMovement( - text_item, - updated_conductors_text_pos_[text_item], - text_item -> pos() - ); - } - } - diagram_ -> undoStack().push(undo_object); } diff --git a/sources/qet.cpp b/sources/qet.cpp index a37bba0fd..17715869a 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -273,7 +273,7 @@ QString QET::ElementsAndConductorsSentence(int elements_count, int conductors_co if (shapes_count) { text += QObject::tr( - "%n image(s)", + "%n forme(s)", "part of a sentence listing the content of a diagram", shapes_count ); diff --git a/sources/qgimanager.cpp b/sources/qgimanager.cpp index 4cf608455..5f67b649f 100644 --- a/sources/qgimanager.cpp +++ b/sources/qgimanager.cpp @@ -46,6 +46,7 @@ QGIManager::~QGIManager(){ @param qgi QGraphicsItem a gerer */ void QGIManager::manage(QGraphicsItem *qgi) { + if (qgi -> parentItem()) return; if (qgi_manager.contains(qgi)) ++ qgi_manager[qgi]; else qgi_manager.insert(qgi, 1); }