Add "parent terminal" strip member to TerminalElement class

This commit is contained in:
joshua
2021-04-04 19:41:32 +02:00
parent a3f776b7db
commit 00846c1418
2 changed files with 30 additions and 0 deletions

View File

@@ -40,3 +40,26 @@ void TerminalElement::initLink(QETProject *project) {
Element::initLink(project);
}
/**
* @brief TerminalElement::setParentTerminalStrip
* Set \p strip as parent terminal strip.
* Be carefull, this function only set internally the parent terminal strip.
* This function don't check if there is a previous
* parent terminal strip and don't check
* if the new terminal strip have this terminal element
* in her list of terminal element.
* @param strip
*/
void TerminalElement::setParentTerminalStrip(TerminalStrip *strip) {
m_parent_terminal_strip = strip;
}
/**
* @brief TerminalElement::parentTerminalStrip
* @return The parent terminal strip of this
* terminal element or nullptr if not.
*/
TerminalStrip *TerminalElement::parentTerminalStrip() const {
return m_parent_terminal_strip.data();
}

View File

@@ -20,6 +20,7 @@
#include "element.h"
#include "../TerminalStrip/terminalstrip.h"
class QETProject;
/**
@@ -33,6 +34,12 @@ class TerminalElement : public Element
QGraphicsItem * = nullptr, int * = nullptr);
~TerminalElement() override;
void initLink(QETProject *project) override;
void setParentTerminalStrip(TerminalStrip *strip);
TerminalStrip *parentTerminalStrip() const;
private:
QPointer<TerminalStrip> m_parent_terminal_strip;
};
#endif // TERMINALELEMENT_H