#ifndef QCOMBOXDELEGATE_H
|
#define QCOMBOXDELEGATE_H
|
|
#include <QItemDelegate>
|
#include <QComboBox>
|
#include <vector>
|
using namespace std;
|
|
class QComBoxDelegate : public QItemDelegate
|
{
|
|
public:
|
QComBoxDelegate();
|
QComBoxDelegate(QObject * p=0);
|
|
|
// 创建编辑器
|
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
|
// 显示编辑器,更新几何位置
|
void updateEditorGeometry(QWidget *editor, 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;
|
};
|
|
#endif // QCOMBOXDELEGATE_H
|