File indexing completed on 2024-05-05 05:54:31

0001 /*
0002     SPDX-FileCopyrightText: 2022 Johnny Jazeix <jazeix@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "lapitemdelegate.h"
0008 #include "mainwindow.h"
0009 
0010 #include <QKeySequence>
0011 #include <QList>
0012 
0013 LapItemDelegate::LapItemDelegate(MainWindow *window) : QItemDelegate(window),
0014                                                        m_window{window}
0015 {
0016     connect(this, &QItemDelegate::closeEditor, this, &LapItemDelegate::onCloseEditor);
0017 }
0018 
0019 QWidget* LapItemDelegate::createEditor(QWidget *parent, 
0020                                        const QStyleOptionViewItem &option, 
0021                                        const QModelIndex &index) const
0022 {
0023     m_window->enableLapShortcuts(false);
0024     return QItemDelegate::createEditor(parent, option, index);
0025 }
0026 void LapItemDelegate::onCloseEditor(QWidget *,
0027                                     QAbstractItemDelegate::EndEditHint) const
0028 {
0029     m_window->enableLapShortcuts(true);
0030 }
0031 
0032 #include "moc_lapitemdelegate.cpp"