mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 08:40:53 +01:00
Element editor : improve code
Better use of signal partsAdded and partsRemoved
This commit is contained in:
@@ -823,16 +823,14 @@ void ElementScene::slot_invertSelection()
|
||||
*/
|
||||
void ElementScene::slot_delete()
|
||||
{
|
||||
// check that there is something selected
|
||||
// verifie qu'il y a qqc de selectionne
|
||||
QList<QGraphicsItem *> selected_items = selectedItems();
|
||||
if (selected_items.isEmpty()) return;
|
||||
const auto selected_items{selectedItems().toVector()};
|
||||
if (selected_items.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// erase everything that is selected
|
||||
// efface tout ce qui est selectionne
|
||||
m_undo_stack.push(new DeletePartsCommand(this, selected_items));
|
||||
|
||||
// removing items does not trigger QGraphicsScene::selectionChanged()
|
||||
// removing items does not trigger QGraphicsScene::selectionChanged()
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user