Follow up Auto-break conductors

This commit is contained in:
Kellermorph
2026-08-08 22:10:47 +02:00
parent 3eafe840f1
commit 39b1e836bf
7 changed files with 333 additions and 213 deletions
+48
View File
@@ -0,0 +1,48 @@
/*
Copyright 2006-2026 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AUTOBREAKCONDUCTOR_H
#define AUTOBREAKCONDUCTOR_H
#include <QSet>
class Diagram;
class Element;
class Terminal;
class QUndoCommand;
/**
@brief autoBreakConductors
For each terminal of @a element, check if its dock point lies on an
existing conductor. If so, break the conductor and reconnect through the
element's terminal. Broken conductors from the same circuit (sharing the
same far-end endpoint) are broken together; independent crossing
conductors are left untouched.
@param diagram the diagram containing the conductors
@param element the element whose terminals trigger breaks
@param parent undo command under which break/reconnect sub-commands
are created (may be nullptr, in which case no undo is
recorded)
@return set of terminals that were connected to a broken conductor's
far-end (useful for preventing duplicate auto-connect)
*/
QSet<Terminal *> autoBreakConductors(
Diagram *diagram,
Element *element,
QUndoCommand *parent);
#endif // AUTOBREAKCONDUCTOR_H