QElectroTech  0.70
diagramcontext.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 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 <QDomElement>
21 #include <QHash>
22 #include <QSettings>
23 #include <QString>
24 #include <QVariant>
25 #include <QStringList>
54 {
55  public:
56  enum KeyOrder {
60  };
61 
62  void add(DiagramContext other);
63  QList<QString> keys(KeyOrder = None) const;
64  bool contains(const QString &) const;
65  const QVariant operator[](const QString &) const;
66  bool addValue(const QString &, const QVariant &, bool show = true);
67  QVariant value(const QString &key) const;
68  void clear();
69  int count();
70  bool keyMustShow (const QString &) const;
71 
72  bool operator==(const DiagramContext &) const;
73  bool operator!=(const DiagramContext &) const;
74 
75  void toXml(QDomElement &, const QString & = "property") const;
76  void fromXml(const QDomElement &, const QString & = "property");
77  void toSettings(QSettings &, const QString &) const;
78  void fromSettings(QSettings &, const QString &);
79 
80  static QString validKeyRegExp();
81 
82  private:
83  static bool stringLongerThan(const QString &, const QString &);
84  bool keyIsAcceptable(const QString &) const;
86  QHash<QString, QVariant> m_content;
87  QHash<QString, bool> m_content_show;
88 };
89 #endif
void fromSettings(QSettings &, const QString &)
static bool stringLongerThan(const QString &, const QString &)
QHash< QString, QVariant > m_content
Diagram context data (key/value pairs)
void add(DiagramContext other)
DiagramContext::add Add all value of to this. If a key already exist, the value is replaced...
void toSettings(QSettings &, const QString &) const
bool operator!=(const DiagramContext &) const
QVariant value(const QString &key) const
QHash< QString, bool > m_content_show
bool addValue(const QString &, const QVariant &, bool show=true)
QList< QString > keys(KeyOrder=None) const
bool contains(const QString &) const
void fromXml(const QDomElement &, const QString &="property")
const QVariant operator[](const QString &) const
void toXml(QDomElement &, const QString &="property") const
bool keyMustShow(const QString &) const
DiagramContext::keyMustShow.
bool keyIsAcceptable(const QString &) const
static QString validKeyRegExp()
bool operator==(const DiagramContext &) const