From f5a7d411051d3112a90e26f1e382dc1e00fb9a00 Mon Sep 17 00:00:00 2001 From: Arno Date: Wed, 16 Jun 2010 22:45:24 +0200 Subject: Treemodel Development -Changed the database schema. Attached quality to files -Subclassed SmTreeModel for SeriesTreeModel -Made SmTreeModel virtual for that Well, it seems there is a serious problem with the database schema. Curiously everything inside the model works beside the db update. Seems I have it wrong with the fks :( --- smtreemodel.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'smtreemodel.h') diff --git a/smtreemodel.h b/smtreemodel.h index 698a2ce..ae3b5ce 100644 --- a/smtreemodel.h +++ b/smtreemodel.h @@ -17,7 +17,7 @@ class SmTreeModel : public QAbstractItemModel { Q_OBJECT public: explicit SmTreeModel(const QStringList &headers, QObject *parent = 0); - ~SmTreeModel(); + virtual ~SmTreeModel(); // counts int rowCount(const QModelIndex &parent) const; @@ -26,14 +26,18 @@ class SmTreeModel : public QAbstractItemModel { // index, parent and flags QModelIndex index(int row, int column, const QModelIndex &parent) const; QModelIndex parent(const QModelIndex &child) const; - Qt::ItemFlags flags(const QModelIndex &index) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; // headers + data QVariant headerData(int section, Qt::Orientation orientation, int role) const; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role); - QVariant data(const QModelIndex &index, int role) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); + virtual QVariant data(const QModelIndex &index, int role) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role); + + // root + parent item bool setRoot(SmTreeItem *rootItem); + SmTreeItem *root() const { return mRootItem; } + SmTreeItem *parentItem(const QModelIndex &child) const; // row manipulation bool insertRows(int row, int count, const QModelIndex &parent); -- cgit v1.2.3-70-g09d2