Merge branch 'terminal_strip'

* terminal_strip:
  Several real terminal can be added to terminal strip in one shot
  Minor : avoid unnecessary multiple function call
  The free terminal properties can be edited by batch.
  Change made inside the free terminal table can be applied
  Hide/show apply/reset buttons according to current displayed widget
  Edited data of terminal strip can be applied
  Change terminal strip editor class
  Add free terminal editor widget
  Add toolbar and buttons
  Start to move terminal strip editor from QDialog to QMainWindow
  Add table widget and item model for free terminal
  Revamp code
  Improve undo command when add/move/remove terminal in/from/to terminal strip
  Revamp code.
  Revamp code, make it more simple
  Remove the real terminal uuid, and use instead the uuid of the terminal element itself
  RealTerminal is created by the TerminalElement itself
  Change relationship betwen classes RealTerminal PhysicalTerminald and TerminalElement
  QTreeWidget "terminal explorer" : improve item text
  minor : remove unused code
This commit is contained in:
joshua
2022-04-09 11:54:58 +02:00
36 changed files with 2650 additions and 1097 deletions

View File

@@ -16,6 +16,7 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "terminalelement.h"
#include"../TerminalStrip/realterminal.h"
/**
@brief TerminalElement::TerminalElement
@@ -27,7 +28,10 @@
TerminalElement::TerminalElement(const ElementsLocation &location,
QGraphicsItem *qgi, int *state) :
Element(location, qgi, state, Element::Terminale)
{}
{
auto rt = new RealTerminal(this);
m_real_terminal = rt->sharedRef();
}
TerminalElement::~TerminalElement()
{}
@@ -41,17 +45,11 @@ void TerminalElement::initLink(QETProject *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
* @brief TerminalElement::realTerminal
* @return the real terminal of this terminal element.
*/
void TerminalElement::setParentTerminalStrip(TerminalStrip *strip) {
m_parent_terminal_strip = strip;
QSharedPointer<RealTerminal> TerminalElement::realTerminal() const {
return m_real_terminal;
}
/**
@@ -60,6 +58,9 @@ void TerminalElement::setParentTerminalStrip(TerminalStrip *strip) {
* terminal element or nullptr if not.
*/
TerminalStrip *TerminalElement::parentTerminalStrip() const {
return m_parent_terminal_strip.data();
if (m_real_terminal) {
return m_real_terminal->parentStrip();
}
return nullptr;
}

View File

@@ -23,6 +23,7 @@
#include "../TerminalStrip/terminalstrip.h"
class QETProject;
class RealTerminal;
/**
@brief The TerminalElement class
*/
@@ -35,11 +36,12 @@ class TerminalElement : public Element
~TerminalElement() override;
void initLink(QETProject *project) override;
QSharedPointer<RealTerminal> realTerminal() const;
void setParentTerminalStrip(TerminalStrip *strip);
TerminalStrip *parentTerminalStrip() const;
private:
QPointer<TerminalStrip> m_parent_terminal_strip;
QSharedPointer<RealTerminal> m_real_terminal;
};
#endif // TERMINALELEMENT_H