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

Method checkUndoLimit

libs/command/kundo2stack.cpp:606–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604*/
605
606bool KUndo2QStack::checkUndoLimit()
607{
608 if (m_undo_limit <= 0 || !m_macro_stack.isEmpty() || m_undo_limit >= m_command_list.count())
609 return false;
610
611 int del_count = m_command_list.count() - m_undo_limit;
612
613 for (int i = 0; i < del_count; ++i)
614 delete m_command_list.takeFirst();
615
616 m_index -= del_count;
617 if (m_clean_index != -1) {
618 if (m_clean_index < del_count)
619 m_clean_index = -1; // we've deleted the clean command
620 else
621 m_clean_index -= del_count;
622 }
623 return true;
624}
625
626/*!
627 Constructs an empty undo stack with the parent \a parent. The

Callers

nothing calls this directly

Calls 2

isEmptyMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected