Element editor : improve deletion speed

This commit is contained in:
joshua 2022-08-13 13:06:46 +02:00
parent eee1c7fff7
commit d6e8a1c133

View File

@ -745,9 +745,19 @@ void ElementScene::addItems(QVector<QGraphicsItem *> items)
*/ */
void ElementScene::removeItems(QVector<QGraphicsItem *> items) void ElementScene::removeItems(QVector<QGraphicsItem *> items)
{ {
const int previous_selected_count{selectedItems().size()};
//block signal to avoid multiple emit of selection changed,
//we emit this signal only once at the end of this function.
blockSignals(true);
for (const auto &item : items) { for (const auto &item : items) {
removeItem(item); removeItem(item);
} }
blockSignals(false);
if (previous_selected_count != selectedItems().size()) {
emit selectionChanged();
}
emit partsRemoved(); emit partsRemoved();
} }