File indexing completed on 2024-05-12 05:54:13

0001 /*
0002     SPDX-FileCopyrightText: 2022 Johnny Jazeix <jazeix@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef LAPITEMDELEGATE_H
0008 #define LAPITEMDELEGATE_H
0009 
0010 #include <QItemDelegate>
0011 
0012 class MainWindow;
0013 /**
0014  * @brief ItemDelegate to block the Return key press creating a new line
0015  * when editing a line.
0016  */
0017 class LapItemDelegate : public QItemDelegate {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit LapItemDelegate(MainWindow *window);
0022     QWidget* createEditor(QWidget *parent, 
0023                           const QStyleOptionViewItem &option, 
0024                           const QModelIndex &index) const override;
0025     
0026     void onCloseEditor(QWidget *,
0027                        QAbstractItemDelegate::EndEditHint) const;
0028 
0029 private:
0030     MainWindow *m_window;
0031 };
0032 
0033 #endif