diff options
author | Arno <am@disconnect.de> | 2010-06-16 22:45:24 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-06-16 22:45:24 +0200 |
commit | f5a7d411051d3112a90e26f1e382dc1e00fb9a00 (patch) | |
tree | 568cb272df4a645d5208a2177b2e09647b689be3 /smtreeitem.cpp | |
parent | c7e25a4bb75417f1615b71940694f5f4479f9043 (diff) | |
download | SheMov-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 'smtreeitem.cpp')
-rw-r--r-- | smtreeitem.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/smtreeitem.cpp b/smtreeitem.cpp index 950926e..e7f4336 100644 --- a/smtreeitem.cpp +++ b/smtreeitem.cpp @@ -23,7 +23,7 @@ void SmTreeItem::appendChild(SmTreeItem *child){ mChildren.append(child); } -SmTreeItem *SmTreeItem::child(int row){ +SmTreeItem *SmTreeItem::child(int row) const{ return mChildren.at(row); } @@ -46,6 +46,10 @@ SmTreeItem *SmTreeItem::parent(){ return mParent; } +void SmTreeItem::setParent(SmTreeItem *parent){ + mParent = parent; +} + QVariant SmTreeItem::data(int column) const{ return mData.at(column); } @@ -62,10 +66,13 @@ bool SmTreeItem::insertChild(int where, SmTreeItem *child){ return true; } -bool SmTreeItem::removeChild(int where){ +bool SmTreeItem::removeChild(int where, bool deleteChild){ if((where < 0) || (where >= mChildren.count())){ return false; } - delete mChildren.takeAt(where); + SmTreeItem *child = mChildren.takeAt(where); + if(deleteChild){ + delete child; + } return true; } |