summaryrefslogtreecommitdiffstats
path: root/smtreemodel.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-06-16 22:45:24 +0200
committerArno <am@disconnect.de>2010-06-16 22:45:24 +0200
commitf5a7d411051d3112a90e26f1e382dc1e00fb9a00 (patch)
tree568cb272df4a645d5208a2177b2e09647b689be3 /smtreemodel.h
parentc7e25a4bb75417f1615b71940694f5f4479f9043 (diff)
downloadSheMov-f5a7d411051d3112a90e26f1e382dc1e00fb9a00.tar.gz
SheMov-f5a7d411051d3112a90e26f1e382dc1e00fb9a00.tar.bz2
SheMov-f5a7d411051d3112a90e26f1e382dc1e00fb9a00.zip
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 :(
Diffstat (limited to 'smtreemodel.h')
-rw-r--r--smtreemodel.h12
1 files changed, 8 insertions, 4 deletions
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);