QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
diagramcontext.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 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 DIAGRAM_CONTEXT_H
19#define DIAGRAM_CONTEXT_H
20#include "pugixml/src/pugixml.hpp"
21
22#include <QDomElement>
23#include <QHash>
24#include <QSettings>
25#include <QString>
26#include <QStringList>
27#include <QVariant>
34
92{
93 public:
99
100 void add(DiagramContext other);
101 void remove(const QString &key);
102 QList<QString> keys(KeyOrder = Alphabetical) const;
103 bool contains(const QString &) const;
104 const QVariant operator[](const QString &) const;
105 bool addValue(const QString &, const QVariant &, bool show = true);
106 QVariant value(const QString &key) const;
107 void clear();
108 int count();
109 bool keyMustShow (const QString &) const;
110
111 bool operator==(const DiagramContext &) const;
112 bool operator!=(const DiagramContext &) const;
113
114 void toXml(QDomElement &, const QString & = "property") const;
115 void fromXml(const QDomElement &, const QString & = "property");
116 void fromXml(const pugi::xml_node &dom_element, const QString &tag_name = "property");
117 void toSettings(QSettings &, const QString &) const;
118 void fromSettings(QSettings &, const QString &);
119
120 static bool isKeyAcceptable(const QString &);
121
122 private:
123 static bool stringLongerThan(const QString &, const QString &);
124 static QString validKeyRegExp();
125
127 QHash<QString, QVariant> m_content;
128 QHash<QString, bool> m_content_show;
129};
130
131QDebug operator <<(QDebug debug, const DiagramContext &context);
132#endif
Definition diagramcontext.h:92
static QString validKeyRegExp()
Definition diagramcontext.cpp:234
bool contains(const QString &) const
Definition diagramcontext.cpp:71
QHash< QString, bool > m_content_show
Definition diagramcontext.h:128
bool keyMustShow(const QString &) const
DiagramContext::keyMustShow.
Definition diagramcontext.cpp:129
QHash< QString, QVariant > m_content
Diagram context data (key/value pairs).
Definition diagramcontext.h:127
void toXml(QDomElement &, const QString &="property") const
Definition diagramcontext.cpp:151
void fromSettings(QSettings &, const QString &)
Definition diagramcontext.cpp:219
bool addValue(const QString &, const QVariant &, bool show=true)
Definition diagramcontext.cpp:94
QList< QString > keys(KeyOrder=Alphabetical) const
Definition diagramcontext.cpp:50
void toSettings(QSettings &, const QString &) const
Definition diagramcontext.cpp:202
void clear()
Definition diagramcontext.cpp:111
KeyOrder
Definition diagramcontext.h:94
@ Alphabetical
Definition diagramcontext.h:96
@ None
Definition diagramcontext.h:95
@ DecreasingLength
Definition diagramcontext.h:97
void remove(const QString &key)
DiagramContext::remove.
Definition diagramcontext.cpp:43
void fromXml(const QDomElement &, const QString &="property")
Definition diagramcontext.cpp:174
static bool isKeyAcceptable(const QString &)
Definition diagramcontext.cpp:250
const QVariant operator[](const QString &) const
Definition diagramcontext.cpp:79
bool operator==(const DiagramContext &) const
Definition diagramcontext.cpp:136
QVariant value(const QString &key) const
Definition diagramcontext.cpp:103
bool operator!=(const DiagramContext &) const
Definition diagramcontext.cpp:142
static bool stringLongerThan(const QString &, const QString &)
Definition diagramcontext.cpp:242
void add(DiagramContext other)
DiagramContext::add Add all value of other to this. If a key already exist, the value is replaced....
Definition diagramcontext.cpp:32
int count()
Definition diagramcontext.cpp:120
QDebug operator<<(QDebug debug, const DiagramContext &context)
Definition diagramcontext.cpp:258