1 /* pref_delegate.h
2  * Delegates for editing prefereneces.
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef PREF_DELEGATE_H
12 #define PREF_DELEGATE_H
13 
14 #include <config.h>
15 
16 #include <ui/qt/models/pref_models.h>
17 
18 #include <QStyledItemDelegate>
19 #include <QModelIndex>
20 
21 class AdvancedPrefDelegate : public QStyledItemDelegate
22 {
23 public:
24     AdvancedPrefDelegate(QObject *parent = 0);
25 
26     QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
27                           const QModelIndex &index) const;
28     void setEditorData(QWidget *editor, const QModelIndex &index) const;
29     void setModelData(QWidget *editor, QAbstractItemModel *model,
30                       const QModelIndex &index) const;
31 
32 private:
33     PrefsItem* indexToPref(const QModelIndex &index) const;
34 };
35 
36 #endif // PREF_DELEGATE_H
37