mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Nomenclature model don't save header data "display role"
The model doesn't save anymore the header data with role Qt::displayRole. The header display role is now generated in the fly, by concequent the header displayed texts are always in the current local
This commit is contained in:
@@ -238,8 +238,14 @@ QDomElement NomenclatureModel::toXml(QDomDocument &document) const
|
|||||||
|
|
||||||
//header data
|
//header data
|
||||||
QHash<int, QList<int>> horizontal_;
|
QHash<int, QList<int>> horizontal_;
|
||||||
for (auto key : m_header_data.keys()) {
|
for (auto key : m_header_data.keys())
|
||||||
horizontal_.insert(key, m_header_data.value(key).keys()); }
|
{
|
||||||
|
//We save all data except the display role, because he was generated in the fly
|
||||||
|
auto list = m_header_data.value(key).keys();
|
||||||
|
list.removeAll(Qt::DisplayRole);
|
||||||
|
|
||||||
|
horizontal_.insert(key, list);
|
||||||
|
}
|
||||||
|
|
||||||
dom_element.appendChild(QETXML::modelHeaderDataToXml(document, this, horizontal_, QHash<int, QList<int>>()));
|
dom_element.appendChild(QETXML::modelHeaderDataToXml(document, this, horizontal_, QHash<int, QList<int>>()));
|
||||||
|
|
||||||
@@ -257,6 +263,7 @@ void NomenclatureModel::fromXml(const QDomElement &element)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
query(element.firstChildElement("query").text());
|
query(element.firstChildElement("query").text());
|
||||||
|
autoHeaders();
|
||||||
|
|
||||||
//Index 0,0
|
//Index 0,0
|
||||||
auto index_00 = element.firstChildElement("index00");
|
auto index_00 = element.firstChildElement("index00");
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class NomenclatureModel : public QAbstractTableModel
|
|||||||
QPointer<QETProject> m_project;
|
QPointer<QETProject> m_project;
|
||||||
QString m_query;
|
QString m_query;
|
||||||
QVector<QStringList> m_record;
|
QVector<QStringList> m_record;
|
||||||
QHash<int, QHash<int, QVariant>> m_header_data;
|
QHash<int, QHash<int, QVariant>> m_header_data; //First int = section, second int = Qt::role, QVariant = value
|
||||||
QHash<int, QVariant> m_index_0_0_data;
|
QHash<int, QVariant> m_index_0_0_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user