#ifndef MYTESTTREE_H #define MYTESTTREE_H #include // Just a tree with exactly one level, the structure of this does not really matter for this example class MyTestTree : public QAbstractItemModel { Q_OBJECT public: explicit MyTestTree(QObject *parent = 0); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant data(const QModelIndex &index, int role) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; protected: static const int NUM_COLUMNS; }; #endif // MYTESTTREE_H