16#ifndef QGSMODELARROWITEM_H
17#define QGSMODELARROWITEM_H
22#include <QGraphicsPathItem>
23#include <QGraphicsRectItem>
26class QgsModelComponentGraphicItem;
27class QgsModelArrowItem;
38class GUI_EXPORT QgsModelDesignerArrowBadgeItem :
public QGraphicsRectItem
SIP_SKIP
46 void setCenter(
const QPointF ¢er );
51 QgsModelArrowItem *arrow();
53 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget =
nullptr )
override;
60 void setValue(
const QVariant &value );
67 QVariant value()
const;
72 static QString textForValue(
const QVariant &value );
75 void resizeToContents();
77 static constexpr int FONT_SIZE = 10;
78 static constexpr double BORDER_RADIUS = 5;
79 static constexpr double CONTENTS_MARGIN = 0.2;
90class GUI_EXPORT QgsModelArrowItem :
public QObject,
public QGraphicsPathItem
108 QgsModelComponentGraphicItem *startItem,
111 bool startIsOutgoing,
113 QgsModelComponentGraphicItem *endItem,
126 QgsModelArrowItem( QgsModelComponentGraphicItem *startItem, Qt::Edge startEdge,
int startIndex, Marker startMarker, QgsModelComponentGraphicItem *endItem, Marker endMarker );
134 QgsModelArrowItem( QgsModelComponentGraphicItem *startItem, Marker startMarker, QgsModelComponentGraphicItem *endItem, Qt::Edge endEdge,
int endIndex, Marker endMarker );
141 QgsModelArrowItem( QgsModelComponentGraphicItem *startItem, Marker startMarker, QgsModelComponentGraphicItem *endItem, Marker endMarker );
143 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget =
nullptr )
override;
148 void setPenStyle( Qt::PenStyle style );
155 QgsModelComponentGraphicItem *startItem();
162 Qt::Edge startEdge() {
return mStartEdge; }
169 int startIndex() {
return mStartIndex; }
176 QgsModelComponentGraphicItem *endItem();
183 Qt::Edge endEdge() {
return mEndEdge; }
190 int endIndex() {
return mEndIndex; }
197 SIP_SKIP QgsModelDesignerArrowBadgeItem *badgeItem();
204 SIP_SKIP void setShowBadge(
bool visible );
214 QPointF bezierPointForCurve(
const QPointF &point, Qt::Edge edge,
bool incoming,
bool hasSpecificDirectionalFlow )
const;
216 void drawArrowHead( QPainter *painter,
const QPointF &point,
const QPointF &vector );
218 QgsModelComponentGraphicItem *mStartItem =
nullptr;
219 Qt::Edge mStartEdge = Qt::LeftEdge;
220 int mStartIndex = -1;
221 bool mStartIsOutgoing =
true;
224 QgsModelComponentGraphicItem *mEndItem =
nullptr;
225 Qt::Edge mEndEdge = Qt::LeftEdge;
227 bool mEndIsIncoming =
false;
231 QgsModelDesignerArrowBadgeItem *mBadgeItem =
nullptr;