#include "QItemDelegate"
#include <QLineEdit>
#include <QPlainTextEdit>
// TableView.ItemDelegate选项
enum EditStyle
{
None, // 不能编辑
Simple, // 默认编辑框
PlainEdit, // 多行编辑框
LineEdit, // 单行编辑框
};
class CustomeDelegate :public QItemDelegate
{
public:
explicit CustomeDelegate(QObject *parent = nullptr);
~CustomeDelegate();
public:
virtual EditStyle editStyle(const QModelIndex &index, bool &readOnly) const;
QWidget *createEditor(QWidget *parent,const QStyleOptionViewItem &option,const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
};
CustomeDelegate::CustomeDelegate(QObject *parent /*= nullptr*/):QItemDelegate(parent)
{
}
Custome