forked from qt-creator/qt-creator
BaseTreeView: add convenience function to get selected or current rows
Change-Id: I3239c52ad2d1eb725e4c10aeb93ee2e73ad5c0b6 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user