mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Fix : undo code is executed in redo function and vice versa
Need to sleep ?
This commit is contained in:
@@ -39,12 +39,12 @@ AddTerminalStripCommand::~AddTerminalStripCommand()
|
||||
|
||||
void AddTerminalStripCommand::undo() {
|
||||
if (m_project && m_strip) {
|
||||
m_project->addTerminalStrip(m_strip);
|
||||
m_project->removeTerminalStrip(m_strip);
|
||||
}
|
||||
}
|
||||
|
||||
void AddTerminalStripCommand::redo() {
|
||||
if (m_project && m_strip) {
|
||||
m_project->removeTerminalStrip(m_strip);
|
||||
m_project->addTerminalStrip(m_strip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class QETProject;
|
||||
class AddTerminalStripCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
AddTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent);
|
||||
AddTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent = nullptr);
|
||||
~AddTerminalStripCommand() override;
|
||||
|
||||
void undo() override;
|
||||
|
||||
@@ -1857,7 +1857,7 @@ bool QETProject::addTerminalStrip(TerminalStrip *strip)
|
||||
if (strip->parent() != this)
|
||||
return false;
|
||||
|
||||
if (!m_terminal_strip_vector.contains(strip))
|
||||
if (m_terminal_strip_vector.contains(strip))
|
||||
return true;
|
||||
|
||||
m_terminal_strip_vector.append(strip);
|
||||
|
||||
Reference in New Issue
Block a user