2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef EDGE_H
|
|
|
|
#define EDGE_H
|
|
|
|
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
|
|
|
|
class Node;
|
|
|
|
|
|
|
|
//! [0]
|
|
|
|
class Edge : public QGraphicsItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Edge(Node *sourceNode, Node *destNode);
|
|
|
|
|
|
|
|
Node *sourceNode() const;
|
|
|
|
Node *destNode() const;
|
|
|
|
|
|
|
|
void adjust();
|
|
|
|
|
|
|
|
enum { Type = UserType + 2 };
|
2016-06-15 08:12:35 +00:00
|
|
|
int type() const override { return Type; }
|
2013-03-14 23:42:15 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
protected:
|
2016-06-15 08:12:35 +00:00
|
|
|
QRectF boundingRect() const override;
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
2013-03-14 23:42:15 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
private:
|
|
|
|
Node *source, *dest;
|
|
|
|
|
|
|
|
QPointF sourcePoint;
|
|
|
|
QPointF destPoint;
|
2019-09-01 15:12:01 +00:00
|
|
|
qreal arrowSize = 10;
|
2011-04-27 10:05:43 +00:00
|
|
|
};
|
|
|
|
//! [0]
|
|
|
|
|
2012-11-23 08:31:03 +00:00
|
|
|
#endif // EDGE_H
|