mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-04 18:04:14 +02:00
Fix #1177: Space rotated the selection, not the part being added
In the symbol editor, Space is the shortcut of the Rotate action, which rotates the selected parts. The action is enabled whenever something is selected, and a window shortcut is handled before the key reaches the scene, so while a terminal or arc was being placed with something already selected, Space rotated the selection and never reached ESEventAddTerminal / ESEventAddArc. With nothing selected the action was disabled and the key fell through, which is why it only happened with a selection. The scene now emits behaviorChanged() when it enters or leaves AddPart, and updateAction() keeps the selection actions (rotate, fine rotate, flip, mirror, cut, delete, depth) disabled while a part is being added. They come back when the tool ends. The selection itself is left alone. ESEventInterface::init() also gives the view keyboard focus: a selection made in the parts list left the focus there, so Space still never reached the tool. ~ElementScene blocks its signals before deleting the event interface, whose destructor resets the behavior while the editor is being destroyed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -148,6 +148,9 @@ ElementScene::~ElementScene()
|
||||
disconnect(&m_undo_stack, &QUndoStack::indexChanged, this, &ElementScene::managePrimitivesGroups);
|
||||
delete m_decorator_lock;
|
||||
|
||||
//Deleting the event interface resets the behavior; the editor
|
||||
//is already being destroyed, so it must not hear about it.
|
||||
blockSignals(true);
|
||||
if (m_event_interface)
|
||||
delete m_event_interface;
|
||||
|
||||
@@ -417,7 +420,10 @@ void ElementScene::clearEventInterface()
|
||||
*/
|
||||
void ElementScene::setBehavior(ElementScene::Behavior b)
|
||||
{
|
||||
if (b == m_behavior)
|
||||
return;
|
||||
m_behavior = b;
|
||||
emit behaviorChanged();
|
||||
}
|
||||
|
||||
ElementScene::Behavior ElementScene::behavior() const
|
||||
|
||||
Reference in New Issue
Block a user