21 #ifndef GLSIMPLEENTITYITEMMODEL_H 22 #define GLSIMPLEENTITYITEMMODEL_H 24 #include <QAbstractItemModel> 26 #include <tulip/tulipconf.h> 32 class TLP_QT_SCOPE GlSimpleEntityItemEditor {
34 GlSimpleEntityItemEditor(GlSimpleEntity *ent) : entity(ent) {}
35 virtual ~GlSimpleEntityItemEditor() {}
46 virtual QStringList propertiesNames()
const;
58 virtual QVariantList propertiesQVariant()
const;
73 virtual void setProperty(
const QString &name,
const QVariant &value);
76 GlSimpleEntity *entity;
79 class TLP_QT_SCOPE GlSimpleEntityItemModel :
public QAbstractItemModel {
81 Q_ENUMS(SimpleEntityRole)
84 enum SimpleEntityRole { SimpleEntityRole = Qt::UserRole + 1 };
86 GlSimpleEntityItemModel(GlSimpleEntityItemEditor *itemEditor, QObject *parent =
nullptr);
87 ~GlSimpleEntityItemModel()
override;
89 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
90 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
91 QModelIndex parent(
const QModelIndex &child)
const override;
93 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const override;
94 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
95 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
97 QString headerText()
const {
98 return QString(
"toto");
101 bool setData(
const QModelIndex &index,
const QVariant &value,
int role)
override;
103 Qt::ItemFlags flags(
const QModelIndex &index)
const override {
104 return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
108 GlSimpleEntityItemEditor *editor;
112 #endif // GLSIMPLEENTITYITEMMODEL_H