Inheritance diagram for score::CommandStack:

Detailed Description

Mostly equivalent to QUndoStack, but has added signals / slots. They are used to send & receive the commands to the network, for instance.

This class should never be used directly to send commands. Instead, the various command dispatchers, in score/command/Dispatchers should be used.

Public Member Functions

 CommandStack (const score::Document &ctx, QObject *parent=nullptr)
 
void enableActions ()
 Enable the "undo" and "redo" user actions. More...
 
void disableActions ()
 Disable the "undo" and "redo" user actions. More...
 
bool canUndo () const
 
bool canRedo () const
 
QString undoText () const
 Text shown currently in the undo action.
 
QString redoText () const
 Text shown currently in the redo action.
 
int size () const
 
const score::Commandcommand (int index) const
 
int currentIndex () const
 
void markCurrentIndexAsSaved ()
 
bool isAtSavedIndex () const
 
QStack< score::Command * > & undoable ()
 
QStack< score::Command * > & redoable ()
 
const QStack< score::Command * > & undoable () const
 
const QStack< score::Command * > & redoable () const
 
const score::DocumentContextcontext () const
 
void localCommand (score::Command *cmd)
 Emitted when a command was pushed on the stack. More...
 
void localUndo ()
 Emitted when the user calls "Undo".
 
void localRedo ()
 Emitted when the user calls "Redo".
 
void localIndexChanged (int v)
 
void canUndoChanged (bool b)
 
void canRedoChanged (bool b)
 
void undoTextChanged (QString b)
 
void redoTextChanged (QString b)
 
void indexChanged (int b)
 
void stackChanged ()
 
void saveIndexChanged (bool b)
 
void sig_undo ()
 
void sig_redo ()
 
void sig_push ()
 
void sig_indexChanged ()
 
void setIndex (int index)
 
vvvvvvvvvvvvoid setIndexQuiet (int index)
 
void undoQuiet ()
 
vvvvvvvvvvvvoid redoQuiet ()
 
*brief pushAndEmit Pushes a command on the stack and emit relevant signals *param cmd The command *void redoAndPushQuiet (score::Command *cmd)
 
vvvvvvvvvvvvoid pushQuiet (score::Command *cmd)
 
vvvvvvvvvvvvoid undo ()
 
vvvvvvvvvvvvoid redo ()
 
 m_checker ()
 
 c ()
 
 m_checker ()
 
 if (pre_canUndo !=canUndo()) canUndoChanged(canUndo())
 
 if (pre_canRedo !=canRedo()) canRedoChanged(canRedo())
 
 if (canUndo()) undoTextChanged(m_undoable.top() -> description())
 
else undoTextChanged ("")
 
 if (canRedo()) redoTextChanged(m_redoable.top() -> description())
 
else redoTextChanged ("")
 
 indexChanged (m_undoable.size() - 1)
 
 stackChanged ()
 
void setSavedIndex (int index)
 
void validateDocument () const
 

Static Public Member Functions

static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::setIndex)), &W_ThisType::setIndex >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::setIndexQuiet)), &W_ThisType::setIndexQuiet >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::undoQuiet)), &W_ThisType::undoQuiet >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::redoQuiet)), &W_ThisType::redoQuiet >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::redoAndPush)), &W_ThisType::redoAndPush >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::push)), &W_ThisType::push >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::redoAndPushQuiet)), &W_ThisType::redoAndPushQuiet >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::pushQuiet)), &W_ThisType::pushQuiet >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::undo)), &W_ThisType::undo >)
 
static void w_GetAccessSpecifierHelper (std::integral_constant< decltype((&W_ThisType::redo)), &W_ThisType::redo >)
 

Public Attributes

ppppppppppppublic __pad0__: template <typename Callable> void updateStack(Callable&& c) { bool pre_canUndo{canUndo()}
 
ppppppppppppublic pre_canRedo {canRedo()}
 

Friends

class CommandBackupFile
 
struct CommandStackBackup
 
constexpr friend auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** >>, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::setIndex), w_internal::viewLiteral("setIndex"), std::integral_constant< decltype((&W_ThisType::setIndex)), &W_ThisType::setIndex >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr friend auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** >>, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::setIndexQuiet), w_internal::viewLiteral("setIndexQuiet"), std::integral_constant< decltype((&W_ThisType::setIndexQuiet)), &W_ThisType::setIndexQuiet >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr friend auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** >>, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::undoQuiet), w_internal::viewLiteral("undoQuiet"), std::integral_constant< decltype((&W_ThisType::undoQuiet)), &W_ThisType::undoQuiet >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr friend auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** >>, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::redoQuiet), w_internal::viewLiteral("redoQuiet"), std::integral_constant< decltype((&W_ThisType::redoQuiet)), &W_ThisType::redoQuiet >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr friend auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** >>, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::redoAndPushQuiet), w_internal::viewLiteral("redoAndPushQuiet"), std::integral_constant< decltype((&W_ThisType::redoAndPushQuiet)), &W_ThisType::redoAndPushQuiet >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr friend auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** >>, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::pushQuiet), w_internal::viewLiteral("pushQuiet"), std::integral_constant< decltype((&W_ThisType::pushQuiet)), &W_ThisType::pushQuiet >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr friend auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** >>, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::undo), w_internal::viewLiteral("undo"), std::integral_constant< decltype((&W_ThisType::undo)), &W_ThisType::undo >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr friend auto w_state (w_internal::Index< w_internal::stateCount< __COUNTER__, w_internal::MethodStateTag, W_ThisType ** >>, w_internal::MethodStateTag, W_ThisType **) -> decltype((w_internal::makeMetaMethodInfo((&W_ThisType::redo), w_internal::viewLiteral("redo"), std::integral_constant< decltype((&W_ThisType::redo)), &W_ThisType::redo >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 

Member Function Documentation

◆ disableActions()

void score::CommandStack::disableActions ( )

Disable the "undo" and "redo" user actions.

See also
enableActions

◆ enableActions()

void score::CommandStack::enableActions ( )

Enable the "undo" and "redo" user actions.

Allows blocking of undo and redo. Used in ongoing command classes, to prevent doing undo-redo while performing an ongoing action (moving something for instance).

◆ localCommand()

void score::CommandStack::localCommand ( score::Command cmd)

Emitted when a command was pushed on the stack.

Parameters
cmdthe command that was pushed

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