File indexing completed on 2022-11-22 13:00:59

0001 /*
0002     SPDX-FileCopyrightText: 2008 Daniel Laidig <d.laidig@gmx.de>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef BUTTONDELEGATE_H
0007 #define BUTTONDELEGATE_H
0008 
0009 #include <QStyledItemDelegate>
0010 
0011 #include <QPoint>
0012 
0013 class Dashboard;
0014 class QToolButton;
0015 
0016 class ButtonDelegate : public QStyledItemDelegate
0017 {
0018     Q_OBJECT
0019 public:
0020     ButtonDelegate(QAbstractItemView *itemView, Dashboard *parent);
0021 
0022     ~ButtonDelegate() override;
0023 
0024     void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0025 
0026     QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0027 
0028     QModelIndex hoveredIndex() const;
0029 
0030 public Q_SLOTS:
0031     void slotEdit();
0032     void slotPractice();
0033 
0034 private:
0035     int m_rightMargin;
0036     int m_buttonHeight;
0037     Dashboard *m_dashboard;
0038     QAbstractItemView *m_itemView;
0039     QToolButton *m_editButton;
0040 };
0041 
0042 #endif // BUTTONDELEGATE_H