From e29ed4372aff14b7048ae5ed24cf62172ff2865b Mon Sep 17 00:00:00 2001 From: blacksun Date: Wed, 18 Mar 2015 14:10:25 +0000 Subject: [PATCH] Bug fix : element was not integrate into the xml project. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3833 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagramevent/diagrameventaddelement.cpp | 11 ++++++++--- sources/diagramevent/diagrameventaddelement.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sources/diagramevent/diagrameventaddelement.cpp b/sources/diagramevent/diagrameventaddelement.cpp index 534d22b3f..8286d1c8f 100644 --- a/sources/diagramevent/diagrameventaddelement.cpp +++ b/sources/diagramevent/diagrameventaddelement.cpp @@ -175,9 +175,9 @@ bool DiagramEventAddElement::buildElement() { QString error_msg; IntegrationMoveElementsHandler *integ_handler = new IntegrationMoveElementsHandler(); - QString integ_path = m_diagram -> project() -> integrateElement(m_location.toString(), integ_handler, error_msg); + m_integrate_path = m_diagram -> project() -> integrateElement(m_location.toString(), integ_handler, error_msg); delete integ_handler; - if (integ_path.isEmpty()) + if (m_integrate_path.isEmpty()) { qDebug() << "DiagramView::addDroppedElement : Impossible d'ajouter l'element. Motif : " << qPrintable(error_msg); return false; @@ -204,7 +204,12 @@ bool DiagramEventAddElement::buildElement() void DiagramEventAddElement::addElement() { int state; - Element *element = ElementFactory::Instance() -> createElement(m_location, 0, &state); + Element *element; + if (m_integrate_path.isEmpty()) + element = ElementFactory::Instance() -> createElement(m_location, 0, &state); + else + element = ElementFactory::Instance() -> createElement(ElementsLocation::locationFromString(m_integrate_path), 0, &state); + //Build failed if (state) { diff --git a/sources/diagramevent/diagrameventaddelement.h b/sources/diagramevent/diagrameventaddelement.h index c7f2f37d8..8d0ecc0b4 100644 --- a/sources/diagramevent/diagrameventaddelement.h +++ b/sources/diagramevent/diagrameventaddelement.h @@ -48,6 +48,7 @@ class DiagramEventAddElement : public DiagramEventInterface private: ElementsLocation m_location; Element *m_element; + QString m_integrate_path; }; #endif // DIAGRAMEVENTADDELEMENT_H