PythonQt.QtGui.QUndoCommand · declarations 001
Back to PythonQt.QtGui.QUndoCommand
actionText
actionText() -> str
X.actionText() -> str
Supplemental documentation: Qt 5 reference:
QString QUndoCommand::actionText() const
Returns a short text string describing what this command does; for example, "insert text".
The text is used when the text properties of the stack's undo and redo actions are updated.
This function was introduced in Qt 4.8.
See also text(), setText(), QUndoStack::createUndoAction(), and QUndoStack::createRedoAction().
Upstream PySide2 reference signatures (binding differences may apply):
actionText(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#actionText
child
child(index: int) -> Any
X.child(index) -> PythonQt.QtGui.QUndoCommand
Supplemental documentation: Qt 5 reference:
const QUndoCommand *QUndoCommand::child(int index) const
Returns the child command at index.
This function was introduced in Qt 4.4.
See also childCount() and QUndoStack::command().
Upstream PySide2 reference signatures (binding differences may apply):
child(self, index: int) -> PySide2.QtWidgets.QUndoCommand
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#child
childCount
childCount() -> int
X.childCount() -> int
Supplemental documentation: Qt 5 reference:
int QUndoCommand::childCount() const
Returns the number of child commands in this command.
This function was introduced in Qt 4.4.
See also child().
Upstream PySide2 reference signatures (binding differences may apply):
childCount(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#childCount
id
id() -> int
X.id() -> int
Supplemental documentation: Qt 5 reference:
[virtual] int QUndoCommand::id() const
Returns the ID of this command.
A command ID is used in command compression. It must be an integer unique to this command's class, or -1 if the command doesn't support compression.
If the command supports compression this function must be overridden in the derived class to return the correct ID. The base implementation returns -1.
QUndoStack::push() will only try to merge two commands if they have the same ID, and the ID is not -1.
See also mergeWith() and QUndoStack::push().
Upstream PySide2 reference signatures (binding differences may apply):
id(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#id
mergeWith
mergeWith(other: Any) -> bool
X.mergeWith(other) -> bool
Supplemental documentation: Qt 5 reference:
[virtual] bool QUndoCommand::mergeWith(const QUndoCommand *command)
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.
bool AppendText::mergeWith(const QUndoCommand *other)
{
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() and QUndoStack::push().
Upstream PySide2 reference signatures (binding differences may apply):
mergeWith(self, other: PySide2.QtWidgets.QUndoCommand) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#mergeWith
redo
redo() -> None
X.redo()
Supplemental documentation: Qt 5 reference:
[virtual] void QUndoCommand::redo()
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().
Upstream PySide2 reference signatures (binding differences may apply):
redo(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#redo
setText
setText(text: str) -> None
X.setText(text)
Supplemental documentation: Qt 5 reference:
void QUndoCommand::setText(const QString \&text)
Sets the command's text to be the text specified.
The specified text should be a short user-readable string describing what this command does.
If you need to have two different strings for text() and actionText(), separate them with "\n" and pass into this function. Even if you do not use this feature for English strings during development, you can still let translators use two different strings in order to match specific languages' needs. The described feature and the function actionText() are available since Qt 4.8.
See also text(), actionText(), QUndoStack::createUndoAction(), and QUndoStack::createRedoAction().
Upstream PySide2 reference signatures (binding differences may apply):
setText(self, text: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#setText
text
text() -> str
X.text() -> str
Supplemental documentation: Qt 5 reference:
QString QUndoCommand::text() const
Returns a short text string describing what this command does; for example, "insert text".
The text is used for names of items in QUndoView.
See also actionText(), setText(), QUndoStack::createUndoAction(), and QUndoStack::createRedoAction().
Upstream PySide2 reference signatures (binding differences may apply):
text(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#text
undo
undo() -> None
X.undo()
Supplemental documentation: Qt 5 reference:
[virtual] void QUndoCommand::undo()
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().
Upstream PySide2 reference signatures (binding differences may apply):
undo(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qundocommand.html#undo