Wireshark  4.3.0
The Wireshark network protocol analyzer
numeric_value_chooser_delegate.h
Go to the documentation of this file.
1 
12 #ifndef NUMERIC_VALUE_CHOOSER_DELEGATE_H_
13 #define NUMERIC_VALUE_CHOOSER_DELEGATE_H_
14 
15 
16 #include <QStyledItemDelegate>
17 
18 class NumericValueChooserDelegate : public QStyledItemDelegate
19 {
20  Q_OBJECT
21 
22 public:
23  NumericValueChooserDelegate(int min = 0, int max = 0, QObject *parent = 0);
25 
26  void setMinMaxRange(int min, int max);
27  void setDefaultValue(int defValue, QVariant defaultReturn);
28 
29 protected:
30  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
31  void setEditorData(QWidget *editor, const QModelIndex &index) const;
32  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
33 
34 private:
35 
36  int _min;
37  int _max;
38  int _default;
39  QVariant _defReturn;
40 
41 private slots:
42  void onValueChanged(int i);
43 };
44 
45 #endif /* NUMERIC_VALUE_CHOOSER_DELEGATE_H_ */
Definition: numeric_value_chooser_delegate.h:19