Maki
Formally verified low-code orchestration
Loading...
Searching...
No Matches
empty_slot.h
1#pragma once
2
3#include <QGraphicsObject>
4
5#include "ids.h"
6
7class QGraphicsSceneHoverEvent;
8class QGraphicsSceneMouseEvent;
9class QPainter;
10class QStyleOptionGraphicsItem;
11class QWidget;
12
13class EmptySlot : public QGraphicsObject
14{
15public:
16 enum
17 {
18 Type = Types::EMPTY_SLOT
19 };
20
21 explicit EmptySlot(qreal diameter, QGraphicsItem* parent = nullptr);
22
28 int type() const override;
29
30 QRectF boundingRect() const override;
31
32 void setDiameter(qreal diameter);
33 qreal diameter() const;
34
35 std::function<void(const QPointF& scenePos)> clicked;
36
37protected:
38 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
39
40 void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
41 void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
42
43 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
44 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
45
46private:
47 qreal mDiameter = 0.0;
48 bool mHovered = false;
49 bool mPressed = false;
50};
int type() const override
Returns the type of this item.
Definition empty_slot.cpp:23