QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
SetAutoNumContextCommand Class Reference

The SetAutoNumContextCommand class Undo/redo wrapper around one of QETProject's add*AutoNum() setters (conductor/element/folio numerotation counters). Placing an auto-numbered item advances one of these counters as a side effect; without this command the counter change sits outside the undo stack entirely, so undoing the placement removes the visible number but leaves the counter advanced, silently burning it. More...

#include <setautonumcontextcommand.h>

Inherits QUndoCommand.

Collaboration diagram for SetAutoNumContextCommand:
Collaboration graph

Public Types

using Setter = std::function<void(const QString &, const NumerotationContext &)>

Public Member Functions

 SetAutoNumContextCommand (Setter setter, const QString &key, const NumerotationContext &old_context, const NumerotationContext &new_context, QUndoCommand *parent=nullptr)
 SetAutoNumContextCommand::SetAutoNumContextCommand.
void undo () override
void redo () override

Private Attributes

Setter m_setter
QString m_key
NumerotationContext m_old_context
NumerotationContext m_new_context

Detailed Description

The SetAutoNumContextCommand class Undo/redo wrapper around one of QETProject's add*AutoNum() setters (conductor/element/folio numerotation counters). Placing an auto-numbered item advances one of these counters as a side effect; without this command the counter change sits outside the undo stack entirely, so undoing the placement removes the visible number but leaves the counter advanced, silently burning it.

Member Typedef Documentation

◆ Setter

using SetAutoNumContextCommand::Setter = std::function<void(const QString &, const NumerotationContext &)>

Constructor & Destructor Documentation

◆ SetAutoNumContextCommand()

SetAutoNumContextCommand::SetAutoNumContextCommand ( Setter setter,
const QString & key,
const NumerotationContext & old_context,
const NumerotationContext & new_context,
QUndoCommand * parent = nullptr )

SetAutoNumContextCommand::SetAutoNumContextCommand.

Parameters
setterthe QETProject setter to call on undo/redo (addConductorAutoNum/addElementAutoNum/addFolioAutoNum, bound to a project)
keythe numerotation context's name/key
old_contextthe context's value before this placement
new_contextthe context's value after this placement
parentparent undo command

Member Function Documentation

◆ redo()

void SetAutoNumContextCommand::redo ( )
override

◆ undo()

void SetAutoNumContextCommand::undo ( )
override

Member Data Documentation

◆ m_key

QString SetAutoNumContextCommand::m_key
private

◆ m_new_context

NumerotationContext SetAutoNumContextCommand::m_new_context
private

◆ m_old_context

NumerotationContext SetAutoNumContextCommand::m_old_context
private

◆ m_setter

Setter SetAutoNumContextCommand::m_setter
private

The documentation for this class was generated from the following files: