12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #ifndef CRECTITEM_H
- #define CRECTITEM_H
- #include "CPathItem.h"
- class QMenu;
- class QAction;
- class CRectItem : public CPathItem
- {
- public:
- explicit CRectItem(QGraphicsItem *parent = nullptr);
- explicit CRectItem(const QRectF &rect, QGraphicsItem *parent = nullptr);
- QRectF rect() const;
- void setRect(const QRectF &rect);
- QPointF centerLeft() const;
- QPointF centerRight() const;
- int cornerRadius() const;
- void setCornerRadius(qreal radius);
- void updatePath() override;
- void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
- void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
- QAction *selectAction() const;
- QAction *subNodeAction() const;
- QAction *removeAction() const;
- private slots:
- void slotSelect();
- private:
- QRectF m_rect;
- qreal m_cornerRadius = 5;
- QMenu *m_menu = nullptr;
- QAction *m_select = nullptr;
- QAction *m_subNode = nullptr;
- QAction *m_remove = nullptr;
- };
- #endif // CRECTITEM_H
|