[qet] [4379] Bug fix (unable to load element from .qet file) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4379
Author: blacksun
Date: 2016-03-15 19:42:18 +0100 (Tue, 15 Mar 2016)
Log Message:
-----------
Bug fix (unable to load element from .qet file)
Modified Paths:
--------------
trunk/sources/ElementsCollection/xmlelementcollection.cpp
trunk/sources/diagram.cpp
trunk/sources/diagram.h
trunk/sources/elementslocation.cpp
Modified: trunk/sources/ElementsCollection/xmlelementcollection.cpp
===================================================================
--- trunk/sources/ElementsCollection/xmlelementcollection.cpp 2016-03-15 15:48:17 UTC (rev 4378)
+++ trunk/sources/ElementsCollection/xmlelementcollection.cpp 2016-03-15 18:42:18 UTC (rev 4379)
@@ -79,6 +79,8 @@
/**
* @brief XmlElementCollection::root
+ * The root is the beginning of the xml collection, the tag name
+ * of the dom element is : collection
* @return The root QDomElement of the collection
*/
QDomElement XmlElementCollection::root() const {
Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp 2016-03-15 15:48:17 UTC (rev 4378)
+++ trunk/sources/diagram.cpp 2016-03-15 18:42:18 UTC (rev 4379)
@@ -49,7 +49,7 @@
*/
Diagram::Diagram(QETProject *project) :
QGraphicsScene (project),
- project_ (nullptr),
+ m_project (nullptr),
diagram_qet_version_ (-1),
draw_grid_ (true),
use_border_ (true),
@@ -638,7 +638,7 @@
qreal project_qet_version = declaredQElectroTechVersion(true);
bool handle_inputs_rotation = (
project_qet_version != -1 && project_qet_version < 0.3 &&
- project_ -> state() == QETProject::ProjectParsingRunning
+ m_project -> state() == QETProject::ProjectParsingRunning
);
//Load all elements from the XML
@@ -650,8 +650,13 @@
// cree un element dont le type correspond a l'id type
QString type_id = element_xml.attribute("type");
- ElementsLocation element_location = ElementsLocation(type_id);
- if (type_id.startsWith("embed://")) element_location.setProject(project_);
+ ElementsLocation element_location;
+ if (type_id.startsWith("embed://")) {
+ element_location = ElementsLocation(type_id, m_project);
+ }
+ else {
+ element_location = ElementsLocation(type_id);
+ }
int state = 0;
Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, 0, &state);
@@ -932,7 +937,7 @@
void Diagram::titleBlockTemplateRemoved(const QString &template_name, const QString &new_template)
{
if (border_and_titleblock.titleBlockTemplateName() != template_name) return;
- const TitleBlockTemplate *final_template = project_->embeddedTitleBlockTemplatesCollection()->getTemplate(new_template);
+ const TitleBlockTemplate *final_template = m_project->embeddedTitleBlockTemplatesCollection()->getTemplate(new_template);
border_and_titleblock.titleBlockTemplateRemoved(template_name, final_template);
update();
}
@@ -943,10 +948,10 @@
*/
void Diagram::setTitleBlockTemplate(const QString &template_name)
{
- if (!project_) return;
+ if (!m_project) return;
QString current_name = border_and_titleblock.titleBlockTemplateName();
- const TitleBlockTemplate *titleblock_template = project_->embeddedTitleBlockTemplatesCollection()->getTemplate(template_name);
+ const TitleBlockTemplate *titleblock_template = m_project->embeddedTitleBlockTemplatesCollection()->getTemplate(template_name);
border_and_titleblock.titleBlockTemplateRemoved(current_name, titleblock_template);
if (template_name != current_name)
@@ -1266,7 +1271,7 @@
independant.
*/
QETProject *Diagram::project() const {
- return(project_);
+ return(m_project);
}
/**
@@ -1276,19 +1281,19 @@
*/
void Diagram::setProject(QETProject *project)
{
- if (project_ == project) return;
+ if (m_project == project) return;
- if (project_)
+ if (m_project)
{
- disconnect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
- disconnect (project_, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
+ disconnect (m_project, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
+ disconnect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
}
- project_ = project;
+ m_project = project;
setParent (project);
- connect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
- connect (project_, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
+ connect (m_project, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
+ connect (m_project, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
}
/**
@@ -1296,8 +1301,8 @@
if it is has no parent project
*/
int Diagram::folioIndex() const {
- if (!project_) return(-1);
- return(project_ -> folioIndex(this));
+ if (!m_project) return(-1);
+ return(m_project -> folioIndex(this));
}
/**
@@ -1310,8 +1315,8 @@
if (diagram_qet_version_ != -1) {
return diagram_qet_version_;
}
- if (fallback_to_project && project_) {
- return(project_ -> declaredQElectroTechVersion());
+ if (fallback_to_project && m_project) {
+ return(m_project -> declaredQElectroTechVersion());
}
return(-1);
}
@@ -1323,7 +1328,7 @@
*/
bool Diagram::isReadOnly() const
{
- return project_ -> isReadOnly();
+ return m_project -> isReadOnly();
}
/**
Modified: trunk/sources/diagram.h
===================================================================
--- trunk/sources/diagram.h 2016-03-15 15:48:17 UTC (rev 4378)
+++ trunk/sources/diagram.h 2016-03-15 18:42:18 UTC (rev 4379)
@@ -89,7 +89,7 @@
ElementsMover *elements_mover_;
ElementTextsMover *element_texts_mover_;
QGIManager *qgi_manager_;
- QETProject *project_;
+ QETProject *m_project;
QDomDocument xml_document_;
@@ -119,8 +119,8 @@
void setEventInterface (DiagramEventInterface *event_interface);
//methods related to xref properties
- QString defaultReportProperties () const {return project_ -> defaultReportProperties();}
- XRefProperties defaultXRefProperties (const QString &str) const {return project_ -> defaultXRefProperties(str);}
+ QString defaultReportProperties () const {return m_project -> defaultReportProperties();}
+ XRefProperties defaultXRefProperties (const QString &str) const {return m_project -> defaultXRefProperties(str);}
//methods related to autonum
QString conductorsAutonumName() const;
Modified: trunk/sources/elementslocation.cpp
===================================================================
--- trunk/sources/elementslocation.cpp 2016-03-15 15:48:17 UTC (rev 4378)
+++ trunk/sources/elementslocation.cpp 2016-03-15 18:42:18 UTC (rev 4379)
@@ -79,7 +79,11 @@
*/
ElementsLocation &ElementsLocation::operator=(const ElementsLocation &other) {
m_collection_path = other.m_collection_path;
+ m_file_system_path = other.m_file_system_path;
m_project = other.m_project;
+ m_xml = other.m_xml;
+ m_uuid = other.m_uuid;
+ m_icon = other.m_icon;
return(*this);
}