mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Merge commit '77710e1cc5e597d06196d2ee163198176032987a'
Conflicts: sources/conductorproperties.cpp sources/qetgraphicsitem/element.cpp sources/qetgraphicsitem/qetshapeitem.cpp
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="52" version="0.51" hotspot_x="56" link_type="simple" width="70" type="element" height="100">
|
||||
<definition hotspot_y="52" version="0.51" hotspot_x="56" link_type="master" width="70" type="element" height="100">
|
||||
<uuid uuid="{2d6c186b-0578-4682-90c9-f77843432e9f}"/>
|
||||
<names>
|
||||
<name lang="cs">Motorový spouštěč 1P+N</name>
|
||||
@@ -12,6 +12,9 @@
|
||||
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
|
||||
<name lang="hu">Motorvédő kapcsoló 1 pólusú GV</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<polygon x1="0" y1="14" x5="0" y4="4" y5="4" x6="0" y7="-25" x2="0" y6="-6" y2="10" y3="10" x7="-7" antialias="true" x3="5" closed="false" x4="5" style="line-style:normal;line-weight:normal;filling:none;color:black"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="52" width="70" version="0.51" type="element" height="100" hotspot_x="56" link_type="simple">
|
||||
<definition hotspot_y="52" width="70" version="0.51" type="element" height="100" hotspot_x="56" link_type="master">
|
||||
<uuid uuid="{ec5fa3cd-6769-4a35-aaa9-6bc5ba4fc779}"/>
|
||||
<names>
|
||||
<name lang="fr">Disjoncteur Magnéto-thermique GV 2P</name>
|
||||
@@ -8,6 +8,9 @@
|
||||
<name lang="cs">Motorový spouštěč 2P</name>
|
||||
<name lang="hu">Motorvédő kapcsoló 2 pólusú GV</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<polygon y2="10" x3="-15" y4="4" x2="-20" y3="10" x5="-20" style="line-style:normal;line-weight:normal;filling:none;color:black" x1="-20" x4="-15" closed="false" y1="14" y6="-6" x7="-27" y5="4" antialias="true" y7="-25" x6="-20"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="52" version="0.51" hotspot_x="56" link_type="simple" width="110" type="element" height="100">
|
||||
<definition hotspot_y="52" version="0.51" hotspot_x="56" link_type="master" width="110" type="element" height="100">
|
||||
<uuid uuid="{2424a938-847f-447f-a4ad-d9b6ef730fd9}"/>
|
||||
<names>
|
||||
<name lang="de">Motorschutzschalter</name>
|
||||
@@ -12,6 +12,9 @@
|
||||
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
|
||||
<name lang="hu">Motorvédő kapcsoló 3F + N pólusú</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<line end1="none" x1="40" y1="39" x2="40" length1="1.5" y2="28" antialias="false" end2="none" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="50" width="110" version="0.51" type="element" height="100" hotspot_x="56" link_type="simple">
|
||||
<definition hotspot_y="50" width="110" version="0.51" type="element" height="100" hotspot_x="56" link_type="master">
|
||||
<uuid uuid="{686e19c6-6bce-4ced-8c01-2d7f58a78386}"/>
|
||||
<names>
|
||||
<name lang="el">Θερμομαγνητικό</name>
|
||||
@@ -12,6 +12,9 @@
|
||||
<name lang="de">Motorschutzschalter</name>
|
||||
<name lang="hu">Motorvédő kapcsoló 4 pólusú GV</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<line y2="28" end1="none" length2="1.5" x2="40" style="line-style:normal;line-weight:normal;filling:none;color:black" x1="40" length1="1.5" y1="39" end2="none" antialias="false"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition type="element" link_type="simple" hotspot_x="31" hotspot_y="4" version="0.5" width="90" height="70">
|
||||
<definition type="element" link_type="master" hotspot_x="31" hotspot_y="4" version="0.5" width="90" height="70">
|
||||
<uuid uuid="{98ADF831-42F0-4EDE-9267-6733EEBEAF62}"/><names>
|
||||
<name lang="en">Motor circuit breaker</name>
|
||||
<name lang="es">Disyuntor termico magnetico 3P mando manual con auto retorno y boton de desenclave</name>
|
||||
@@ -10,6 +10,9 @@
|
||||
<name lang="pl">Wyłącznik silnikowy</name>
|
||||
<name lang="hu">Motorvédő kapcsoló 3 pólusú</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations>Author: The QElectroTech team
|
||||
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
|
||||
<description>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition type="element" link_type="simple" hotspot_x="33" hotspot_y="5" version="0.5" width="110" height="70">
|
||||
<definition type="element" link_type="master" hotspot_x="33" hotspot_y="5" version="0.5" width="110" height="70">
|
||||
<uuid uuid="{C33FE39E-B2EE-4EC0-BC3F-4EB76E9BCEA0}"/><names>
|
||||
<name lang="en">Motor circuit breaker with neutral</name>
|
||||
<name lang="es">Disyuntor termico magnetico 3P+N mando manual con auto retorno y boton de desenclave</name>
|
||||
@@ -10,6 +10,9 @@
|
||||
<name lang="pl">Wyłącznik silnikowy</name>
|
||||
<name lang="hu">Motorvédő kapcsoló 3F + N pólusú</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations>Author: The QElectroTech team
|
||||
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
|
||||
<description>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="70" type="element" height="110">
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="70" type="element" height="110">
|
||||
<uuid uuid="{68830151-5901-40f6-b94d-dc68b85165a2}"/>
|
||||
<names>
|
||||
<name lang="fr">Disjoncteur differentiel 1P+N</name>
|
||||
@@ -8,6 +8,9 @@
|
||||
<name lang="cs">Jističochránič 2P</name>
|
||||
<name lang="hu">Differenciál-védőkapcsoló 1P+N termikus és zárlatvédelemmel</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<line end1="none" x1="-29.6203" y1="28" x2="10" length1="1.5" y2="28" antialias="false" end2="none" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="110" type="element" height="110">
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="110" type="element" height="110">
|
||||
<uuid uuid="{3fa48846-98c0-43e1-8a96-330d4dc11ceb}"/>
|
||||
<names>
|
||||
<name lang="cs">Jističochránič 3P+N</name>
|
||||
@@ -12,6 +12,9 @@
|
||||
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
|
||||
<name lang="hu">Differenciál-védőkapcsoló 3P+N termikus és zárlatvédelemmel</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<line end1="none" x1="-29.6203" y1="28" x2="49.5887" length1="1.5" y2="28" antialias="false" end2="none" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="70" type="element" height="110">
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="70" type="element" height="110">
|
||||
<uuid uuid="{20f65431-6f1f-4e09-9c73-68a1431c40a1}"/>
|
||||
<names>
|
||||
<name lang="fr">Disjoncteur differentiel 2P</name>
|
||||
@@ -8,6 +8,9 @@
|
||||
<name lang="cs">Jističochránič 2P</name>
|
||||
<name lang="hu">Differenciál-védőkapcsoló 2P termikus és zárlatvédelemmel</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<polygon x1="-20" y1="14" x5="-20" y4="4" y5="4" x6="-20" y7="-25" x2="-20" y6="-6" y2="10" y3="10" x7="-27" antialias="true" x3="-15" closed="false" x4="-15" style="line-style:normal;line-weight:normal;filling:none;color:black"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="90" type="element" height="110">
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="90" type="element" height="110">
|
||||
<uuid uuid="{1e746e43-1906-4ea0-99a6-261e3c862dba}"/>
|
||||
<names>
|
||||
<name lang="cs">Jističochránič 3P</name>
|
||||
@@ -12,6 +12,9 @@
|
||||
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
|
||||
<name lang="hu">Differenciál-védőkapcsoló 3P termikus és zárlatvédelemmel</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<text text="I>" size="9" y="25" x="-24"/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="110" type="element" height="110">
|
||||
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="110" type="element" height="110">
|
||||
<uuid uuid="{fee3faef-5f4a-4a0b-bf0e-b6e93d9f9425}"/>
|
||||
<names>
|
||||
<name lang="de">Motorschutzschalter</name>
|
||||
@@ -12,6 +12,9 @@
|
||||
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
|
||||
<name lang="hu">Differenciál-védőkapcsoló 4P termikus és zárlatvédelemmel</name>
|
||||
</names>
|
||||
<kindInformations>
|
||||
<kindInformation name="type" show="1">protection</kindInformation>
|
||||
</kindInformations>
|
||||
<informations></informations>
|
||||
<description>
|
||||
<polygon x1="-20" y1="14" x5="-20" y4="4" y5="4" x6="-20" y7="-25" x2="-20" y6="-6" y2="10" y3="10" x7="-27" antialias="true" x3="-15" closed="false" x4="-15" style="line-style:normal;line-weight:normal;filling:none;color:black"/>
|
||||
|
||||
@@ -391,7 +391,6 @@ bool ConductorProperties::fromXml(const QDomElement &e)
|
||||
propertyDouble(e, "horizrotatetext", &horiz_rotate_text);
|
||||
|
||||
QMetaEnum me = QMetaEnum::fromType<Qt::Alignment>();
|
||||
|
||||
QString alinment_temp;
|
||||
if (propertyString(e, "horizontal-alignment", &alinment_temp) == PropertyFlags::Success)
|
||||
m_horizontal_alignment = Qt::Alignment(me.keyToValue(alinment_temp.toStdString().data()));
|
||||
|
||||
@@ -223,11 +223,6 @@ void DiagramEventAddElement::addElement()
|
||||
element -> setRotation(m_element -> rotation());
|
||||
m_diagram -> addItem(element);
|
||||
|
||||
//The element is dropped by the user, the dynamic text field stored in m_converted_text_from_xml_description
|
||||
//can be moved to m_dynamic_text_list, because we are sure fromXml will be not called.
|
||||
element->m_dynamic_text_list.append(element->m_converted_text_from_xml_description.keys());
|
||||
element->m_converted_text_from_xml_description.clear();
|
||||
|
||||
QUndoCommand *undo_object = new QUndoCommand(tr("Ajouter %1").arg(element->name()));
|
||||
new AddGraphicsObjectCommand(element, m_diagram, m_element -> pos(), undo_object);
|
||||
|
||||
|
||||
@@ -53,31 +53,6 @@ ElementsCollectionCache::ElementsCollectionCache(const QString &database_path, Q
|
||||
cache_db_.exec("PRAGMA synchronous = OFF");
|
||||
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO This code remove old table with mtime for create table with uuid, created at version 0,5")
|
||||
#endif
|
||||
//TODO This code remove old table with mtime for create table with uuid, created at version 0,5
|
||||
//see to remove this code at version 0,6 or 0,7 when all users will table with uuid.
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove this code for qet 0.6 or later")
|
||||
#endif
|
||||
QSqlQuery table_name(cache_db_);
|
||||
if (table_name.exec("PRAGMA table_info(names)"))
|
||||
{
|
||||
if (table_name.seek(2))
|
||||
{
|
||||
QString str = table_name.value(1).toString();
|
||||
table_name.finish();
|
||||
if (str == "mtime")
|
||||
{
|
||||
QSqlQuery error;
|
||||
error = cache_db_.exec("DROP TABLE names");
|
||||
error = cache_db_.exec("DROP TABLE pixmaps");
|
||||
}
|
||||
}
|
||||
else
|
||||
table_name.finish();
|
||||
}
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO the tables could already exist, handle that case.")
|
||||
#endif
|
||||
//@TODO the tables could already exist, handle that case.
|
||||
|
||||
@@ -626,7 +626,7 @@ bool Element::parseInput(const QDomElement &dom_element)
|
||||
QString::number(0)).toDouble());
|
||||
transform.translate(p.x(), p.y());
|
||||
deti->setPos(transform.map(pos));
|
||||
m_converted_text_from_xml_description.insert(deti, p);
|
||||
m_dynamic_text_list.append(deti);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -863,99 +863,6 @@ bool Element::fromXml(
|
||||
deti->fromXml(qde);
|
||||
}
|
||||
|
||||
//************************//
|
||||
//***Element texts item***//
|
||||
//************************//
|
||||
QList<QDomElement> inputs = QET::findInDomElement(e, "inputs", "input"); // inputs in diagram section
|
||||
|
||||
//First case, we check for the text item converted to dynamic text item
|
||||
const QList <DynamicElementTextItem *> conv_deti_list =
|
||||
m_converted_text_from_xml_description.keys();
|
||||
QList <DynamicElementTextItem *> successfully_converted;
|
||||
const QList <QDomElement> dom_inputs = inputs;
|
||||
|
||||
for (DynamicElementTextItem *deti : conv_deti_list)
|
||||
{
|
||||
for(const QDomElement& dom_input : dom_inputs)
|
||||
{
|
||||
//we use the same method used in ElementTextItem::fromXml
|
||||
//to compar and know if the input dom element is for one of the text stored.
|
||||
//The comparaison is made from the text position :
|
||||
//if the position of the text is the same as the position stored in 'input' dom element
|
||||
//that mean this is the good text
|
||||
if (qFuzzyCompare(qreal(dom_input.attribute("x").toDouble()),
|
||||
m_converted_text_from_xml_description.value(deti).x()) &&
|
||||
qFuzzyCompare(qreal(dom_input.attribute("y").toDouble()),
|
||||
m_converted_text_from_xml_description.value(deti).y()))
|
||||
{
|
||||
//Once again this 'if', is only for retrocompatibility with old old old project
|
||||
//when element text with tagg "label" is not null, but the element information "label" is.
|
||||
if((deti->textFrom() == DynamicElementTextItem::ElementInfo)
|
||||
&& (deti->infoName() == "label"))
|
||||
m_data.m_informations.addValue(
|
||||
"label",
|
||||
dom_input.attribute("text"));
|
||||
|
||||
deti->setText(dom_input.attribute("text"));
|
||||
|
||||
qreal rotation = deti->rotation();
|
||||
QPointF xml_pos = m_converted_text_from_xml_description.value(deti);
|
||||
|
||||
if (dom_input.attribute("userrotation").toDouble())
|
||||
rotation = dom_input.attribute("userrotation").toDouble();
|
||||
|
||||
if (dom_input.hasAttribute("userx"))
|
||||
xml_pos.setX(dom_input.attribute("userx").toDouble());
|
||||
if(dom_input.hasAttribute("usery"))
|
||||
xml_pos.setY(dom_input.attribute("usery", "0").toDouble());
|
||||
|
||||
//the origin transformation point of PartDynamicTextField
|
||||
//is the top left corner, no matter the font size
|
||||
//The origin transformation point of PartTextField
|
||||
//is the middle of left edge, and so by definition,
|
||||
//change with the size of the font
|
||||
//We need to use a QTransform to find the pos of
|
||||
//this text from the saved pos of text item
|
||||
|
||||
deti->setPos(xml_pos);
|
||||
deti->setRotation(rotation);
|
||||
|
||||
QTransform transform;
|
||||
//First make the rotation
|
||||
transform.rotate(rotation);
|
||||
QPointF pos = transform.map(
|
||||
QPointF(0,
|
||||
-deti->boundingRect().height()/2));
|
||||
transform.reset();
|
||||
//Second translate to the pos
|
||||
transform.translate(xml_pos.x(), xml_pos.y());
|
||||
deti->setPos(transform.map(pos));
|
||||
|
||||
//dom_input and deti matched we remove
|
||||
//the dom_input from inputs list,
|
||||
//to avoid unnecessary checking made below
|
||||
//we also move deti from the
|
||||
//m_converted_text_from_xml_description to m_dynamic_text_list
|
||||
inputs.removeAll(dom_input);
|
||||
m_dynamic_text_list.append(deti);
|
||||
m_converted_text_from_xml_description.remove(deti);
|
||||
successfully_converted << deti;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//###Firts case : if this is the first time the user open the project since text item are converted to dynamic text,
|
||||
//in the previous opening of the project, every texts field present in the element description was created.
|
||||
//At save time, the values of each of them was save in the 'input' dom element.
|
||||
//The loop upper is made for the first case, to import the values in 'input' to the new converted dynamic texts field.
|
||||
//###Second case : this is not the first time the user open the project since text item are converted to dynamic text.
|
||||
//That mean, in a previous opening of the project, the text item was already converted and save as a dynamic text field.
|
||||
//So there isn't 'input' dom element in the project, and every dynamic text item present in m_converted_text_from_xml_description
|
||||
//need to be deleted (because already exist in m_dynamic_text_list, from a previous save)
|
||||
for (DynamicElementTextItem *deti : m_converted_text_from_xml_description.keys())
|
||||
delete deti;
|
||||
m_converted_text_from_xml_description.clear();
|
||||
|
||||
for (QDomElement qde : QET::findInDomElement(
|
||||
e,
|
||||
"texts_groups",
|
||||
@@ -970,27 +877,6 @@ bool Element::fromXml(
|
||||
DiagramContext dc;
|
||||
dc.fromXml(e.firstChildElement("elementInformations"),
|
||||
"elementInformation");
|
||||
/*
|
||||
* Since the commit 4791, the value used as "label" and "formula"
|
||||
* is stored in differents keys (instead of the same key,
|
||||
* "label" in previous version), so, if "label" contain "%"
|
||||
* (Use variable value), and "formula" does not exist,
|
||||
* this mean the label was made before commit 4791 (0.51 dev).
|
||||
* So we swap the value stored in "label" to "formula" as expected.
|
||||
* @TODO remove this code at version 0.7 or more (probably useless).
|
||||
*/
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO remove this code for qet 0.7 or later")
|
||||
#endif
|
||||
if (dc["label"].toString().contains("%")
|
||||
&& dc["formula"].toString().isNull())
|
||||
{
|
||||
dc.addValue("formula", dc["label"]);
|
||||
}
|
||||
//retrocompatibility with older version
|
||||
if(dc.value("label").toString().isEmpty() &&
|
||||
!m_data.m_informations.value("label").toString().isEmpty())
|
||||
dc.addValue("label", m_data.m_informations.value("label"));
|
||||
|
||||
//We must to block the update of the alignment when load the information
|
||||
//otherwise the pos of the text will not be the same as it was at save time.
|
||||
@@ -1000,181 +886,6 @@ bool Element::fromXml(
|
||||
for(DynamicElementTextItem *deti : m_dynamic_text_list)
|
||||
deti->m_block_alignment = false;
|
||||
|
||||
|
||||
/* During the devel of the version 0.7,
|
||||
* the "old text" was replaced by the dynamic element text item.
|
||||
* When open a project made befor the 0.7,
|
||||
* we must to reproduce the same visual when
|
||||
* the label are not empty and visible,
|
||||
* and comment are not empty
|
||||
* and visible and/or location are not empty and visible.
|
||||
* we create a text group with inside the needed texts,
|
||||
* label and comment and/or location.
|
||||
*/
|
||||
//#1 There must be old text converted to dynamic text
|
||||
if(!successfully_converted.isEmpty())
|
||||
{
|
||||
//#2 the element information must have label not empty and visible
|
||||
//and a least comment or location not empty and visible
|
||||
QString label = m_data.m_informations.value(
|
||||
"label").toString();
|
||||
QString comment = m_data.m_informations.value(
|
||||
"comment").toString();
|
||||
QString location = m_data.m_informations.value(
|
||||
"location").toString();
|
||||
bool la = m_data.m_informations.keyMustShow("label");
|
||||
bool c = m_data.m_informations.keyMustShow("comment");
|
||||
bool lo = m_data.m_informations.keyMustShow("location");
|
||||
|
||||
if((m_link_type != Master) ||
|
||||
((m_link_type == Master) &&
|
||||
(diagram()->project()->defaultXRefProperties(
|
||||
m_kind_informations["type"].toString()).snapTo()
|
||||
== XRefProperties::Label))
|
||||
)
|
||||
{
|
||||
if(!label.isEmpty() && la &&
|
||||
((!comment.isEmpty() && c)
|
||||
|| (!location.isEmpty() && lo)))
|
||||
{
|
||||
//#2 in the converted list one text must have text from = element info and info name = label
|
||||
for(DynamicElementTextItem *deti
|
||||
: successfully_converted)
|
||||
{
|
||||
if(deti->textFrom()== DynamicElementTextItem::ElementInfo
|
||||
&& deti->infoName() == "label")
|
||||
{
|
||||
qDebug() << "see 'Mod overlapping comparisons' in git";
|
||||
qreal rotation = deti->rotation();
|
||||
|
||||
//Create the comment item
|
||||
DynamicElementTextItem *comment_text = nullptr;
|
||||
if (m_link_type != PreviousReport
|
||||
&& m_link_type != NextReport)
|
||||
{
|
||||
m_state = QET::GIOK;
|
||||
return(true);
|
||||
}
|
||||
if(!comment.isEmpty() && c)
|
||||
{
|
||||
comment_text = new DynamicElementTextItem(this);
|
||||
comment_text->setTextFrom(DynamicElementTextItem::ElementInfo);
|
||||
comment_text->setInfoName("comment");
|
||||
QFont font = comment_text->font();
|
||||
font.setPointSize(6);
|
||||
comment_text->setFont(font);
|
||||
comment_text->setFrame(true);
|
||||
if(comment_text->toPlainText().count() > 17)
|
||||
comment_text->setTextWidth(80);
|
||||
comment_text->setPos(deti->x(), deti->y()+10); //+10 is arbitrary, comment_text must be below deti
|
||||
addDynamicTextItem(comment_text);
|
||||
}
|
||||
//create the location item
|
||||
DynamicElementTextItem *location_text = nullptr;
|
||||
if (m_link_type != PreviousReport
|
||||
&& m_link_type != NextReport)
|
||||
{
|
||||
m_state = QET::GIOK;
|
||||
return(true);
|
||||
}
|
||||
if(!location.isEmpty() && lo)
|
||||
{
|
||||
location_text = new DynamicElementTextItem(this);
|
||||
location_text->setTextFrom(DynamicElementTextItem::ElementInfo);
|
||||
location_text->setInfoName("location");
|
||||
QFont font = location_text->font();
|
||||
font.setPointSize(6);
|
||||
location_text->setFont(font);
|
||||
if(location_text->toPlainText().count() > 17)
|
||||
location_text->setTextWidth(80);
|
||||
location_text->setPos(deti->x(), deti->y()+20); //+20 is arbitrary, location_text must be below deti and comment
|
||||
addDynamicTextItem(location_text);
|
||||
}
|
||||
|
||||
QPointF pos = deti->pos();
|
||||
if (m_link_type != PreviousReport
|
||||
&& m_link_type != NextReport)
|
||||
{
|
||||
m_state = QET::GIOK;
|
||||
return(true);
|
||||
}
|
||||
//Create the group
|
||||
ElementTextItemGroup *group =
|
||||
addTextGroup(tr("Label + commentaire"));
|
||||
addTextToGroup(deti, group);
|
||||
if(comment_text)
|
||||
addTextToGroup(comment_text,
|
||||
group);
|
||||
if(location_text)
|
||||
addTextToGroup(location_text,
|
||||
group);
|
||||
group->setAlignment(Qt::AlignVCenter);
|
||||
group->setVerticalAdjustment(-4);
|
||||
group->setRotation(rotation);
|
||||
//Change the position of the group,
|
||||
//so that the text "label" stay in the same
|
||||
//position in scene coordinate
|
||||
group->setPos(pos - deti->pos());
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//This element is supposed to be a master and Xref property snap to bottom
|
||||
if((!comment.isEmpty() && c) || (!location.isEmpty() && lo))
|
||||
{
|
||||
//Create the comment item
|
||||
DynamicElementTextItem *comment_text = nullptr;
|
||||
if(!comment.isEmpty() && c)
|
||||
{
|
||||
comment_text = new DynamicElementTextItem(this);
|
||||
comment_text
|
||||
->setTextFrom(
|
||||
DynamicElementTextItem::ElementInfo);
|
||||
comment_text->setInfoName("comment");
|
||||
QFont font = comment_text->font();
|
||||
font.setPointSize(6);
|
||||
comment_text->setFont(font);
|
||||
comment_text->setFrame(true);
|
||||
comment_text->setTextWidth(80);
|
||||
addDynamicTextItem(comment_text);
|
||||
}
|
||||
//create the location item
|
||||
DynamicElementTextItem *location_text = nullptr;
|
||||
if(!location.isEmpty() && lo)
|
||||
{
|
||||
location_text = new DynamicElementTextItem(this);
|
||||
location_text
|
||||
->setTextFrom(
|
||||
DynamicElementTextItem::ElementInfo);
|
||||
location_text->setInfoName("location");
|
||||
QFont font = location_text->font();
|
||||
font.setPointSize(6);
|
||||
location_text->setFont(font);
|
||||
location_text->setTextWidth(80);
|
||||
if(comment_text)
|
||||
location_text->setPos(
|
||||
comment_text->x(),
|
||||
comment_text->y()+10); //+10 is arbitrary, location_text must be below the comment
|
||||
addDynamicTextItem(location_text);
|
||||
}
|
||||
|
||||
//Create the group
|
||||
ElementTextItemGroup *group =
|
||||
addTextGroup(tr("Label + commentaire"));
|
||||
if(comment_text)
|
||||
addTextToGroup(comment_text, group);
|
||||
if(location_text)
|
||||
addTextToGroup(location_text, group);
|
||||
group->setAlignment(Qt::AlignVCenter);
|
||||
group->setVerticalAdjustment(-4);
|
||||
group->setHoldToBottomPage(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_state = QET::GIOK;
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -196,18 +196,6 @@ class Element : public QetGraphicsItem // TODO: derive from propertiesInterface!
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *) override;
|
||||
|
||||
protected:
|
||||
// m_converted_text_from_description,
|
||||
// when a element is created from his description,
|
||||
// the old element text item (tagged as 'input' in the xml)
|
||||
// are converted to dynamic text field,
|
||||
// the QPointF is the original position of the text item,
|
||||
// because the origin transformation point of text item
|
||||
// and dynamic text item are not the same,
|
||||
// so we must to keep a track of this value,
|
||||
// to be use in the function element::fromXml
|
||||
QHash <DynamicElementTextItem *, QPointF>
|
||||
m_converted_text_from_xml_description;
|
||||
|
||||
//ATTRIBUTES related to linked element
|
||||
QList <Element *> connected_elements;
|
||||
QList <QUuid> tmp_uuids_link;
|
||||
|
||||
@@ -853,26 +853,8 @@ bool QetShapeItem::fromXml(const QDomElement &e)
|
||||
m_brush = QETXML::brushFromXml(e.firstChildElement("brush"));
|
||||
|
||||
QString type = e.attribute("type");
|
||||
#if TODO_LIST
|
||||
#pragma message("@TODO Compatibility for version older than N??4075, shape type was stored with an int")
|
||||
#endif
|
||||
//@TODO Compatibility for version older than N??4075, shape type was stored with an int
|
||||
if (type.size() == 1)
|
||||
{
|
||||
switch(e.attribute("type","0").toInt())
|
||||
{
|
||||
case 0: m_shapeType = Line; break;
|
||||
case 1: m_shapeType = Rectangle; break;
|
||||
case 2: m_shapeType = Ellipse; break;
|
||||
case 3: m_shapeType = Polygon; break;
|
||||
}
|
||||
}
|
||||
//For version after N??4075, shape is stored with a string
|
||||
else
|
||||
{
|
||||
QMetaEnum me = metaObject()->enumerator(metaObject()->indexOfEnumerator("ShapeType"));
|
||||
m_shapeType = QetShapeItem::ShapeType(me.keysToValue(type.toStdString().data()));
|
||||
}
|
||||
|
||||
if (m_shapeType != Polygon)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user