1 /* coloring_rules_delegate.h 2 * Delegates for editing various coloring rule fields. 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 COLORING_RULE_DELEGATE_H 12 #define COLORING_RULE_DELEGATE_H 13 14 #include <config.h> 15 16 #include <QStyledItemDelegate> 17 #include <QModelIndex> 18 19 class ColoringRulesDelegate : public QStyledItemDelegate 20 { 21 Q_OBJECT 22 23 public: 24 ColoringRulesDelegate(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 void updateEditorGeometry(QWidget *editor, 33 const QStyleOptionViewItem &option, const QModelIndex &index) const; 34 35 signals: 36 void invalidField(const QModelIndex &index, const QString& errMessage) const; 37 void validField(const QModelIndex &index) const; 38 39 private slots: 40 void ruleNameChanged(const QString name); 41 }; 42 #endif // COLORING_RULE_DELEGATE_H 43