dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
notifyitemdelegate.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 #ifndef NOTIFYITEMDELEGATE_H
31 #define NOTIFYITEMDELEGATE_H
32 
33 #include <QItemDelegate>
34 #include <QComboBox>
35 
36 class NotifyItemDelegate : public QItemDelegate
37 {
38  Q_OBJECT
39 
40 public:
41  NotifyItemDelegate(QObject *parent = nullptr);
42  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
43  const QModelIndex &index) const;
44  void setEditorData(QWidget *editor, const QModelIndex &index) const;
45  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
46  QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
47 
48 private slots:
49  void selectRow(const QString &text);
50  void commitAndCloseEditor();
51 
52 private:
53  QObject *_parent;
54 };
55 
56 #endif // NOTIFYITEMDELEGATE_H
NotifyItemDelegate(QObject *parent=nullptr)
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
void setEditorData(QWidget *editor, const QModelIndex &index) const
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const