mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Add RemoveTerminalStripCommand class
This commit is contained in:
@@ -26,7 +26,9 @@
|
|||||||
* @param strip
|
* @param strip
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
AddTerminalStripCommand::AddTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent) :
|
AddTerminalStripCommand::AddTerminalStripCommand(TerminalStrip *strip,
|
||||||
|
QETProject *project,
|
||||||
|
QUndoCommand *parent) :
|
||||||
QUndoCommand(parent),
|
QUndoCommand(parent),
|
||||||
m_strip(strip),
|
m_strip(strip),
|
||||||
m_project(project)
|
m_project(project)
|
||||||
@@ -48,3 +50,30 @@ void AddTerminalStripCommand::redo() {
|
|||||||
m_project->addTerminalStrip(m_strip);
|
m_project->addTerminalStrip(m_strip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RemoveTerminalStripCommand::RemoveTerminalStripCommand(TerminalStrip *strip,
|
||||||
|
QETProject *project,
|
||||||
|
QUndoCommand *parent) :
|
||||||
|
QUndoCommand(parent),
|
||||||
|
m_strip(strip),
|
||||||
|
m_project(project)
|
||||||
|
{
|
||||||
|
setText(QObject::tr("Supprimer un groupe de bornes"));
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveTerminalStripCommand::~RemoveTerminalStripCommand()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void RemoveTerminalStripCommand::undo()
|
||||||
|
{
|
||||||
|
if (m_project && m_strip) {
|
||||||
|
m_project->addTerminalStrip(m_strip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoveTerminalStripCommand::redo()
|
||||||
|
{
|
||||||
|
if (m_project && m_strip) {
|
||||||
|
m_project->removeTerminalStrip(m_strip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,4 +38,18 @@ class AddTerminalStripCommand : public QUndoCommand
|
|||||||
QPointer<QETProject> m_project;
|
QPointer<QETProject> m_project;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RemoveTerminalStripCommand : public QUndoCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RemoveTerminalStripCommand(TerminalStrip *strip, QETProject *project, QUndoCommand *parent = nullptr);
|
||||||
|
~RemoveTerminalStripCommand() override;
|
||||||
|
|
||||||
|
void undo() override;
|
||||||
|
void redo() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPointer<TerminalStrip> m_strip;
|
||||||
|
QPointer<QETProject> m_project;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // ADDTERMINALSTRIPCOMMAND_H
|
#endif // ADDTERMINALSTRIPCOMMAND_H
|
||||||
|
|||||||
Reference in New Issue
Block a user