mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 08:10:52 +01:00
go on with the work
This commit is contained in:
@@ -183,12 +183,17 @@ bool PartDynamicTextField::fromXml(const QDomElement &dom_elmt)
|
||||
}
|
||||
|
||||
propertyUuid(dom_elmt, "uuid", &m_uuid, QUuid::createUuid());
|
||||
m_uuid = QUuid(dom_elmt.attribute("uuid", QUuid::createUuid().toString()));
|
||||
setFrame(dom_elmt.attribute("frame", "false") == "true"? true : false);
|
||||
setTextWidth(dom_elmt.attribute("text_width", QString::number(-1)).toDouble());
|
||||
bool frame;
|
||||
propertyBool(dom_elmt, "frame", &frame);
|
||||
|
||||
double text_width;
|
||||
propertyDouble(dom_elmt, "text_width", &text_width, -1);
|
||||
setTextWidth(text_width);
|
||||
|
||||
QMetaEnum me = DynamicElementTextItem::textFromMetaEnum();
|
||||
m_text_from = DynamicElementTextItem::TextFrom(me.keyToValue(dom_elmt.attribute("text_from").toStdString().data()));
|
||||
QString text_from;
|
||||
propertyString(dom_elmt, "text_from", &text_from);
|
||||
m_text_from = DynamicElementTextItem::TextFrom(me.keyToValue(text_from.toStdString().data()));
|
||||
|
||||
me = QMetaEnum::fromType<Qt::Alignment>();
|
||||
QString alignment;
|
||||
@@ -223,6 +228,27 @@ bool PartDynamicTextField::fromXml(const QDomElement &dom_elmt)
|
||||
setColor(QColor(dom_color.text()));
|
||||
}
|
||||
|
||||
bool PartDynamicTextField::valideXml(QDomElement& dom_elmt) {
|
||||
if (propertyDouble(dom_elmt, "x") == PropertyFlags::NoValidConversion ||
|
||||
propertyDouble(dom_elmt, "y") == PropertyFlags::NoValidConversion ||
|
||||
propertyDouble(dom_elmt, "z") == PropertyFlags::NoValidConversion ||
|
||||
propertyDouble(dom_elmt, "rotation") == PropertyFlags::NoValidConversion)
|
||||
return false;
|
||||
|
||||
if (propertyUuid(dom_elmt, "uuid") == PropertyFlags::NoValidConversion)
|
||||
return false;
|
||||
|
||||
if (propertyString(dom_elmt, "text_from"))
|
||||
return false;
|
||||
|
||||
if(propertyString(dom_elmt, "Halignment") == PropertyFlags::NotFound)
|
||||
return false;
|
||||
if(propertyString(dom_elmt, "Valignment") == PropertyFlags::NotFound)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief PartDynamicTextField::fromTextFieldXml
|
||||
* Setup this text from the xml definition of a text field (The xml tagg of a text field is "input");
|
||||
|
||||
Reference in New Issue
Block a user