mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
Fix model/view bug: do not delete all rows when deleting in a filtered view
This commit is contained in:
@@ -1070,21 +1070,21 @@ namespace BlackGui
|
|||||||
if (this->isEmpty()) { return 0; }
|
if (this->isEmpty()) { return 0; }
|
||||||
|
|
||||||
const int currentRows = this->rowCount();
|
const int currentRows = this->rowCount();
|
||||||
if (currentRows == selectedRowCount())
|
if (!this->hasFilter() && currentRows == this->selectedRowCount())
|
||||||
{
|
{
|
||||||
this->clear();
|
// shortcut if all are selected
|
||||||
|
this->clear(); // clear all
|
||||||
return currentRows;
|
return currentRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ContainerType selected(selectedObjects());
|
const ContainerType selected(selectedObjects());
|
||||||
ContainerType newObjects(container());
|
ContainerType unselectedObjects(container());
|
||||||
for (const ObjectType &obj : selected)
|
for (const ObjectType &obj : selected)
|
||||||
{
|
{
|
||||||
newObjects.remove(obj);
|
unselectedObjects.remove(obj);
|
||||||
}
|
}
|
||||||
|
const int delta = currentRows - unselectedObjects.size();
|
||||||
const int delta = currentRows - newObjects.size();
|
this->updateContainerMaybeAsync(unselectedObjects);
|
||||||
this->updateContainerMaybeAsync(newObjects);
|
|
||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user