QCAD
Open Source 2D CAD
RGraphicsSceneDrawable.h
Go to the documentation of this file.
1 
20 #ifndef RGRAPHICSSCENEDRAWABLE_H
21 #define RGRAPHICSSCENEDRAWABLE_H
22 
23 #include "gui_global.h"
24 
25 #include "RPainterPath.h"
26 #include "RImageData.h"
27 #include "RTextBasedData.h"
28 
34 public:
35  enum Type {
40  };
41 
42  RGraphicsSceneDrawable() : type(Invalid), painterPath(NULL), image(NULL), text(NULL) {}
44 
49 
54 
59 
61 
62  static RGraphicsSceneDrawable createFromPainterPath(const RPainterPath& pp, const RVector& offset = RVector::nullVector);
63  static RGraphicsSceneDrawable createFromImage(const RImageData& img, const RVector& offset = RVector::nullVector);
64  static RGraphicsSceneDrawable createFromText(const RTextBasedData& txt, const RVector& offset = RVector::nullVector);
65 
66  void uninit();
67 
69  return type;
70  }
71 
73  Q_ASSERT(painterPath!=NULL);
74  return *painterPath;
75  }
76 
77  RImageData& getImage() const {
78  Q_ASSERT(image!=NULL);
79  return *image;
80  }
81 
83  Q_ASSERT(text!=NULL);
84  return *text;
85  }
86 
87  RVector getOffset() const {
88  return offset;
89  }
90 
91  void setOffset(const RVector& o) {
92  offset = o;
93  }
94 
95  void setSelected(bool on);
96  void setHighlighted(bool on);
97 
98  RGraphicsSceneDrawable& operator=(const RGraphicsSceneDrawable& other);
99 
100 protected:
103 
104  //union {
108  //};
109 };
110 
111 QCADGUI_EXPORT QDebug operator<<(QDebug dbg, const RGraphicsSceneDrawable& d);
112 
116 
117 #endif
Insert text.
Definition: Text.js:18
RVector offset
Definition: RGraphicsSceneDrawable.h:102
RTextBasedData * text
Definition: RGraphicsSceneDrawable.h:107
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define QCADGUI_EXPORT
Definition: gui_global.h:10
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RGraphicsSceneDrawable.h:33
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RImageData.h:41
RPainterPath * painterPath
Definition: RGraphicsSceneDrawable.h:105
RTextBasedData & getText() const
Definition: RGraphicsSceneDrawable.h:82
Type type
Definition: RGraphicsSceneDrawable.h:101
void setOffset(const RVector &o)
Definition: RGraphicsSceneDrawable.h:91
Stores and manages all data that defines the geometry and appearance of a text based entity (text...
Definition: RTextBasedData.h:44
RGraphicsSceneDrawable()
Definition: RGraphicsSceneDrawable.h:42
Definition: RGraphicsSceneDrawable.h:36
Q_DECLARE_METATYPE(RMath *)
RVector getOffset() const
Definition: RGraphicsSceneDrawable.h:87
Extended painter path with a z-level and a pen.
Definition: RPainterPath.h:46
static const RVector nullVector
null vector
Definition: RVector.h:322
RGraphicsSceneDrawable::Type getType() const
Definition: RGraphicsSceneDrawable.h:68
QCADGUI_EXPORT QDebug operator<<(QDebug dbg, const RGraphicsSceneDrawable &d)
Definition: RGraphicsSceneDrawable.cpp:104
Type
Definition: RGraphicsSceneDrawable.h:35
Definition: RGraphicsSceneDrawable.h:37
RPainterPath & getPainterPath() const
Definition: RGraphicsSceneDrawable.h:72
Definition: RGraphicsSceneDrawable.h:38
RImageData & getImage() const
Definition: RGraphicsSceneDrawable.h:77
RImageData * image
Definition: RGraphicsSceneDrawable.h:106