File indexing completed on 2022-12-06 18:50:28

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2020 Sirgienko Nikita <warquark@gmail.com>
0004 */
0005 #ifndef WORKSHEETCONTROLITEM_H
0006 #define WORKSHEETCONTROLITEM_H
0007 
0008 #include <QObject>
0009 #include <QGraphicsRectItem>
0010 
0011 class WorksheetEntry;
0012 class Worksheet;
0013 
0014 class WorksheetControlItem: public QObject, public QGraphicsRectItem
0015 {
0016   Q_OBJECT
0017   public:
0018     WorksheetControlItem(Worksheet* worksheet, WorksheetEntry* parent);
0019 
0020   Q_SIGNALS:
0021     void doubleClick();
0022     void drag(const QPointF, const QPointF);
0023 
0024   private:
0025     void hoverEnterEvent(QGraphicsSceneHoverEvent * event) override;
0026     void hoverLeaveEvent(QGraphicsSceneHoverEvent * event) override;
0027     void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
0028     void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event) override;
0029     void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override;
0030 
0031   public:
0032     bool isSelected{false};
0033     bool isCollapsable{false};
0034     bool isCollapsed{false};
0035 
0036   private:
0037     Worksheet* m_worksheet{nullptr};
0038     bool m_isHovered{false};
0039 };
0040 
0041 #endif // WORKSHEETCONTROLITEM_H