DTrashItemInfo DTrashItemModel::itemForIndex(const QModelIndex& index) { if (!index.isValid()) return DTrashItemInfo(); return d->data.at(index.row()); }
void TrashView::selectLastSelected() { if (d->model->isEmpty()) { d->lastSelectedItem = DTrashItemInfo(); d->lastSelectedIndex = QModelIndex(); } else if (!d->lastSelectedIndex.isValid()) { d->tableView->selectRow(0); d->tableView->scrollTo(QModelIndex(), QAbstractItemView::EnsureVisible); } else { d->tableView->selectRow(d->lastSelectedIndex.row()); d->tableView->scrollTo(d->lastSelectedIndex, QAbstractItemView::EnsureVisible); } emit selectionChanged(); }