QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RLinetype.h
Go to the documentation of this file.
1 
20 #ifndef RLINETYPE_H
21 #define RLINETYPE_H
22 
23 #include "core_global.h"
24 
25 #include <QColor>
26 #include <QCoreApplication>
27 #include <QIcon>
28 #include <QMetaType>
29 #include <QString>
30 
31 #include "RLinetypePattern.h"
32 #include "RObject.h"
33 #include "RPropertyTypeId.h"
34 #include "RVector.h"
35 
36 class RDocument;
37 class RTransaction;
38 
39 
40 
51 
52  Q_DECLARE_TR_FUNCTIONS(RLinetype);
53 
54 public:
56 
57 public:
58  RLinetype(RDocument* document=NULL);
59  RLinetype(RDocument* document, const QString& name);
60 
61  virtual ~RLinetype();
62 
63  static void init();
64 
65  virtual RLinetype* clone() const {
66  return new RLinetype(*this);
67  }
68 
69  QString getName() const {
70  return name;
71  }
72 
73  void setName(const QString& n) {
74  name = n;
75  }
76 
77  bool isValid() const;
78 
79  static QList<QPair<QString, RLinetype> > getList(bool onlyFixed = false);
80 
81  virtual QPair<QVariant, RPropertyAttributes> getProperty(
82  RPropertyTypeId& propertyTypeId,
83  bool humanReadable = false, bool noAttributes = false);
84  virtual bool setProperty(RPropertyTypeId propertyTypeId,
85  const QVariant& value, RTransaction* transaction=NULL);
86 
87  virtual bool isSelectedForPropertyEditing();
88 
89  static QIcon getIcon(const RLinetype& linetype);
90  static QString getTitle(const RLinetype& linetype);
91 
92  bool operator==(const RLinetype & linetype) const;
93  bool operator!=(const RLinetype & linetype) const;
94  bool operator<(const RLinetype & linetype) const;
95 
96 private:
97  static void init(const QString& cn, const RLinetype& c);
98 
99 private:
100  QString name;
101  static QList<QPair<QString, RLinetype> > list;
102  static QMap<RLinetype, QIcon> iconMap;
103 };
104 
105 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RLinetype& l);
106 
109 Q_DECLARE_METATYPE(QSharedPointer<RLinetype>)
110 Q_DECLARE_METATYPE(QSharedPointer<RLinetype>*)
111 typedef QPair<QString, RLinetype> _RPairStringRLinetype;
112 Q_DECLARE_METATYPE(_RPairStringRLinetype)
113 Q_DECLARE_METATYPE(QList< _RPairStringRLinetype >)
114 
115 #endif