MCPcopy Create free account
hub / github.com/KDE/krita / beginMacro

Method beginMacro

libs/command/kundo2stack.cpp:1214–1236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1212*/
1213
1214void KUndo2QStack::beginMacro(const KUndo2MagicString &text)
1215{
1216 KUndo2Command *cmd = new KUndo2Command();
1217 cmd->setText(text);
1218
1219 if (m_macro_stack.isEmpty()) {
1220 while (m_index < m_command_list.size())
1221 delete m_command_list.takeLast();
1222 if (m_clean_index > m_index)
1223 m_clean_index = -1; // we've deleted the clean state
1224 m_command_list.append(cmd);
1225 } else {
1226 m_macro_stack.last()->d->child_list.append(cmd);
1227 }
1228 m_macro_stack.append(cmd);
1229
1230 if (m_macro_stack.count() == 1) {
1231 Q_EMIT canUndoChanged(false);
1232 Q_EMIT undoTextChanged(QString());
1233 Q_EMIT canRedoChanged(false);
1234 Q_EMIT redoTextChanged(QString());
1235 }
1236}
1237
1238/*!
1239 Ends composition of a macro command.

Callers 3

slotWaveletDecomposeMethod · 0.45
slotLayerSplitMethod · 0.45
separateMethod · 0.45

Calls 7

lastMethod · 0.80
QStringClass · 0.50
setTextMethod · 0.45
isEmptyMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected