Laser Cutter application v1.0

svglabel.h
Go to the documentation of this file.
1 #ifndef SVGLABEL_H
2 #define SVGLABEL_H
3
4 #include <QWidget>
5 #include <QLabel>
6
7 #include <QMouseEvent>
8 #include <qmath.h>
9 #include <QtXml>
10
11 #include <opencv2/core/core.hpp>
12
17 class SvgLabel : public QLabel
18 {
19 Q_OBJECT
20 public:
21 explicit SvgLabel(QWidget *parent = nullptr);
22 ~SvgLabel();
23
27 SvgLabel *m_select;
28
32 double m_rotate;
33
37 QPixmap m_img;
38 QPixmap m_scaled_img;
39
40
44 QString pathToImg;
45
49 int m_OG_position_x;
50
54 int m_OG_position_y;
55
59 int m_y_pos_offset; //offset for rotated img
60
64 int m_x_pos_offset;
65
69 enum startPositions {drag} startPositions;
70
75 size_t GetID() const {return iID;}
76
87 bool XML_edit();
88
89 static std::vector<QString> GetXmlAttributes() {return m_XML_attributes;}
90 static size_t GetTotal(){return iTotal;}
91
92
96 cv::Point_<double> m_image_position;
97
98
99 protected:
100
107 void mousePressEvent(QMouseEvent *event);
108
114 void mouseMoveEvent(QMouseEvent *event);
115
116 private:
117 const size_t iID;
118 static size_t iLiving;
119 static size_t iTotal;
120
124 QPoint dragStartPosition;
125
129 QRect dragStartGeometry;
130 enum startPositions startPos;
131
132 static std::vector<QString> m_XML_attributes;
133 };
134
135
136 #endif // SVGLABEL_H
SvgLabel::m_OG_position_y
int m_OG_position_y
Position.y of non-rotated img.
Definition: svglabel.h:54
SvgLabel::m_y_pos_offset
int m_y_pos_offset
Offset.y of the rotated image with regards to the non-rotated.
Definition: svglabel.h:59
SvgLabel::m_XML_attributes
static std::vector< QString > m_XML_attributes
Definition: svglabel.h:132
SvgLabel::pathToImg
QString pathToImg
Holds the absolute path to the image. Used in the XML_edit() method to edit the SVG file.
Definition: svglabel.h:44
SvgLabel::iID
const size_t iID
Definition: svglabel.h:117
SvgLabel::startPos
enum startPositions startPos
Definition: svglabel.h:130
SvgLabel::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
mouseMoveEvent
Definition: svglabel.cpp:52
SvgLabel::GetTotal
static size_t GetTotal()
Definition: svglabel.h:90
SvgLabel::mousePressEvent
void mousePressEvent(QMouseEvent *event)
mousePressEvent
Definition: svglabel.cpp:25
SvgLabel::m_select
SvgLabel * m_select
Pointer to self - should be a generic bool flag.
Definition: svglabel.h:27
SvgLabel::iLiving
static size_t iLiving
Definition: svglabel.h:118
SvgLabel::SvgLabel
SvgLabel(QWidget *parent=nullptr)
Definition: svglabel.cpp:9
SvgLabel::iTotal
static size_t iTotal
Definition: svglabel.h:119
SvgLabel::dragStartGeometry
QRect dragStartGeometry
Starting geometry of the move event.
Definition: svglabel.h:129
SvgLabel::m_x_pos_offset
int m_x_pos_offset
Offset.x of the rotated image with regards to the non-rotated.
Definition: svglabel.h:64
SvgLabel
Custom class used for handling SVG images and its transformations.
Definition: svglabel.h:18
SvgLabel::GetID
size_t GetID() const
Definition: svglabel.h:75
SvgLabel::XML_edit
bool XML_edit()
Edits the XML file of the instance.
Definition: svglabel.cpp:82
SvgLabel::m_scaled_img
QPixmap m_scaled_img
Definition: svglabel.h:38
SvgLabel::m_OG_position_x
int m_OG_position_x
Position.x of non-rotated img.
Definition: svglabel.h:49
SvgLabel::m_rotate
double m_rotate
Rotation of the instance.
Definition: svglabel.h:32
SvgLabel::m_img
QPixmap m_img
Holds the original QPixmap of the image.
Definition: svglabel.h:37
SvgLabel::dragStartPosition
QPoint dragStartPosition
Start position of the move event.
Definition: svglabel.h:124
SvgLabel::drag
@ drag
Definition: svglabel.h:69
SvgLabel::GetXmlAttributes
static std::vector< QString > GetXmlAttributes()
Definition: svglabel.h:89
SvgLabel::startPositions
startPositions
The startPositions enum (expandable to contain scaling posibilites for the SvgLabel)
Definition: svglabel.h:69
SvgLabel::m_image_position
cv::Point_< double > m_image_position
Position of the image with regards to the top-left corner of the camera frame.
Definition: svglabel.h:96
SvgLabel::~SvgLabel
~SvgLabel()
Definition: svglabel.cpp:20