Loading...
Searching...
No Matches
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.
 
void disableActions ()
 Disable the "undo" and "redo" user actions.
 
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.
 
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)
 
void setIndexQuiet (int index)
 
void undoQuiet ()
 
void redoQuiet ()
 
void redoAndPush (score::Command *cmd)
 push Pushes a command on the stack
 
void push (score::Command *cmd)
 quietPush Pushes a command on the stack
 
void redoAndPushQuiet (score::Command *cmd)
 pushAndEmit Pushes a command on the stack and emit relevant signals
 
void pushQuiet (score::Command *cmd)
 
void undo ()
 
void redo ()
 
template<typename Callable >
void updateStack (Callable &&c)
 updateStack Updates the undo / redo stack
 
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 >)
 

Friends

class CommandBackupFile
 
struct CommandStackBackup
 
constexpr 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 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 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 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 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::redoAndPush), w_internal::viewLiteral("redoAndPush"), std::integral_constant< decltype((&W_ThisType::redoAndPush)), &W_ThisType::redoAndPush >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr 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::push), w_internal::viewLiteral("push"), std::integral_constant< decltype((&W_ThisType::push)), &W_ThisType::push >(), w_internal::viewParsedLiterals< w_internal::countParsedLiterals("" "")>("" ""), w_internal::W_EmptyFlag)))
 
constexpr 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 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 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 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

◆ push()

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

quietPush Pushes a command on the stack

Parameters
cmdThe command

Does NOT call cmd::redo()

◆ redoAndPush()

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

push Pushes a command on the stack

Parameters
cmdThe command

Calls cmd::redo()

◆ redoAndPushQuiet()

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

pushAndEmit Pushes a command on the stack and emit relevant signals

Parameters
cmdThe command

◆ updateStack()

template<typename Callable >
void score::CommandStack::updateStack ( Callable &&  c)
inline

updateStack Updates the undo / redo stack

Parameters
cA function object of prototype void(void)

This function takes care of keeping everything synced in the GUI.


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