16#ifndef QGSMODELARROWITEM_H
17#define QGSMODELARROWITEM_H
22#include <QGraphicsPathItem>
23#include <QGraphicsRectItem>
28class QgsModelComponentGraphicItem;
29class QgsModelArrowItem;
41class GUI_EXPORT QgsModelDesignerArrowBadgeItem :
public QGraphicsRectItem
44 QgsModelDesignerArrowBadgeItem( QgsModelArrowItem *link );
49 void setCenter(
const QPointF ¢er );
54 QgsModelArrowItem *arrow();
56 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget =
nullptr )
override;
63 void setValue(
const QVariant &value );
70 QVariant value()
const;
75 static QString textForValue(
const QVariant &value );
78 void resizeToContents();
80 static constexpr int FONT_SIZE = 10;
81 static constexpr double BORDER_RADIUS = 5;
82 static constexpr double CONTENTS_MARGIN = 0.2;
93class GUI_EXPORT QgsModelArrowItem :
public QObject,
public QGraphicsPathItem
111 QgsModelComponentGraphicItem *startItem,
114 bool startIsOutgoing,
116 QgsModelComponentGraphicItem *endItem,
129 QgsModelArrowItem( QgsModelComponentGraphicItem *startItem, Qt::Edge startEdge,
int startIndex, Marker startMarker, QgsModelComponentGraphicItem *endItem, Marker endMarker );
137 QgsModelArrowItem( QgsModelComponentGraphicItem *startItem, Marker startMarker, QgsModelComponentGraphicItem *endItem, Qt::Edge endEdge,
int endIndex, Marker endMarker );
144 QgsModelArrowItem( QgsModelComponentGraphicItem *startItem, Marker startMarker, QgsModelComponentGraphicItem *endItem, Marker endMarker );
146 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget =
nullptr )
override;
151 void setPenStyle( Qt::PenStyle style );
158 QgsModelComponentGraphicItem *startItem();
165 Qt::Edge startEdge() {
return mStartEdge; }
172 int startIndex() {
return mStartIndex; }
179 QgsModelComponentGraphicItem *endItem();
186 Qt::Edge endEdge() {
return mEndEdge; }
193 int endIndex() {
return mEndIndex; }
200 QgsModelDesignerArrowBadgeItem *badgeItem();
207 void setShowBadge(
bool visible );
217 QPointF bezierPointForCurve(
const QPointF &point, Qt::Edge edge,
bool incoming,
bool hasSpecificDirectionalFlow )
const;
219 void drawArrowHead( QPainter *painter,
const QPointF &point,
const QPointF &vector );
221 QgsModelComponentGraphicItem *mStartItem =
nullptr;
222 Qt::Edge mStartEdge = Qt::LeftEdge;
223 int mStartIndex = -1;
224 bool mStartIsOutgoing =
true;
227 QgsModelComponentGraphicItem *mEndItem =
nullptr;
228 Qt::Edge mEndEdge = Qt::LeftEdge;
230 bool mEndIsIncoming =
false;
234 QgsModelDesignerArrowBadgeItem *mBadgeItem =
nullptr;