mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-20 07:14:13 +02:00
Merge pull request #921 from arummler/master-fix-group-rotation
Fix: "group rotate"
This commit is contained in:
@@ -135,14 +135,29 @@ Element::Element(
|
||||
| QGraphicsItem::ItemIsSelectable);
|
||||
setAcceptHoverEvents(true);
|
||||
|
||||
connect(this, &Element::rotationChanged, [this]()
|
||||
{
|
||||
/* Keep docked conductors attached whenever this element's
|
||||
* rotation OR scene position changes. Ordinary single-item
|
||||
* dragging already refreshes conductors explicitly, via
|
||||
* ElementsMover::continueMovement() calling
|
||||
* Conductor::updatePath(). But other code paths change an
|
||||
* element's rotation/pos properties directly -- notably
|
||||
* RotateSelectionCommand's group-rotation mode, which moves
|
||||
* each element around a shared pivot via a "pos"
|
||||
* QPropertyUndoCommand instead of going through
|
||||
* ElementsMover -- and those need this hook or the
|
||||
* conductor's path is left stale, still drawn to the
|
||||
* terminal's old scene position. */
|
||||
auto update_docked_conductors = [this]()
|
||||
{
|
||||
for(QGraphicsItem *qgi : childItems())
|
||||
{
|
||||
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi))
|
||||
t->updateConductor();
|
||||
}
|
||||
});
|
||||
};
|
||||
connect(this, &Element::rotationChanged, update_docked_conductors);
|
||||
connect(this, &Element::xChanged, update_docked_conductors);
|
||||
connect(this, &Element::yChanged, update_docked_conductors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user