19#include <QtCore/qpoint.h>
20#include <QtWidgets/qgraphicsitem.h>
21#include <QtWidgets/qgraphicslayoutitem.h>
30 class GraphicsItemCfg;
31 class GraphicsConnectionItem;
57 static Painter2D* createSelectionBorderPainter(
void);
61 static Painter2D* createHoverBorderPainter(
void);
80 virtual void callPaint(QPainter* _painter,
const QStyleOptionGraphicsItem* _opt, QWidget* _widget) = 0;
108 virtual void graphicsItemConfigurationChanged(
const GraphicsItemCfg* _config);
115 virtual void removeAllConnections(
void);
117 virtual bool graphicsItemRequiresHover(
void)
const;
128 void handleMousePressEvent(QGraphicsSceneMouseEvent* _event);
132 bool handleMouseMoveEvent(QGraphicsSceneMouseEvent* _event);
133 void handleMouseReleaseEvent(QGraphicsSceneMouseEvent* _event);
134 void handleHoverEnterEvent(QGraphicsSceneHoverEvent* _event);
135 void handleToolTip(QGraphicsSceneHoverEvent* _event);
136 void handleHoverLeaveEvent(QGraphicsSceneHoverEvent* _event);
139 QSizeF handleGetGraphicsItemSizeHint(Qt::SizeHint _hint,
const QSizeF& _sizeHint)
const;
143 QRectF handleGetGraphicsItemBoundingRect(
const QRectF& _rect)
const;
148 void handleItemChange(QGraphicsItem::GraphicsItemChange _change,
const QVariant& _value);
150 void handleSetItemGeometry(
const QRectF& _geom);
157 virtual qreal calculateShortestDistanceToPoint(
const QPointF& _pt)
const override;
161 QRectF calculatePaintArea(
const QSizeF& _innerSize);
167 virtual GraphicsScene* getGraphicsScene(
void)
const override;
181 void setGraphicsItemPos(
const QPointF& _pos);
184 void setGraphicsItemPos(
const Point2DD& _pos);
187 const Point2DD& getGraphicsItemPos(
void)
const;
208 void setGraphicsItemUid(
const ot::UID& _uid);
209 const ot::UID& getGraphicsItemUid(
void)
const;
211 virtual void setGraphicsItemName(
const std::string& _name);
212 const std::string& getGraphicsItemName(
void)
const;
214 void setGraphicsItemToolTip(
const std::string& _toolTip);
215 const std::string& getGraphicsItemToolTip(
void)
const;
217 void setAdditionalTriggerDistance(
const ot::MarginsD& _distance);
218 const ot::MarginsD& getAdditionalTriggerDistance(
void)
const;
221 virtual double getMaxAdditionalTriggerDistance(
void)
const;
224 void setGraphicsItemMinimumSize(
const QSizeF& _size);
225 QSizeF getGraphicsItemMinimumSize(
void)
const;
228 void setGraphicsItemMaximumSize(
const QSizeF& _size);
229 QSizeF getGraphicsItemMaximumSize(
void)
const;
237 void setGraphicsItemMargins(
const ot::MarginsD& _margins);
243 void setStringMap(
const std::map<std::string, std::string>& _map);
244 const std::map<std::string, std::string>& getStringMap(
void)
const;
246 void setGraphicsItemTransform(
const Transform& _transform);
247 const Transform& getGraphicsItemTransform(
void)
const;
260 QSizeF applyGraphicsItemMargins(
const QSizeF& _size)
const;
261 QSizeF removeGraphicsItemMargins(
const QSizeF& _size)
const;
263 virtual void setGraphicsItemRequestedSize(
const QSizeF& _size);
266 std::list<ot::GraphicsConnectionCfg> getConnectionCfgs();
268 void setGraphicsItemSelected(
bool _selected);
269 bool getGraphicsItemSelected(
void)
const;
284 void setCurrentPosAsMoveStart(
void);
287 void notifyMoveIfRequired(
void);
289 void parentItemTransformChanged(
const QTransform& _parentTransform);
293 QRectF getTriggerBoundingRect(
void)
const;
300 virtual void graphicsElementStateChanged(
const GraphicsElementStateFlags& _state)
override;
306 template <
class T> T* getItemConfiguration(
void);
312 template <
class T>
const T* getItemConfiguration(
void)
const;
314 virtual void applyGraphicsItemTransform(
void);
323 QPointF m_moveStartPt;
326 QSizeF m_requestedSize;
328 bool m_forwardSizeChanges;
330 bool m_blockFlagNotifications;
331 bool m_blockConfigurationNotifications;
333 std::list<GraphicsItem*> m_eventHandler;
334 std::list<GraphicsConnectionItem*> m_connections;
#define OT_DECL_NODEFAULT(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:22
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
Definition GraphicsConnectionItem.h:25
Definition GraphicsElement.h:28
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
GraphicsItemFlag
GraphicsItemFlag.
Definition GraphicsItemCfg.h:37
Base class for all OpenTwin GraphicsItems GraphicsItems should be created by the GraphicsFactory and ...
Definition GraphicsItem.h:35
GraphicsItem * getParentGraphicsItem(void) const
Definition GraphicsItem.h:190
bool getBlockFlagNotifications(void) const
If enabled the item will not call graphicsItemFlagsChanged() when the flags have changed.
Definition GraphicsItem.h:275
GraphicsItemEvent
The GraphicsItemEvent is used to describe the type of an event that occured.
Definition GraphicsItem.h:46
@ ItemMoved
Definition GraphicsItem.h:47
virtual void notifyChildsAboutTransformChange(const QTransform &_newTransform)
Definition GraphicsItem.h:316
bool getBlockConfigurationNotifications(void) const
If enabled the item will not call graphicsItemConfigurationChanged() when the flags have changed.
Definition GraphicsItem.h:281
virtual void setParentGraphicsItem(GraphicsItem *_itm)
Definition GraphicsItem.h:189
void setGraphicsItemMaximumSize(double _width, double _height)
Definition GraphicsItem.h:227
void setGraphicsItemMinimumSize(double _width, double _height)
Definition GraphicsItem.h:223
const QSizeF & graphicsItemRequestedSize(void) const
Definition GraphicsItem.h:264
virtual void callPaint(QPainter *_painter, const QStyleOptionGraphicsItem *_opt, QWidget *_widget)=0
Calls QGraphicsItem::paint().
bool getForwardSizeChanges(void) const
Definition GraphicsItem.h:250
virtual void prepareGraphicsItemGeometryChange(void)=0
Calls QGraphicsLayoutItem::prepareGeometryChange().
void setForwardSizeChanges(bool _forward)
Definition GraphicsItem.h:249
virtual QGraphicsLayoutItem * getQGraphicsLayoutItem(void)=0
Returns the QGraphicsLayoutItem.
const GraphicsItemCfg *const getConfiguration(void) const
Returns the current configuration.
Definition GraphicsItem.h:178
virtual QSizeF graphicsItemSizeHint(Qt::SizeHint _hint, const QSizeF &_constrains) const =0
Calls QGraphicsLayoutItem::sizeHint().
void setBlockConfigurationNotifications(bool _block)
Definition GraphicsItem.h:278
void setBlockFlagNotifications(bool _block)
Definition GraphicsItem.h:272
virtual void finalizeGraphicsItem(void)
Will be called after setupFromConfig (i.e. if the item is completely created). Here the item structur...
Definition GraphicsItem.h:122
virtual void graphicsItemEventHandler(GraphicsItem *_sender, GraphicsItemEvent _event)
Will be called when this item was registered as an event handler and the child raised an event.
Definition GraphicsItem.h:102
Graphics Scene for ot::GraphicsItem Adding QGraphicsItems to the scene that do not inherit ot::Graphi...
Definition GraphicsScene.h:31
Definition Painter2D.h:17
2D Point with double values
Definition Point2D.h:144
SizePolicy
Size policy for UI elements.
Definition GuiTypes.h:58
ConnectionDirection
Describes in which direction a connetion from an item is starting.
Definition GuiTypes.h:65
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27
Alignment
Alignment.
Definition GuiTypes.h:21