File indexing completed on 2024-06-16 04:16:19

0001 /*
0002  *  SPDX-FileCopyrightText: 2020 Saurabh Kumar <saurabhk660@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __COMMENT_DELEGATE_H
0008 #define __COMMENT_DELEGATE_H
0009 
0010 #include <QStyledItemDelegate>
0011 
0012 class StoryboardCommentModel;
0013 
0014 /**
0015  * @class CommentDelegate
0016  * @brief Paints the comment menu of the storyboard docker
0017  * and creates widgets for editing data in @c CommentModel.
0018  */
0019 class CommentDelegate : public QStyledItemDelegate
0020 {
0021 public:
0022     CommentDelegate(QObject *parent);
0023     ~CommentDelegate() override;
0024     void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0025     QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0026     bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
0027     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
0028                           const QModelIndex &index) const override;
0029     void setEditorData(QWidget *editor, const QModelIndex &index) const override;
0030     void setModelData(QWidget *editor, QAbstractItemModel *model,
0031                       const QModelIndex &index) const override;
0032     void updateEditorGeometry(QWidget *editor,
0033     const QStyleOptionViewItem &option, const QModelIndex &index) const override;
0034 };
0035 
0036 #endif