2020-04-17 18:40:28 +02:00
|
|
|
|
/*
|
2020-08-16 09:40:14 +02:00
|
|
|
|
Copyright 2006-2020 The QElectroTech Team
|
|
|
|
|
This file is part of QElectroTech.
|
2016-01-03 13:45:30 +00:00
|
|
|
|
|
2020-08-16 09:40:14 +02:00
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
2016-01-03 13:45:30 +00:00
|
|
|
|
|
2020-08-16 09:40:14 +02:00
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2016-01-03 13:45:30 +00:00
|
|
|
|
|
2020-08-16 09:40:14 +02:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
2016-01-03 13:45:30 +00:00
|
|
|
|
*/
|
|
|
|
|
#ifndef QETXML_H
|
|
|
|
|
#define QETXML_H
|
|
|
|
|
|
2016-01-08 17:44:55 +00:00
|
|
|
|
#include <QDomElement>
|
2016-01-03 13:45:30 +00:00
|
|
|
|
#include <QPen>
|
|
|
|
|
|
2016-01-08 17:44:55 +00:00
|
|
|
|
class QDomDocument;
|
|
|
|
|
class QDir;
|
|
|
|
|
class QFile;
|
2020-04-17 18:40:28 +02:00
|
|
|
|
class QAbstractItemModel;
|
2016-01-08 17:44:55 +00:00
|
|
|
|
|
2016-01-03 13:45:30 +00:00
|
|
|
|
/**
|
|
|
|
|
*This namespace contain some function to use xml with QET.
|
2020-08-16 11:19:36 +02:00
|
|
|
|
*/
|
2016-01-03 13:45:30 +00:00
|
|
|
|
namespace QETXML
|
|
|
|
|
{
|
2020-07-17 22:32:30 +02:00
|
|
|
|
QDomElement penToXml(QDomDocument &parent_document, const QPen& pen);
|
|
|
|
|
QPen penFromXml (const QDomElement &element);
|
2016-01-03 13:45:30 +00:00
|
|
|
|
|
2020-09-07 22:03:40 +02:00
|
|
|
|
QDomElement brushToXml (
|
|
|
|
|
QDomDocument &parent_document,
|
|
|
|
|
const QBrush& brush);
|
|
|
|
|
|
2016-01-12 14:02:34 +00:00
|
|
|
|
QBrush brushFromXml (const QDomElement &element);
|
|
|
|
|
|
2020-07-17 22:32:30 +02:00
|
|
|
|
QDomElement fileSystemDirToXmlCollectionDir (
|
|
|
|
|
QDomDocument &document,
|
|
|
|
|
const QDir &dir,
|
|
|
|
|
const QString& rename = QString());
|
2020-09-07 22:03:40 +02:00
|
|
|
|
|
2020-07-17 22:32:30 +02:00
|
|
|
|
QDomElement fileSystemElementToXmlCollectionElement (
|
|
|
|
|
QDomDocument &document,
|
|
|
|
|
QFile &file,
|
|
|
|
|
const QString& rename = QString());
|
2016-01-08 17:44:55 +00:00
|
|
|
|
|
2020-09-07 22:03:40 +02:00
|
|
|
|
bool writeXmlFile(
|
|
|
|
|
const QDomDocument &xml_document,
|
|
|
|
|
const QString &file_path,
|
|
|
|
|
QString *error_message = nullptr);
|
|
|
|
|
|
|
|
|
|
QDomElement textToDomElement (
|
|
|
|
|
QDomDocument &document,
|
|
|
|
|
const QString& tag_name,
|
|
|
|
|
const QString& value);
|
|
|
|
|
|
|
|
|
|
QVector <QDomElement> directChild(
|
|
|
|
|
const QDomElement &element,
|
|
|
|
|
const QString &tag_name);
|
2016-03-31 17:28:44 +00:00
|
|
|
|
|
2020-09-07 22:03:40 +02:00
|
|
|
|
QVector <QDomElement> subChild(
|
|
|
|
|
const QDomElement &element,
|
|
|
|
|
const QString parent_tag_name,
|
|
|
|
|
const QString &children_tag_name);
|
2020-04-17 18:40:28 +02:00
|
|
|
|
|
2020-09-07 22:03:40 +02:00
|
|
|
|
QDomElement marginsToXml (
|
|
|
|
|
QDomDocument &parent_document,
|
|
|
|
|
const QMargins &margins);
|
2020-04-17 18:40:28 +02:00
|
|
|
|
|
|
|
|
|
QMargins marginsFromXml(const QDomElement &element);
|
|
|
|
|
|
2020-09-07 22:03:40 +02:00
|
|
|
|
QDomElement modelHeaderDataToXml(
|
|
|
|
|
QDomDocument &parent_document,
|
|
|
|
|
const QAbstractItemModel *model,
|
|
|
|
|
QHash<int,
|
|
|
|
|
QList<int>> horizontal_section_role,
|
|
|
|
|
QHash<int,
|
|
|
|
|
QList<int>> vertical_section_role);
|
|
|
|
|
|
|
|
|
|
void modelHeaderDataFromXml(
|
|
|
|
|
const QDomElement &element,
|
|
|
|
|
QAbstractItemModel *model);
|
2016-01-03 13:45:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // QETXML_H
|