Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
numeric_value_chooser_delegate.h
1 /* numeric_value_chooser_delegate.h
2  * Delegate to select a numeric value for a treeview entry
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 NUMERIC_VALUE_CHOOSER_DELEGATE_H_
12 #define NUMERIC_VALUE_CHOOSER_DELEGATE_H_
13 
14 
15 #include <QStyledItemDelegate>
16 
17 class NumericValueChooserDelegate : public QStyledItemDelegate
18 {
19  Q_OBJECT
20 
21 public:
22  NumericValueChooserDelegate(int min = 0, int max = 0, QObject *parent = 0);
24 
25  void setMinMaxRange(int min, int max);
26  void setDefaultValue(int defValue, QVariant defaultReturn);
27 
28 protected:
29  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
30  void setEditorData(QWidget *editor, const QModelIndex &index) const;
31  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
32 
33 private:
34 
35  int _min;
36  int _max;
37  int _default;
38  QVariant _defReturn;
39 
40 private slots:
41  void onValueChanged(int i);
42 };
43 
44 #endif /* NUMERIC_VALUE_CHOOSER_DELEGATE_H_ */
45 
46 /*
47  * Editor modelines
48  *
49  * Local Variables:
50  * c-basic-offset: 4
51  * tab-width: 8
52  * indent-tabs-mode: nil
53  * End:
54  *
55  * ex: set shiftwidth=4 tabstop=8 expandtab:
56  * :indentSize=4:tabSize=8:noTabs=true:
57  */
Definition: numeric_value_chooser_delegate.h:17
Definition: pcapng.c:148