QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RView.h
Go to the documentation of this file.
1 
20 #ifndef RVIEW_H
21 #define RVIEW_H
22 
23 #include "core_global.h"
24 
25 #include <QString>
26 #include <QColor>
27 #include <QDebug>
28 
29 #include "RGlobal.h"
30 #include "RObject.h"
31 #include "RBox.h"
32 
33 class RDocument;
34 
42 class QCADCORE_EXPORT RView: public RObject {
43 public:
48 
49 public:
50  RView();
51 
52  RView(RDocument* document, const QString& name, RVector centerPoint,
53  double width, double height);
54 
55  virtual ~RView();
56 
57  static void init();
58 
59  virtual RView* clone() const;
60 
61  QString getName() const {
62  return name;
63  }
64 
65  void setName(const QString& n) {
66  name = n;
67  }
68 
70  return centerPoint;
71  }
72 
73  void setCenterPoint(const RVector& cPoint) {
74  centerPoint = cPoint;
75  }
76 
77  double getWidth() const {
78  return width;
79  }
80 
81  void setWidth(double w) {
82  width = w;
83  }
84 
85  double getHeight() const {
86  return height;
87  }
88 
89  void setHeight(double h) {
90  height = h;
91  }
92 
94  return RBox(centerPoint - RVector(width, height) / 2, centerPoint
95  + RVector(width, height) / 2);
96  }
97 
98  virtual QPair<QVariant, RPropertyAttributes> getProperty(
99  RPropertyTypeId& propertyTypeId,
100  bool humanReadable = false, bool noAttributes = false);
101  virtual bool setProperty(RPropertyTypeId propertyTypeId,
102  const QVariant& value, RTransaction* transaction=NULL);
103 
104  virtual bool isSelectedForPropertyEditing();
105 
106 private:
107  QString name;
109  double width;
110  double height;
111 };
112 
113 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RView& v);
114 
115 Q_DECLARE_METATYPE(QSharedPointer<RView>)
116 Q_DECLARE_METATYPE(QSharedPointer<RView>*)
119 
120 #endif