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 DIAGRAMITEM_H
|
|
|
|
#define DIAGRAMITEM_H
|
|
|
|
|
|
|
|
#include <QGraphicsPolygonItem>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QGraphicsItem;
|
|
|
|
class QGraphicsScene;
|
|
|
|
class QGraphicsSceneMouseEvent;
|
|
|
|
class QPointF;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
class DiagramItem : public QGraphicsPolygonItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum { Type = UserType + 1 };
|
|
|
|
enum DiagramType { Box, Triangle };
|
|
|
|
|
2019-09-06 18:27:33 +00:00
|
|
|
explicit DiagramItem(DiagramType diagramType, QGraphicsItem *item = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2019-09-06 18:27:33 +00:00
|
|
|
DiagramType diagramType() const
|
|
|
|
{
|
2011-04-27 10:05:43 +00:00
|
|
|
return polygon() == boxPolygon ? Box : Triangle;
|
|
|
|
}
|
2016-06-15 08:12:35 +00:00
|
|
|
int type() const override { return Type; }
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QPolygonF boxPolygon;
|
|
|
|
QPolygonF trianglePolygon;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|