diff options
Diffstat (limited to 'examples/tutorials/modelview/5_edit/mymodel.h')
-rwxr-xr-x | examples/tutorials/modelview/5_edit/mymodel.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h new file mode 100755 index 0000000000..f8fac77909 --- /dev/null +++ b/examples/tutorials/modelview/5_edit/mymodel.h @@ -0,0 +1,24 @@ +#ifndef MYMODEL_H +#define MYMODEL_H + +#include <QAbstractTableModel> +#include <QStringList> + +class MyModel : public QAbstractTableModel +{ + Q_OBJECT +public: + MyModel(QObject *parent); + int rowCount(const QModelIndex &parent = QModelIndex()) const ; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); + Qt::ItemFlags flags ( const QModelIndex & index ) const ; +private: + QStringList m_gridData; //holds text entered into QTableView + int modelIndexToOffset(const QModelIndex & index) const; +signals: + void editCompleted(const QString &); +}; + +#endif // MYMODEL_H |