QCAD
Open Source 2D CAD
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:
59 
60 public:
61  RLinetype(RDocument* document=NULL);
62  RLinetype(RDocument* document, const RLinetypePattern& pattern);
63 
64  virtual ~RLinetype();
65 
66  static void init();
67 
68  virtual RLinetype* clone() const {
69  return new RLinetype(*this);
70  }
71 
72  QString getName() const {
73  return pattern.getName();
74  }
75 
76  void setName(const QString& n) {
77  pattern.setName(n);
78  }
79 
80  bool isMetric() const {
81  return pattern.isMetric();
82  }
83 
84  void setMetric(bool on) {
85  pattern.setMetric(on);
86  }
87 
88  QString getDescription() const {
89  return pattern.getDescription();
90  }
91 
92  void setDescription(const QString& d) {
93  pattern.setDescription(d);
94  }
95 
96  QString getLabel() const {
97  return pattern.getLabel();
98  }
99 
100  QString getPatternString() const {
101  return pattern.getPatternString();
102  }
103 
104  void setPatternString(const QString& s) {
105  pattern.setPatternString(s);
106  }
107 
108  bool isValid() const;
109 
110  virtual QPair<QVariant, RPropertyAttributes> getProperty(
111  RPropertyTypeId& propertyTypeId,
112  bool humanReadable = false, bool noAttributes = false);
113  virtual bool setProperty(RPropertyTypeId propertyTypeId,
114  const QVariant& value, RTransaction* transaction=NULL);
115 
116  virtual bool isSelectedForPropertyEditing();
117 
118  RLinetypePattern getPattern() const;
119  void setPattern(const RLinetypePattern& p);
120 
121  bool operator==(const RLinetype & linetype) const;
122  bool operator!=(const RLinetype & linetype) const;
123  bool operator<(const RLinetype & linetype) const;
124 
125  virtual void print(QDebug dbg) const;
126 
127 private:
129 };
130 
133 Q_DECLARE_METATYPE(QSharedPointer<RLinetype>)
134 Q_DECLARE_METATYPE(QSharedPointer<RLinetype>*)
135 typedef QPair<QString, RLinetype> _RPairStringRLinetype;
136 Q_DECLARE_METATYPE(_RPairStringRLinetype)
137 Q_DECLARE_METATYPE(QList< _RPairStringRLinetype >)
138 
139 #endif
void setName(const QString &n)
Definition: RLinetype.h:76
QString getPatternString() const
Definition: RLinetype.h:100
void setDescription(const QString &d)
Definition: RLinetype.h:92
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: RObject.cpp:101
Abstract base class for all objects.
Definition: RObject.h:48
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
#define QCADCORE_EXPORT
Definition: core_global.h:10
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: RObject.cpp:67
QString getName() const
Definition: RLinetype.h:72
Transaction implementation.
Definition: RTransaction.h:70
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RLinetypePattern.h:45
virtual RLinetype * clone() const
Definition: RLinetype.h:68
static RPropertyTypeId PropertyName
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RLinetype.h:55
QPair< QString, RLinetype > _RPairStringRLinetype
Definition: RLinetype.h:135
void setMetric(bool on)
Definition: RLinetype.h:84
RLinetypePattern pattern
Definition: RLinetype.h:128
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
Q_DECLARE_METATYPE(RMath *)
bool operator<(const RPainterPath &p1, const RPainterPath &p2)
This operator allows us to sort painter paths based on z-level.
Definition: RPainterPath.cpp:498
static RPropertyTypeId PropertyPatternString
Definition: RLinetype.h:58
static RPropertyTypeId PropertyDescription
Definition: RLinetype.h:56
void setPatternString(const QString &s)
Definition: RLinetype.h:104
QString getDescription() const
Definition: RLinetype.h:88
Represents a linetype in a drawing.
Definition: RLinetype.h:50
static void init()
Definition: RObject.cpp:35
static RPropertyTypeId PropertyMetric
Definition: RLinetype.h:57
virtual bool isSelectedForPropertyEditing()=0
QString getLabel() const
Definition: RLinetype.h:96
bool isMetric() const
Definition: RLinetype.h:80
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: RObject.cpp:441