BaseTreeView: add convenience function to get selected or current rows

Change-Id: I3239c52ad2d1eb725e4c10aeb93ee2e73ad5c0b6
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2013-01-10 15:23:12 +01:00
parent 3f945d6737
commit ca76c704fd
2 changed files with 13 additions and 0 deletions

View File

@@ -153,4 +153,16 @@ void BaseTreeView::reset()
resizeColumnsToContents();
}
QModelIndexList BaseTreeView::activeRows() const
{
QItemSelectionModel *selection = selectionModel();
QModelIndexList indices = selection->selectedRows();
if (indices.isEmpty()) {
QModelIndex current = selection->currentIndex();
if (current.isValid())
indices.append(current);
}
return indices;
}
} // namespace Utils