18#include <QtWidgets/qgraphicsview.h>
32 class GraphicsItemCfg;
33 class GraphicsConnectionItem;
42 ViewManagesSceneRect = 0x01,
43 IgnoreConnectionByUser = 0x02
48 DefaultState = 0 << 0,
49 ItemMoveInProgress = 1 << 0,
50 MiddleMousePressedState = 1 << 1,
51 ReadOnlyState = 1 << 2
58 virtual QWidget*
getQWidget(
void)
override {
return this; };
59 virtual const QWidget*
getQWidget(
void)
const override {
return this; };
62 void ensureViewInBounds(
void);
88 void removeItem(
const ot::UID& _itemUid,
bool bufferConnections =
false);
89 std::list<ot::UID> getSelectedItemUIDs(
void)
const;
90 std::list<GraphicsItem*> getSelectedGraphicsItems(
void)
const;
98 void removeConnection(
const ot::UID& _connectionInformation);
100 std::list<GraphicsConnectionItem*> getSelectedConnectionItems(
void)
const;
102 void requestConnection(
const ot::UID& _fromUid,
const std::string& _fromConnector,
const ot::UID& _toUid,
const std::string& _toConnector);
104 void requestConnectionToConnection(
const ot::UID& _fromItemUid,
const std::string& _fromItemConnector,
const ot::UID& _toConnectionUid,
const ot::Point2DD& _newControlPoint);
110 QRectF getVisibleSceneRect(
void)
const;
112 void setReadOnly(
bool _isReadOnly) { m_viewStateFlags.setFlag(ViewStateFlag::ReadOnlyState, _isReadOnly); };
113 bool isReadOnly(
void)
const {
return m_viewStateFlags.flagIsSet(ViewStateFlag::ReadOnlyState); };
139 virtual void wheelEvent(QWheelEvent* _event)
override;
140 virtual void mousePressEvent(QMouseEvent* _event)
override;
141 virtual void mouseReleaseEvent(QMouseEvent* _event)
override;
142 virtual void mouseMoveEvent(QMouseEvent* _event)
override;
143 virtual void keyPressEvent(QKeyEvent* _event)
override;
144 virtual void keyReleaseEvent(QKeyEvent* _event)
override;
145 virtual void resizeEvent(QResizeEvent* _event)
override;
147 virtual void dragEnterEvent(QDragEnterEvent* _event)
override;
148 virtual void dropEvent(QDropEvent* _event)
override;
149 virtual void dragMoveEvent(QDragMoveEvent* _event)
override;
153 void slotPaste(
void);
159 void beginItemMove(
void);
164 void endItemMove(
void);
171 std::string m_viewName;
173 QMarginsF m_sceneMargins;
180 std::map<ot::UID, ot::GraphicsItem*> m_items;
181 std::map<ot::UID, ot::GraphicsConnectionItem*> m_connections;
182 std::list<GraphicsConnectionCfg> m_connectionCreationBuffer;
183 std::list<GraphicsConnectionCfg> m_itemRemovalConnectionBuffer;
mongocxx::pool::entry connection
Definition ConnectionAPI.h:9
#define OT_ADD_FLAG_FUNCTIONS(___enumName)
Will add the default bitwise operations for the provided private 32/64 bit bitfield....
Definition Flags.h:129
The Flags class is a wrapper around a enum that allows bitwise operations (flags)....
Definition Flags.h:214
Definition GraphicsConnectionCfg.h:22
Definition GraphicsConnectionItem.h:25
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
Base class for all OpenTwin GraphicsItems GraphicsItems should be created by the GraphicsFactory and ...
Definition GraphicsItem.h:35
Graphics Scene for ot::GraphicsItem Adding QGraphicsItems to the scene that do not inherit ot::Graphi...
Definition GraphicsScene.h:31
View widget used to display GraphicsItems Note that the View creates its own scene.
Definition GraphicsView.h:37
void itemMoved(const ot::UID &_uid, const QPointF &_newPos)
const BasicServiceInformation & getOwner(void) const
Definition GraphicsView.h:68
void setReadOnly(bool _isReadOnly)
Definition GraphicsView.h:112
virtual QWidget * getQWidget(void) override
Returns a pointer to the root widget of this object.
Definition GraphicsView.h:58
void removeItemsRequested(const ot::UIDList &_items, const ot::UIDList &_connections)
void setGraphicsViewFlag(GraphicsViewFlag _flag, bool _active=true)
Definition GraphicsView.h:70
const QMarginsF & getSceneMargins(void) const
Definition GraphicsView.h:93
ViewStateFlag
Definition GraphicsView.h:47
const std::string & getGraphicsViewName(void) const
Definition GraphicsView.h:85
void itemRequested(const QString &_name, const QPointF &_pos)
Will be emitted when an item was dropped into the scene by the user.
ot::Flags< ViewStateFlag > ViewStateFlags
Definition GraphicsView.h:53
void connectionRequested(const ot::UID &_fromUid, const std::string &_fromConnector, const ot::UID &_toUid, const std::string &_toConnector)
Will be emitted when a connection was "dropped" by the user.
void setGraphicsViewFlags(const GraphicsViewFlags &_flags)
Definition GraphicsView.h:71
bool isReadOnly(void) const
Definition GraphicsView.h:113
void setMouseWheelEnabled(bool _enabled)
Definition GraphicsView.h:64
void setDropsEnabled(bool _enabled)
Definition GraphicsView.h:82
void setGraphicsViewName(const std::string &_name)
Definition GraphicsView.h:84
void setOwner(const BasicServiceInformation &_owner)
Definition GraphicsView.h:67
void itemConfigurationChanged(const ot::GraphicsItemCfg *_newConfig)
void setSceneMargins(const QMarginsF &_margins)
Definition GraphicsView.h:92
GraphicsScene * getGraphicsScene(void)
Definition GraphicsView.h:75
virtual const QWidget * getQWidget(void) const override
Definition GraphicsView.h:59
Flags< GraphicsViewFlag > GraphicsViewFlags
Definition GraphicsView.h:45
void connectionToConnectionRequested(const ot::UID &_fromItemUid, const std::string &_fromItemConnector, const ot::UID &_toConnectionUid, const ot::Point2DD &_newControlPoint)
bool getMouseWheelEnabled(void) const
Definition GraphicsView.h:65
GraphicsViewFlag
Definition GraphicsView.h:40
const GraphicsViewFlags & getGraphicsViewFlags(void) const
Definition GraphicsView.h:72
void itemCopyRequested(const GraphicsCopyInformation *_info)
2D Point with double values
Definition Point2D.h:144
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27
std::list< UID > UIDList
Unique identifier list.
Definition CoreTypes.h:31