From da30a02976792a07c72e8be01aebde019a6a09d5 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 27 Nov 2010 12:28:34 +0100 Subject: 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. --- seriestreemodel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'seriestreemodel.cpp') diff --git a/seriestreemodel.cpp b/seriestreemodel.cpp index ab3fe8c..a2bde55 100644 --- a/seriestreemodel.cpp +++ b/seriestreemodel.cpp @@ -164,15 +164,19 @@ QList 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(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(); -- cgit v1.2.3-70-g09d2