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
This commit is contained in:
blacksun
2015-03-18 14:10:25 +00:00
parent 814d1117af
commit e29ed4372a
2 changed files with 9 additions and 3 deletions

View File

@@ -175,9 +175,9 @@ bool DiagramEventAddElement::buildElement()
{ {
QString error_msg; QString error_msg;
IntegrationMoveElementsHandler *integ_handler = new IntegrationMoveElementsHandler(); 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; delete integ_handler;
if (integ_path.isEmpty()) if (m_integrate_path.isEmpty())
{ {
qDebug() << "DiagramView::addDroppedElement : Impossible d'ajouter l'element. Motif : " << qPrintable(error_msg); qDebug() << "DiagramView::addDroppedElement : Impossible d'ajouter l'element. Motif : " << qPrintable(error_msg);
return false; return false;
@@ -204,7 +204,12 @@ bool DiagramEventAddElement::buildElement()
void DiagramEventAddElement::addElement() void DiagramEventAddElement::addElement()
{ {
int state; 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 //Build failed
if (state) if (state)
{ {

View File

@@ -48,6 +48,7 @@ class DiagramEventAddElement : public DiagramEventInterface
private: private:
ElementsLocation m_location; ElementsLocation m_location;
Element *m_element; Element *m_element;
QString m_integrate_path;
}; };
#endif // DIAGRAMEVENTADDELEMENT_H #endif // DIAGRAMEVENTADDELEMENT_H