QElectroTech  0.8-dev
qetxml.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef QETXML_H
19 #define QETXML_H
20 
21 #include <QDomElement>
22 #include <QPen>
23 
24 class QDomDocument;
25 class QDir;
26 class QFile;
27 class QAbstractItemModel;
28 
32 namespace QETXML
33 {
34  QDomElement penToXml(QDomDocument &parent_document, const QPen& pen);
35  QPen penFromXml (const QDomElement &element);
36 
37  QDomElement brushToXml (QDomDocument &parent_document,
38  const QBrush& brush);
39  QBrush brushFromXml (const QDomElement &element);
40 
42  QDomDocument &document,
43  const QDir &dir,
44  const QString& rename = QString());
46  QDomDocument &document,
47  QFile &file,
48  const QString& rename = QString());
49 
50  bool writeXmlFile(const QDomDocument &xml_document,
51  const QString &file_path,
52  QString *error_message = nullptr);
53 
54  QDomElement textToDomElement (QDomDocument &document,
55  const QString& tag_name,
56  const QString& value);
57 
58  QVector <QDomElement> directChild(const QDomElement &element,
59  const QString &tag_name);
60  QVector <QDomElement> subChild(const QDomElement &element,
61  const QString parent_tag_name,
62  const QString &children_tag_name);
63 
64  QDomElement marginsToXml (QDomDocument &parent_document,
65  const QMargins &margins);
66  QMargins marginsFromXml(const QDomElement &element);
67 
68  QDomElement modelHeaderDataToXml(QDomDocument &parent_document,
69  const QAbstractItemModel *model,
70  QHash<int,
71  QList<int>> horizontal_section_role,
72  QHash<int,
73  QList<int>> vertical_section_role);
74  void modelHeaderDataFromXml(const QDomElement &element,
75  QAbstractItemModel *model);
76 }
77 
78 #endif // QETXML_H
QETXML::modelHeaderDataFromXml
void modelHeaderDataFromXml(const QDomElement &element, QAbstractItemModel *model)
QETXML::modelHeaderDataFromXml Restore from xml modele header data.
Definition: qetxml.cpp:501
QETXML::marginsToXml
QDomElement marginsToXml(QDomDocument &parent_document, const QMargins &margins)
QETXML::marginsToXml Save a QMargins to xml. the xml tag name is 'margins'.
Definition: qetxml.cpp:377
nameslist.h
QET::Icons::nl
QIcon nl
Definition: qeticons.cpp:203
QETXML::brushFromXml
QBrush brushFromXml(const QDomElement &element)
QETXML::brushFromXml Build a QBrush from a xml description.
Definition: qetxml.cpp:135
QETXML::marginsFromXml
QMargins marginsFromXml(const QDomElement &element)
QETXML::marginsFromXml.
Definition: qetxml.cpp:399
QETXML::brushToXml
QDomElement brushToXml(QDomDocument &parent_document, const QBrush &brush)
QETXML::brushToXml Write attribute of a QBrush in xml element.
Definition: qetxml.cpp:97
QETXML::penToXml
QDomElement penToXml(QDomDocument &parent_document, const QPen &pen)
QETXML::penToXml Write attribute of a QPen in xml element.
Definition: qetxml.cpp:33
QETXML::writeXmlFile
bool writeXmlFile(const QDomDocument &xml_document, const QString &file_path, QString *error_message=nullptr)
QETXML::writeXmlFile Export an XML document to an UTF-8 text file indented with 4 spaces,...
Definition: qetxml.cpp:257
QETXML::textToDomElement
QDomElement textToDomElement(QDomDocument &document, const QString &tag_name, const QString &value)
QETXML::textToDomElement Return a QDomElement, created from document, with tag name tag_name and text...
Definition: qetxml.cpp:296
QETXML::subChild
QVector< QDomElement > subChild(const QDomElement &element, const QString parent_tag_name, const QString &children_tag_name)
QETXML::subChild.
Definition: qetxml.cpp:341
QETXML::fileSystemElementToXmlCollectionElement
QDomElement fileSystemElementToXmlCollectionElement(QDomDocument &document, QFile &file, const QString &rename=QString())
Definition: qetxml.cpp:220
QETXML::directChild
QVector< QDomElement > directChild(const QDomElement &element, const QString &tag_name)
QETXML::directChild.
Definition: qetxml.cpp:313
QETXML::penFromXml
QPen penFromXml(const QDomElement &element)
QETXML::penFromXml Build a QPen from a xml description.
Definition: qetxml.cpp:62
NamesList
Definition: nameslist.h:30
QETXML::modelHeaderDataToXml
QDomElement modelHeaderDataToXml(QDomDocument &parent_document, const QAbstractItemModel *model, QHash< int, QList< int >> horizontal_section_role, QHash< int, QList< int >> vertical_section_role)
QETXML::modelHeaderDataToXml Save to xml element all header data specified by horizontal_section_role...
Definition: qetxml.cpp:429
QETXML
Definition: qetxml.h:33
QETXML::fileSystemDirToXmlCollectionDir
QDomElement fileSystemDirToXmlCollectionDir(QDomDocument &document, const QDir &dir, const QString &rename=QString())
Definition: qetxml.cpp:175
QET::Vertical
@ Vertical
Vertical segment.
Definition: qet.h:90
qetxml.h
QET::Horizontal
@ Horizontal
Horizontal segment.
Definition: qet.h:89
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206