Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
AppendText Class Reference

[0] More...

Inheritance diagram for AppendText:
Collaboration diagram for AppendText:

Public Member Functions

 AppendText (QString *doc, const QString &text)
void undo () override
 Reverts a change to the document.
void redo () override
 Applies a change to the document.
bool mergeWith (const QUndoCommand *other) override
 [3]
 AppendText (QString *doc, const QString &text)
void undo () override
 Reverts a change to the document.
void redo () override
 Applies a change to the document.
bool mergeWith (const QUndoCommand *other) override
 Attempts to merge this command with command.
Public Member Functions inherited from QUndoCommand
 QUndoCommand (QUndoCommand *parent=nullptr)
 Constructs a QUndoCommand object with parent parent.
 QUndoCommand (const QString &text, QUndoCommand *parent=nullptr)
 Constructs a QUndoCommand object with the given parent and text.
virtual ~QUndoCommand ()
 Destroys the QUndoCommand object and all child commands.
QString text () const
 Returns a short text string describing what this command does; for example, "insert text".
QString actionText () const
void setText (const QString &text)
 Sets the command's text to be the text specified.
bool isObsolete () const
void setObsolete (bool obsolete)
virtual int id () const
 Returns the ID of this command.
int childCount () const
const QUndoCommandchild (int index) const

Detailed Description

[0]

Definition at line 7 of file src_gui_util_qundostack.cpp.

Constructor & Destructor Documentation

◆ AppendText() [1/2]

AppendText::AppendText ( QString * doc,
const QString & text )
inline

Definition at line 10 of file src_gui_util_qundostack.cpp.

References AppendText().

Referenced by AppendText().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppendText() [2/2]

AppendText::AppendText ( QString * doc,
const QString & text )
inline

Definition at line 10 of file src_gui_util_qundostack.cpp.

Member Function Documentation

◆ mergeWith() [1/2]

bool AppendText::mergeWith ( const QUndoCommand * other)
overridevirtual

[3]

Reimplemented from QUndoCommand.

Definition at line 73 of file src_gui_util_qundostack.cpp.

◆ mergeWith() [2/2]

bool AppendText::mergeWith ( const QUndoCommand * command)
overridevirtual

Attempts to merge this command with command.

Returns true on success; otherwise returns false.

If this function returns true, calling this command's redo() must have the same effect as redoing both this command and command. Similarly, calling this command's undo() must have the same effect as undoing command and this command.

QUndoStack will only try to merge two commands if they have the same id, and the id is not -1.

The default implementation returns false.

{
if (other->id() != id()) // make sure other is also an AppendText command
return false;
m_text += static_cast<const AppendText*>(other)->m_text;
return true;
}
See also
id(), QUndoStack::push()

Reimplemented from QUndoCommand.

◆ redo() [1/2]

void AppendText::redo ( )
inlineoverridevirtual

Applies a change to the document.

This function must be implemented in the derived class. Calling QUndoStack::push(), QUndoStack::undo() or QUndoStack::redo() from this function leads to undefined beahavior.

The default implementation calls redo() on all child commands.

See also
undo()

Reimplemented from QUndoCommand.

Definition at line 14 of file src_gui_util_qundostack.cpp.

◆ redo() [2/2]

void AppendText::redo ( )
inlineoverridevirtual

Applies a change to the document.

This function must be implemented in the derived class. Calling QUndoStack::push(), QUndoStack::undo() or QUndoStack::redo() from this function leads to undefined beahavior.

The default implementation calls redo() on all child commands.

See also
undo()

Reimplemented from QUndoCommand.

Definition at line 14 of file src_gui_util_qundostack.cpp.

◆ undo() [1/2]

void AppendText::undo ( )
inlineoverridevirtual

Reverts a change to the document.

After undo() is called, the state of the document should be the same as before redo() was called. This function must be implemented in the derived class. Calling QUndoStack::push(), QUndoStack::undo() or QUndoStack::redo() from this function leads to undefined beahavior.

The default implementation calls undo() on all child commands in reverse order.

See also
redo()

Reimplemented from QUndoCommand.

Definition at line 12 of file src_gui_util_qundostack.cpp.

◆ undo() [2/2]

void AppendText::undo ( )
inlineoverridevirtual

Reverts a change to the document.

After undo() is called, the state of the document should be the same as before redo() was called. This function must be implemented in the derived class. Calling QUndoStack::push(), QUndoStack::undo() or QUndoStack::redo() from this function leads to undefined beahavior.

The default implementation calls undo() on all child commands in reverse order.

See also
redo()

Reimplemented from QUndoCommand.

Definition at line 12 of file src_gui_util_qundostack.cpp.


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