summaryrefslogtreecommitdiffstats
path: root/seriestreemodel.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-11-27 12:28:34 +0100
committerArno <am@disconnect.de>2010-11-27 12:28:34 +0100
commitda30a02976792a07c72e8be01aebde019a6a09d5 (patch)
tree7643cddb956a258eea9aeda2990313fd6fa92d32 /seriestreemodel.cpp
parent0f3f7598e4a3ee58c330cc7424cf89ea3e692da0 (diff)
downloadSheMov-da30a02976792a07c72e8be01aebde019a6a09d5.tar.gz
SheMov-da30a02976792a07c72e8be01aebde019a6a09d5.tar.bz2
SheMov-da30a02976792a07c72e8be01aebde019a6a09d5.zip
Implemented dialog for showing movies without covers
Implemented a new dialog to show movies without covers. The view is a QTreeView with another model. While working on the model several shortcomings of SmTreeModel were resolved. findValue() now takes another argument to indicate the column the returned QModelIndex() should represent. Also, itemAt() was promoted from private to protected. It's quite useful for derived classes.
Diffstat (limited to 'seriestreemodel.cpp')
-rw-r--r--seriestreemodel.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/seriestreemodel.cpp b/seriestreemodel.cpp
index ab3fe8c..a2bde55 100644
--- a/seriestreemodel.cpp
+++ b/seriestreemodel.cpp
@@ -164,15 +164,19 @@ QList<QVariant> SeriesTreeModel::childrenColumnList(const QModelIndex &parent, i
return retval;
}
-QModelIndex SeriesTreeModel::findValue(const QVariant &value, const QModelIndex &parent, int column) const{
+QModelIndex SeriesTreeModel::findValue(const QVariant &value, const QModelIndex &parent, int searchColumn, int indexColumn) const{
SmTreeItem *parentItem = root();
if(parent != QModelIndex()){
parentItem = static_cast<SmTreeItem*>(parent.internalPointer());
}
for(int i = 0; i < parentItem->childCount(); ++i){
SmTreeItem *childItem = parentItem->child(i);
- if(value == childItem->data(column)){
- return createIndex(i, column, childItem);
+ if(value == childItem->data(searchColumn)){
+ if(indexColumn == -1){
+ return createIndex(i, searchColumn, childItem);
+ }else{
+ return createIndex(i, indexColumn, childItem);
+ }
}
}
return QModelIndex();