You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iBase/iPlugin/ZxComboBoxDelegate.h

42 lines
1.3 KiB
C++

#pragma once
#include <QItemDelegate>
#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;
};