Merge pull request #1111 from ispyisail/feat/1070-rotate-whole-group

Rotate a selected group as one piece
This commit is contained in:
Laurent Trinques
2026-09-28 14:55:04 +02:00
committed by GitHub
4 changed files with 73 additions and 1 deletions
+31
View File
@@ -163,3 +163,34 @@ bool ItemGroups::completeSelection(QGraphicsScene *scene,
}
return changed;
}
/**
@return the group @a selected is exactly, whole -- every item in it
belongs to that group and every member of the group is in it -- or a null
uuid. Rotating such a selection turns the group as one piece rather than
each member in place (discussion #1070). A member picked out on its own
is not a whole group, and turns in place.
@param selected : the selected items that can be members (the caller
leaves out wires, which follow their symbols)
*/
QUuid ItemGroups::soleWholeGroup(const QList<QGraphicsItem *> &selected)
{
if (selected.isEmpty() || !selected.first()->scene()) {
return QUuid();
}
const QUuid group = groupOf(selected.first());
if (group.isNull()) {
return QUuid();
}
for (QGraphicsItem *item : selected) {
if (groupOf(item) != group) {
return QUuid();
}
}
for (QGraphicsItem *item : selected.first()->scene()->items()) {
if (groupOf(item) == group && !item->isSelected()) {
return QUuid();
}
}
return group;
}