MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / undoCommand

Method undoCommand

ElaWidgetTools/ElaActionCommander.cpp:102–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void ElaActionCommander::undoCommand(const QString& domainName)
103{
104 Q_D(ElaActionCommander);
105 if (!d->_commandDomainMap.contains(domainName))
106 {
107 return;
108 }
109 auto& commandData = d->_commandDomainMap[domainName];
110 if (commandData.undoState == ElaActionCommanderType::UndoInvalid)
111 {
112 return;
113 }
114 auto& commandList = commandData.commandList;
115 if (commandList.isEmpty())
116 {
117 return;
118 }
119 if (commandData.currentIndex == 0)
120 {
121 commandData.undoState = ElaActionCommanderType::UndoInvalid;
122 Q_EMIT commanderStateChanged(domainName, ElaActionCommanderType::UndoInvalid);
123 }
124 if (commandData.currentIndex == commandList.size() - 1)
125 {
126 commandData.redoState = ElaActionCommanderType::RedoValid;
127 Q_EMIT commanderStateChanged(domainName, ElaActionCommanderType::RedoValid);
128 }
129 auto command = commandList[commandData.currentIndex];
130 command->undo();
131 commandData.currentIndex -= 1;
132}
133
134void ElaActionCommander::redoCommand(const QString& domainName)
135{

Callers 3

initWindowMethod · 0.80
T_HomeMethod · 0.80
ElaWindowMethod · 0.80

Calls 1

undoMethod · 0.45

Tested by

no test coverage detected