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:
@@ -1,19 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006-2020 QElectroTech Team
|
Copyright 2006-2020 QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
|
|
||||||
QElectroTech is free software: you can redistribute it and/or modify
|
QElectroTech is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
QElectroTech is distributed in the hope that it will be useful,
|
QElectroTech is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "nomenclaturemodel.h"
|
#include "nomenclaturemodel.h"
|
||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
@@ -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