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

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2012 Martin Kuettler <martin.kuettler@gmail.com>
0004 */
0005 
0006 #ifndef ACTIONBAR_H
0007 #define ACTIONBAR_H
0008 
0009 #include <QGraphicsObject>
0010 
0011 #include <QIcon>
0012 
0013 class Worksheet;
0014 class WorksheetEntry;
0015 class WorksheetToolButton;
0016 
0017 class ActionBar : public QGraphicsObject
0018 {
0019   Q_OBJECT
0020   public:
0021     explicit ActionBar(WorksheetEntry* parent);
0022     ~ActionBar() override = default;
0023 
0024     WorksheetToolButton* addButton(const QIcon& icon, const QString& toolTip,
0025                                    QObject* receiver = nullptr,
0026                                    const char* method = nullptr);
0027     void addSpace();
0028 
0029     WorksheetEntry* parentEntry();
0030 
0031     QRectF boundingRect() const override;
0032     void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
0033 
0034   public Q_SLOTS:
0035     void updatePosition();
0036 
0037   private:
0038     Worksheet* worksheet();
0039 
0040   private:
0041     Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
0042     QList<WorksheetToolButton*> m_buttons;
0043     qreal m_pos;
0044     qreal m_height;
0045 };
0046 
0047 #endif // ACTIONBAR_H