Corrected moving features to trash.

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent 70b0ea9459
commit 6c5dcd6696
  1. 11
      src/gui/UBFeaturesWidget.cpp

@ -169,10 +169,9 @@ void UBFeaturesWidget::deleteElements( const UBFeaturesMimeData * mimeData )
void UBFeaturesWidget::deleteSelectedElements() void UBFeaturesWidget::deleteSelectedElements()
{ {
QModelIndexList selected = centralWidget->listView()->selectionModel()->selectedIndexes(); QModelIndexList selected = centralWidget->listView()->selectionModel()->selectedIndexes();
do
foreach ( QModelIndex sel, selected )
{ {
UBFeature feature = sel.data(Qt::UserRole + 1).value<UBFeature>(); UBFeature feature = controller->getFeature(selected.at(0), objNameFeatureList);
if (feature.isDeletable()) { if (feature.isDeletable()) {
if (feature.inTrash()) { if (feature.inTrash()) {
controller->deleteItem(feature); controller->deleteItem(feature);
@ -180,7 +179,11 @@ void UBFeaturesWidget::deleteSelectedElements()
controller->moveToTrash(feature, true); controller->moveToTrash(feature, true);
} }
} }
} selected = centralWidget->listView()->selectionModel()->selectedIndexes();
if (!selected.isEmpty())
centralWidget->listView()->selectionModel()->select(selected.at(0), QItemSelectionModel::Deselect);
}while (!selected.isEmpty());
controller->refreshModels(); controller->refreshModels();
} }

Loading…
Cancel
Save