Fix : undo code is executed in redo function and vice versa

Need to sleep ?
This commit is contained in:
joshua
2021-04-05 19:59:06 +02:00
parent 573c0c236a
commit 2cf5ea11fd
3 changed files with 8 additions and 8 deletions

View File

@@ -38,13 +38,13 @@ AddTerminalStripCommand::~AddTerminalStripCommand()
{} {}
void AddTerminalStripCommand::undo() { void AddTerminalStripCommand::undo() {
if (m_project && m_strip) { if (m_project && m_strip) {
m_project->addTerminalStrip(m_strip); m_project->removeTerminalStrip(m_strip);
} }
} }
void AddTerminalStripCommand::redo() { void AddTerminalStripCommand::redo() {
if (m_project && m_strip) { if (m_project && m_strip) {
m_project->removeTerminalStrip(m_strip); m_project->addTerminalStrip(m_strip);
} }
} }

View File

@@ -27,7 +27,7 @@ class QETProject;
class AddTerminalStripCommand : public QUndoCommand class AddTerminalStripCommand : public QUndoCommand
{ {
public: public:
AddTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent); AddTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent = nullptr);
~AddTerminalStripCommand() override; ~AddTerminalStripCommand() override;
void undo() override; void undo() override;

View File

@@ -1857,7 +1857,7 @@ bool QETProject::addTerminalStrip(TerminalStrip *strip)
if (strip->parent() != this) if (strip->parent() != this)
return false; return false;
if (!m_terminal_strip_vector.contains(strip)) if (m_terminal_strip_vector.contains(strip))
return true; return true;
m_terminal_strip_vector.append(strip); m_terminal_strip_vector.append(strip);