Set parent terminal strip of terminal element

Call the method :
void TerminalElement::setParentTerminalStrip(TerminalStrip *strip)
when a terminal element is added to a terminal strip.
This commit is contained in:
joshua
2021-04-29 19:19:55 +02:00
parent 256d42d030
commit b158984464

View File

@@ -18,6 +18,7 @@
#include "terminalstrip.h"
#include "../qetproject.h"
#include "../qetgraphicsitem/element.h"
#include "../qetgraphicsitem/terminalelement.h"
using shared_real_terminal = QSharedPointer<RealTerminal>;
using shared_physical_terminal = QSharedPointer<PhysicalTerminal>;
@@ -231,6 +232,8 @@ bool TerminalStrip::addTerminal(Element *terminal)
m_physical_terminals.append(physical_terminal);
static_cast<TerminalElement *>(terminal)->setParentTerminalStrip(this);
return true;
}
@@ -256,6 +259,8 @@ bool TerminalStrip::removeTerminal(Element *terminal)
}
m_real_terminals.removeOne(real_terminal);
static_cast<TerminalElement *>(terminal)->setParentTerminalStrip(nullptr);
return true;
}