OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsItemDesignerDrawHandler.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/CoreTypes.h"
10
11// Qt header
12#include <QtCore/qobject.h>
13
17
18class GraphicsItemDesignerDrawHandler : public QObject {
19 Q_OBJECT
20public:
34
37
38 void startDraw(DrawMode _mode);
39
42 void cancelDraw(void);
43
49
52 void checkStopDraw(void);
53
54 void updatePosition(const QPointF& _pos);
55 void positionSelected(const QPointF& _pos);
56
58 ot::UID generateUid(void) { return ++m_currentUid; };
59
61 void resetUid(void) { m_currentUid = 0; };
62
63Q_SIGNALS:
66
67private:
68 QPointF constainPosition(const QPointF& _pos) const;
69 QString modeString(void);
70 void createPreviewItem(void);
71
72 ot::UID m_currentUid;
73
74 DrawMode m_mode;
77 GraphicsItemDesignerItemBase* m_previewItem;
78};
Definition GraphicsItemDesignerDrawHandler.h:18
ot::UID generateUid(void)
Generates the next available UID.
Definition GraphicsItemDesignerDrawHandler.h:58
void positionSelected(const QPointF &_pos)
Definition GraphicsItemDesignerDrawHandler.cpp:112
GraphicsItemDesignerDrawHandler(GraphicsItemDesignerView *_view)
Definition GraphicsItemDesignerDrawHandler.cpp:28
DrawMode
Definition GraphicsItemDesignerDrawHandler.h:21
@ Rect
Definition GraphicsItemDesignerDrawHandler.h:25
@ Polygon
Definition GraphicsItemDesignerDrawHandler.h:30
@ Shape
Definition GraphicsItemDesignerDrawHandler.h:31
@ Triangle
Definition GraphicsItemDesignerDrawHandler.h:29
@ Text
Definition GraphicsItemDesignerDrawHandler.h:32
@ Ellipse
Definition GraphicsItemDesignerDrawHandler.h:27
@ Arc
Definition GraphicsItemDesignerDrawHandler.h:28
@ Line
Definition GraphicsItemDesignerDrawHandler.h:23
@ Circle
Definition GraphicsItemDesignerDrawHandler.h:26
@ Square
Definition GraphicsItemDesignerDrawHandler.h:24
@ NoMode
Definition GraphicsItemDesignerDrawHandler.h:22
void cancelDraw(void)
Cancels the current draw. The item will be removed.
Definition GraphicsItemDesignerDrawHandler.cpp:50
void resetUid(void)
Resets the UID to the initial state.
Definition GraphicsItemDesignerDrawHandler.h:61
GraphicsItemDesignerItemBase * stopDraw(void)
Stops the current draw and returns the drawn item if valid. The current preview item will be returned...
Definition GraphicsItemDesignerDrawHandler.cpp:62
void startDraw(DrawMode _mode)
Definition GraphicsItemDesignerDrawHandler.cpp:38
void updatePosition(const QPointF &_pos)
Definition GraphicsItemDesignerDrawHandler.cpp:101
virtual ~GraphicsItemDesignerDrawHandler()
Definition GraphicsItemDesignerDrawHandler.cpp:34
void checkStopDraw(void)
Will check if the current draw is valid and emits drawCompleted if valid otherwise removes the item....
Definition GraphicsItemDesignerDrawHandler.cpp:86
Definition GraphicsItemDesignerInfoOverlay.h:17
Definition GraphicsItemDesignerItemBase.h:25
Definition GraphicsItemDesignerView.h:17
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27