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