#pragma once #include #include "iPlugin_global.h" // 通用数据编辑代理对象类 class I_PLUGIN_EXPORT ZxComboBoxDelegate : public QItemDelegate { Q_OBJECT public: explicit ZxComboBoxDelegate(const QStringList& lstItemText, QObject* parent = 0); virtual ~ZxComboBoxDelegate(); public: // 函数重载部分 void paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget* editor, const QModelIndex &index) const; void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex &index) const; void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; bool eventFilter(QObject* object, QEvent* event); signals: void itemChanged(const QModelIndex& index, QString& strText) const; private: QStringList m_lstItemText; };