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.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'smtreemodel.cpp') diff --git a/smtreemodel.cpp b/smtreemodel.cpp index c762802..292ed20 100644 --- a/smtreemodel.cpp +++ b/smtreemodel.cpp @@ -118,6 +118,14 @@ bool SmTreeModel::setRoot(SmTreeItem *rootItem){ return false; } +SmTreeItem *SmTreeModel::parentItem(const QModelIndex &child) const{ + QModelIndex parent = child.parent(); + if(parent == QModelIndex()){ + return mRootItem; + } + return static_cast(child.parent().internalPointer()); +} + bool SmTreeModel::insertRows(int row, int count, const QModelIndex &parent){ SmTreeItem *parentItem = itemAt(parent); bool retval; -- cgit v1.2.3-70-g09d2