File indexing completed on 2024-05-05 17:18:51
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr 0003 * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 ***************************************************************************/ 0006 #ifndef SKGQUERYDELEGATE_H 0007 #define SKGQUERYDELEGATE_H 0008 /** @file 0009 * This is a delegate for query creator. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 #include <qitemdelegate.h> 0014 0015 #include "skgbankgui_export.h" 0016 0017 class SKGDocument; 0018 0019 /** 0020 * This is a delegate for query creator 0021 */ 0022 class SKGBANKGUI_EXPORT SKGQueryDelegate : public QItemDelegate 0023 { 0024 Q_OBJECT 0025 public: 0026 /** 0027 * Default Constructor 0028 */ 0029 explicit SKGQueryDelegate(QObject* iParent, SKGDocument* iDoc, bool iModeUpdate = false, QStringList iListAtt = QStringList()); 0030 0031 /** 0032 * Default Destructor 0033 */ 0034 ~SKGQueryDelegate() override; 0035 0036 /** 0037 * Returns the widget used to edit the item specified by index for editing. 0038 * The parent widget and style option are used to control how the editor widget appears. 0039 * @param iParent perant widget 0040 * @param option options 0041 * @param index index 0042 * @return the widget 0043 */ 0044 QWidget* createEditor(QWidget* iParent, 0045 const QStyleOptionViewItem& option, 0046 const QModelIndex& index) const override; 0047 0048 /** 0049 * Sets the data to be displayed and edited by the editor from the data model item specified by the model index. 0050 * @param editor the editor 0051 * @param index the index 0052 */ 0053 void setEditorData(QWidget* editor, const QModelIndex& index) const override; 0054 0055 /** 0056 * Gets data from the editor widget and stores it in the specified model at the item inde 0057 * @param editor the editor 0058 * @param model the model 0059 * @param index the index 0060 */ 0061 void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override; 0062 0063 private Q_SLOTS: 0064 void commitAndCloseEditor(); 0065 0066 private: 0067 Q_DISABLE_COPY(SKGQueryDelegate) 0068 0069 SKGDocument* m_document; 0070 bool m_updateMode; 0071 QStringList m_listAtt; 0072 }; 0073 0074 #endif // SKGQUERYDELEGATE_H