LibrePCB Developers Documentation
|
The UndoCommand class represents a command which you can undo/redo. More...
#include <undocommand.h>
Public Member Functions | |
UndoCommand ()=delete | |
UndoCommand (const UndoCommand &other)=delete | |
UndoCommand (const QString &text) noexcept | |
virtual | ~UndoCommand () noexcept |
const QString & | getText () const noexcept |
bool | wasEverExecuted () const noexcept |
This method shows whether that command was ever executed (execute() called successfully) | |
bool | wasEverReverted () const noexcept |
This method shows whether that command was ever reverted (undo() called at least one time) | |
bool | isCurrentlyExecuted () const noexcept |
This method shows whether that command is currently executed (redo() called one time more than undo()) | |
virtual bool | execute () final |
Execute the command (must only be called once) | |
virtual void | undo () final |
Undo the command. | |
virtual void | redo () final |
Redo the command. | |
UndoCommand & | operator= (const UndoCommand &rhs)=delete |
Protected Member Functions | |
virtual bool | performExecute ()=0 |
Execute the command the first time. | |
virtual void | performUndo ()=0 |
Undo the command. | |
virtual void | performRedo ()=0 |
Redo the command. | |
Private Attributes | |
QString | mText |
bool | mIsExecuted |
Shows whether execute() was called or not. | |
int | mRedoCount |
Counter of how often redo() was called. | |
int | mUndoCount |
Counter of how often undo() was called. | |
The UndoCommand class represents a command which you can undo/redo.
See description of librepcb::editor::UndoStack for more details about the whole concept.
|
delete |
|
delete |
|
explicitnoexcept |
|
virtualnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
This method shows whether that command was ever executed (execute() called successfully)
|
inlinenoexcept |
This method shows whether that command was ever reverted (undo() called at least one time)
|
inlinenoexcept |
|
finalvirtual |
Execute the command (must only be called once)
true | If the command has done some changes |
false | If the command has done nothing (the command can be deleted) |
|
finalvirtual |
Undo the command.
|
finalvirtual |
Redo the command.
|
delete |
|
protectedpure virtual |
Execute the command the first time.
true | If the command has done some changes |
false | If the command has done nothing (the command can be deleted) |
Implemented in CmdAttributeEdit, CmdCircleEdit, CmdHoleEdit, CmdListElementInsert< T, P, OnEditedArgs >, CmdListElementRemove< T, P, OnEditedArgs >, CmdListElementsSwap< T, P, OnEditedArgs >, CmdPolygonEdit, CmdStrokeTextEdit, CmdTextEdit, CmdZoneEdit, CmdComponentEdit, CmdComponentPinSignalMapItemEdit, CmdComponentSignalEdit, CmdComponentSymbolVariantEdit, CmdComponentSymbolVariantItemEdit, CmdDeviceEdit, CmdDevicePadSignalMapItemEdit, CmdDragSelectedFootprintItems, CmdDragSelectedSymbolItems, CmdFootprintEdit, CmdFootprintPadEdit, CmdLibraryBaseElementEdit, CmdLibraryCategoryEdit, CmdLibraryEdit, CmdLibraryElementEdit, CmdPackageEdit, CmdPackageModelAdd, CmdPackageModelEdit, CmdPackageModelRemove, CmdPackagePadEdit, CmdPartEdit, CmdPasteFootprintItems, CmdPasteSymbolItems, CmdRemoveSelectedFootprintItems, CmdRemoveSelectedSymbolItems, CmdSymbolPinEdit, CmdAddComponentToCircuit, CmdAddDeviceToBoard, CmdAddSymbolToSchematic, CmdAssemblyVariantAdd, CmdAssemblyVariantEdit, CmdAssemblyVariantRemove, CmdBoardAdd, CmdBoardEdit, CmdBoardHoleAdd, CmdBoardHoleEdit, CmdBoardHoleRemove, CmdBoardNetLineEdit, CmdBoardNetPointEdit, CmdBoardNetSegmentAdd, CmdBoardNetSegmentAddElements, CmdBoardNetSegmentEdit, CmdBoardNetSegmentRemove, CmdBoardNetSegmentRemoveElements, CmdBoardPlaneAdd, CmdBoardPlaneEdit, CmdBoardPlaneRemove, CmdBoardPolygonAdd, CmdBoardPolygonEdit, CmdBoardPolygonRemove, CmdBoardRemove, CmdBoardSpecctraImport, CmdBoardSplitNetLine, CmdBoardStrokeTextAdd, CmdBoardStrokeTextEdit, CmdBoardStrokeTextRemove, CmdBoardViaEdit, CmdBoardZoneAdd, CmdBoardZoneEdit, CmdBoardZoneRemove, CmdChangeNetSignalOfSchematicNetSegment, CmdCombineAllNetSignalsUnderSchematicNetPoint, CmdCombineBoardNetSegments, CmdCombineNetSignals, CmdCombineSchematicNetSegments, CmdComponentInstanceAdd, CmdComponentInstanceEdit, CmdComponentInstanceRemove, CmdCompSigInstSetNetSignal, CmdDeviceInstanceAdd, CmdDeviceInstanceEdit, CmdDeviceInstanceRemove, CmdDeviceStrokeTextAdd, CmdDeviceStrokeTextRemove, CmdDeviceStrokeTextsReset, CmdDragSelectedBoardItems, CmdDragSelectedSchematicItems, CmdFlipSelectedBoardItems, CmdNetClassAdd, CmdNetClassEdit, CmdNetClassRemove, CmdNetSignalAdd, CmdNetSignalEdit, CmdNetSignalRemove, CmdPasteBoardItems, CmdPasteSchematicItems, CmdProjectEdit, CmdProjectLibraryAddElement< ElementType >, CmdProjectLibraryRemoveElement< ElementType >, CmdRemoveBoardItems, CmdRemoveSelectedBoardItems, CmdRemoveSelectedSchematicItems, CmdRemoveUnusedLibraryElements, CmdRemoveUnusedNetSignals, CmdReplaceDevice, CmdSchematicAdd, CmdSchematicEdit, CmdSchematicNetLabelAdd, CmdSchematicNetLabelEdit, CmdSchematicNetLabelRemove, CmdSchematicNetPointEdit, CmdSchematicNetSegmentAdd, CmdSchematicNetSegmentAddElements, CmdSchematicNetSegmentEdit, CmdSchematicNetSegmentRemove, CmdSchematicNetSegmentRemoveElements, CmdSchematicPolygonAdd, CmdSchematicPolygonRemove, CmdSchematicRemove, CmdSchematicTextAdd, CmdSchematicTextRemove, CmdSymbolInstanceAdd, CmdSymbolInstanceEdit, CmdSymbolInstanceRemove, CmdSymbolInstanceTextAdd, CmdSymbolInstanceTextRemove, CmdSymbolInstanceTextsReset, and UndoCommandGroup.
|
protectedpure virtual |
Undo the command.
Implemented in CmdAttributeEdit, CmdCircleEdit, CmdHoleEdit, CmdListElementInsert< T, P, OnEditedArgs >, CmdListElementRemove< T, P, OnEditedArgs >, CmdListElementsSwap< T, P, OnEditedArgs >, CmdPolygonEdit, CmdStrokeTextEdit, CmdTextEdit, CmdZoneEdit, CmdComponentEdit, CmdComponentPinSignalMapItemEdit, CmdComponentSignalEdit, CmdComponentSymbolVariantEdit, CmdComponentSymbolVariantItemEdit, CmdDeviceEdit, CmdDevicePadSignalMapItemEdit, CmdFootprintEdit, CmdFootprintPadEdit, CmdLibraryBaseElementEdit, CmdLibraryCategoryEdit, CmdLibraryEdit, CmdLibraryElementEdit, CmdPackageEdit, CmdPackageModelAdd, CmdPackageModelEdit, CmdPackageModelRemove, CmdPackagePadEdit, CmdPartEdit, CmdSymbolPinEdit, CmdAssemblyVariantAdd, CmdAssemblyVariantEdit, CmdAssemblyVariantRemove, CmdBoardAdd, CmdBoardEdit, CmdBoardHoleAdd, CmdBoardHoleEdit, CmdBoardHoleRemove, CmdBoardNetLineEdit, CmdBoardNetPointEdit, CmdBoardNetSegmentAdd, CmdBoardNetSegmentAddElements, CmdBoardNetSegmentEdit, CmdBoardNetSegmentRemove, CmdBoardNetSegmentRemoveElements, CmdBoardPlaneAdd, CmdBoardPlaneEdit, CmdBoardPlaneRemove, CmdBoardPolygonAdd, CmdBoardPolygonEdit, CmdBoardPolygonRemove, CmdBoardRemove, CmdBoardStrokeTextAdd, CmdBoardStrokeTextEdit, CmdBoardStrokeTextRemove, CmdBoardViaEdit, CmdBoardZoneAdd, CmdBoardZoneEdit, CmdBoardZoneRemove, CmdComponentInstanceAdd, CmdComponentInstanceEdit, CmdComponentInstanceRemove, CmdCompSigInstSetNetSignal, CmdDeviceInstanceAdd, CmdDeviceInstanceEdit, CmdDeviceInstanceRemove, CmdDeviceStrokeTextAdd, CmdDeviceStrokeTextRemove, CmdNetClassAdd, CmdNetClassEdit, CmdNetClassRemove, CmdNetSignalAdd, CmdNetSignalEdit, CmdNetSignalRemove, CmdProjectEdit, CmdProjectLibraryAddElement< ElementType >, CmdProjectLibraryRemoveElement< ElementType >, CmdRemoveSelectedBoardItems, CmdSchematicAdd, CmdSchematicEdit, CmdSchematicNetLabelAdd, CmdSchematicNetLabelEdit, CmdSchematicNetLabelRemove, CmdSchematicNetPointEdit, CmdSchematicNetSegmentAdd, CmdSchematicNetSegmentAddElements, CmdSchematicNetSegmentEdit, CmdSchematicNetSegmentRemove, CmdSchematicNetSegmentRemoveElements, CmdSchematicPolygonAdd, CmdSchematicPolygonRemove, CmdSchematicRemove, CmdSchematicTextAdd, CmdSchematicTextRemove, CmdSymbolInstanceAdd, CmdSymbolInstanceEdit, CmdSymbolInstanceRemove, CmdSymbolInstanceTextAdd, CmdSymbolInstanceTextRemove, and UndoCommandGroup.
|
protectedpure virtual |
Redo the command.
Implemented in CmdAttributeEdit, CmdCircleEdit, CmdHoleEdit, CmdListElementInsert< T, P, OnEditedArgs >, CmdListElementRemove< T, P, OnEditedArgs >, CmdListElementsSwap< T, P, OnEditedArgs >, CmdPolygonEdit, CmdStrokeTextEdit, CmdTextEdit, CmdZoneEdit, CmdComponentEdit, CmdComponentPinSignalMapItemEdit, CmdComponentSignalEdit, CmdComponentSymbolVariantEdit, CmdComponentSymbolVariantItemEdit, CmdDeviceEdit, CmdDevicePadSignalMapItemEdit, CmdFootprintEdit, CmdFootprintPadEdit, CmdLibraryBaseElementEdit, CmdLibraryCategoryEdit, CmdLibraryEdit, CmdLibraryElementEdit, CmdPackageEdit, CmdPackageModelAdd, CmdPackageModelEdit, CmdPackageModelRemove, CmdPackagePadEdit, CmdPartEdit, CmdSymbolPinEdit, CmdAssemblyVariantAdd, CmdAssemblyVariantEdit, CmdAssemblyVariantRemove, CmdBoardAdd, CmdBoardEdit, CmdBoardHoleAdd, CmdBoardHoleEdit, CmdBoardHoleRemove, CmdBoardNetLineEdit, CmdBoardNetPointEdit, CmdBoardNetSegmentAdd, CmdBoardNetSegmentAddElements, CmdBoardNetSegmentEdit, CmdBoardNetSegmentRemove, CmdBoardNetSegmentRemoveElements, CmdBoardPlaneAdd, CmdBoardPlaneEdit, CmdBoardPlaneRemove, CmdBoardPolygonAdd, CmdBoardPolygonEdit, CmdBoardPolygonRemove, CmdBoardRemove, CmdBoardStrokeTextAdd, CmdBoardStrokeTextEdit, CmdBoardStrokeTextRemove, CmdBoardViaEdit, CmdBoardZoneAdd, CmdBoardZoneEdit, CmdBoardZoneRemove, CmdComponentInstanceAdd, CmdComponentInstanceEdit, CmdComponentInstanceRemove, CmdCompSigInstSetNetSignal, CmdDeviceInstanceAdd, CmdDeviceInstanceEdit, CmdDeviceInstanceRemove, CmdDeviceStrokeTextAdd, CmdDeviceStrokeTextRemove, CmdNetClassAdd, CmdNetClassEdit, CmdNetClassRemove, CmdNetSignalAdd, CmdNetSignalEdit, CmdNetSignalRemove, CmdProjectEdit, CmdProjectLibraryAddElement< ElementType >, CmdProjectLibraryRemoveElement< ElementType >, CmdRemoveSelectedBoardItems, CmdSchematicAdd, CmdSchematicEdit, CmdSchematicNetLabelAdd, CmdSchematicNetLabelEdit, CmdSchematicNetLabelRemove, CmdSchematicNetPointEdit, CmdSchematicNetSegmentAdd, CmdSchematicNetSegmentAddElements, CmdSchematicNetSegmentEdit, CmdSchematicNetSegmentRemove, CmdSchematicNetSegmentRemoveElements, CmdSchematicPolygonAdd, CmdSchematicPolygonRemove, CmdSchematicRemove, CmdSchematicTextAdd, CmdSchematicTextRemove, CmdSymbolInstanceAdd, CmdSymbolInstanceEdit, CmdSymbolInstanceRemove, CmdSymbolInstanceTextAdd, CmdSymbolInstanceTextRemove, and UndoCommandGroup.
|
private |
|
private |
Shows whether execute() was called or not.
|
private |
Counter of how often redo() was called.
|
private |
Counter of how often undo() was called.