summaryrefslogtreecommitdiffstats
path: root/examples/tutorials/modelview/5_edit/mymodel.h
blob: f8fac77909d44038152c6b3a8fe624487a946cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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