File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1307,9 +1307,13 @@ void ObsListDialog::removeObjectButtonPressed()
13071307{
13081308 Q_ASSERT (isEditMode);
13091309
1310- int number = ui->treeView ->currentIndex ().row ();
1311- QString uuid = itemModel->index (number, ColumnUUID).data ().toString ();
1312- itemModel->removeRow (number);
1310+ // Convert selected UI row (potentially sorted) into itemModel row (unsorted)
1311+ QModelIndex index = ui->treeView ->currentIndex ();
1312+ QSortFilterProxyModel* proxy = qobject_cast<QSortFilterProxyModel*>(ui->treeView ->model ());
1313+ int sourceRow = proxy ? proxy->mapToSource (index).row () : index.row ();
1314+
1315+ QString uuid = itemModel->index (sourceRow, ColumnUUID).data ().toString ();
1316+ itemModel->removeRow (sourceRow);
13131317 currentItemCollection.remove (uuid);
13141318 tainted=true ;
13151319}
You can’t perform that action at this time.
0 commit comments