mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 08:10:52 +01:00
- AlignBottom shoud be the default
- move inital values to header file
This commit is contained in:
@@ -25,14 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
XRefProperties::XRefProperties()
|
XRefProperties::XRefProperties()
|
||||||
{
|
{
|
||||||
m_show_power_ctc = true;
|
|
||||||
m_display = Cross;
|
|
||||||
m_snap_to = Bottom;
|
|
||||||
m_prefix_keys << "power" << "delay" << "switch";
|
|
||||||
m_master_label = "%f-%l%c";
|
|
||||||
m_slave_label = "(%f-%l%c)";
|
|
||||||
m_offset = 0;
|
|
||||||
m_xref_pos = Qt::AlignBottom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,27 +119,28 @@ bool XRefProperties::fromXml(const QDomElement &xml_element) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
QString display;
|
QString display;
|
||||||
propertyString(xml_element, "displayhas", &display, true, "cross");
|
if (propertyString(xml_element, "displayhas", &display) != PropertyFlags::NotFound) {
|
||||||
display == "cross"? m_display = Cross : m_display = Contacts;
|
display == "cross"? m_display = Cross : m_display = Contacts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString snap;
|
QString snap;
|
||||||
propertyString(xml_element, "snapto", &snap, true, "label");
|
if (propertyString(xml_element, "snapto", &snap) != PropertyFlags::NotFound) {
|
||||||
snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label;
|
snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label;
|
||||||
|
}
|
||||||
|
|
||||||
QString xrefpos;
|
QString xrefpos;
|
||||||
if (propertyString(xml_element, "xrefpos", &xrefpos, true, "Left") == PropertyFlags::NotFound) {
|
if (propertyString(xml_element, "xrefpos", &xrefpos) != PropertyFlags::NotFound) {
|
||||||
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
|
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
|
||||||
m_xref_pos = Qt::AlignmentFlag(var.keyToValue(xrefpos.toStdString().data()));
|
m_xref_pos = Qt::AlignmentFlag(var.keyToValue(xrefpos.toStdString().data()));
|
||||||
} else
|
}
|
||||||
m_xref_pos = Qt::AlignBottom;
|
|
||||||
// TODO: why it compiles without this true??
|
// TODO: why it compiles without this true??
|
||||||
propertyInteger(xml_element, "offset", &m_offset, true, 0);
|
propertyInteger(xml_element, "offset", &m_offset);
|
||||||
propertyString(xml_element, "master_label", &m_master_label, true, "%f-%l%c");
|
propertyString(xml_element, "master_label", &m_master_label);
|
||||||
propertyString(xml_element, "slave_label", &m_slave_label, true, "(%f-%l%c)");
|
propertyString(xml_element, "slave_label", &m_slave_label);
|
||||||
QString value;
|
QString value;
|
||||||
foreach (QString key, m_prefix_keys) {
|
foreach (QString key, m_prefix_keys) {
|
||||||
propertyString(xml_element, key + "prefix", &value);
|
if (!propertyString(xml_element, key + "prefix", &value));
|
||||||
m_prefix.insert(key, value);
|
m_prefix.insert(key, value);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -76,15 +76,15 @@ class XRefProperties : public PropertiesInterface
|
|||||||
void setKey(QString& key) {m_key = key;}
|
void setKey(QString& key) {m_key = key;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_show_power_ctc;
|
bool m_show_power_ctc{true};
|
||||||
DisplayHas m_display;
|
DisplayHas m_display{Cross};
|
||||||
SnapTo m_snap_to;
|
SnapTo m_snap_to{Bottom};
|
||||||
Qt::AlignmentFlag m_xref_pos;
|
Qt::AlignmentFlag m_xref_pos{Qt::AlignBottom};
|
||||||
QHash <QString, QString> m_prefix;
|
QHash <QString, QString> m_prefix;
|
||||||
QStringList m_prefix_keys;
|
QStringList m_prefix_keys{"power","delay","switch"};
|
||||||
QString m_master_label;
|
QString m_master_label{"%f-%l%c"};
|
||||||
QString m_slave_label;
|
QString m_slave_label{"(%f-%l%c)"};
|
||||||
int m_offset;
|
int m_offset{0};
|
||||||
QString m_key;
|
QString m_key;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user