Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 1239

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QUndoStack Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QUndoStack Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QUndoStack class is a stack of <a href="qundocommand.html">QUndoCommand</a> objects. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qundostack.html#QUndoStack">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qundostack.html#beginMacro">beginMacro</a></b> (<i>self</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />bool <b><a href="qundostack.html#canRedo">canRedo</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qundostack.html#canUndo">canUndo</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qundostack.html#cleanIndex">cleanIndex</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qundostack.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />QUndoCommand <b><a href="qundostack.html#command">command</a></b> (<i>self</i>, int&#160;<i>index</i>)</li><li><div class="fn" />int <b><a href="qundostack.html#count">count</a></b> (<i>self</i>)</li><li><div class="fn" />QAction <b><a href="qundostack.html#createRedoAction">createRedoAction</a></b> (<i>self</i>, QObject&#160;<i>parent</i>, QString&#160;<i>prefix</i>&#160;=&#160;QString())</li><li><div class="fn" />QAction <b><a href="qundostack.html#createUndoAction">createUndoAction</a></b> (<i>self</i>, QObject&#160;<i>parent</i>, QString&#160;<i>prefix</i>&#160;=&#160;QString())</li><li><div class="fn" /><b><a href="qundostack.html#endMacro">endMacro</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qundostack.html#index">index</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qundostack.html#isActive">isActive</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qundostack.html#isClean">isClean</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qundostack.html#push">push</a></b> (<i>self</i>, QUndoCommand&#160;<i>cmd</i>)</li><li><div class="fn" /><b><a href="qundostack.html#redo">redo</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qundostack.html#redoText">redoText</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qundostack.html#setActive">setActive</a></b> (<i>self</i>, bool&#160;<i>active</i>&#160;=&#160;True)</li><li><div class="fn" /><b><a href="qundostack.html#setClean">setClean</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qundostack.html#setIndex">setIndex</a></b> (<i>self</i>, int&#160;<i>idx</i>)</li><li><div class="fn" /><b><a href="qundostack.html#setUndoLimit">setUndoLimit</a></b> (<i>self</i>, int&#160;<i>limit</i>)</li><li><div class="fn" />QString <b><a href="qundostack.html#text">text</a></b> (<i>self</i>, int&#160;<i>idx</i>)</li><li><div class="fn" /><b><a href="qundostack.html#undo">undo</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qundostack.html#undoLimit">undoLimit</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qundostack.html#undoText">undoText</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" /> <b><a href="qundostack.html#__len__">__len__</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qundostack.html#canRedoChanged">canRedoChanged</a></b> (bool)</li><li><div class="fn" />void <b><a href="qundostack.html#canUndoChanged">canUndoChanged</a></b> (bool)</li><li><div class="fn" />void <b><a href="qundostack.html#cleanChanged">cleanChanged</a></b> (bool)</li><li><div class="fn" />void <b><a href="qundostack.html#indexChanged">indexChanged</a></b> (int)</li><li><div class="fn" />void <b><a href="qundostack.html#redoTextChanged">redoTextChanged</a></b> (const QString&amp;)</li><li><div class="fn" />void <b><a href="qundostack.html#undoTextChanged">undoTextChanged</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QUndoStack class is a stack of <a href="qundocommand.html">QUndoCommand</a> objects.</p>
<p>For an overview of Qt's Undo Framework, see the <a href="qundo.html">overview document</a>.</p>
<p>An undo stack maintains a stack of commands that have been
applied to a document.</p>
<p>New commands are pushed on the stack using <a href="qundostack.html#push">push</a>(). Commands can be undone and
redone using <a href="qundostack.html#undo">undo</a>() and <a href="qundostack.html#redo">redo</a>(), or by triggering the actions
returned by <a href="qundostack.html#createUndoAction">createUndoAction</a>() and
<a href="qundostack.html#createRedoAction">createRedoAction</a>().</p>
<p>QUndoStack keeps track of the <i>current</i> command. This is
the command which will be executed by the next call to <a href="qundostack.html#redo">redo</a>(). The index of this command is
returned by <a href="qundostack.html#index">index</a>(). The state
of the edited object can be rolled forward or back using <a href="qundostack.html#setIndex">setIndex</a>(). If the top-most command
on the stack has already been redone, <a href="qundostack.html#index">index</a>() is equal to <a href="qundostack.html#count">count</a>().</p>
<p>QUndoStack provides support for undo and redo actions, command
compression, command macros, and supports the concept of a <i>clean
state</i>.</p>
<a id="undo-and-redo-actions" name="undo-and-redo-actions" />
<h3>Undo and Redo Actions</h3>
<p>QUndoStack provides convenient undo and redo <a href="qaction.html">QAction</a> objects, which can be inserted into a
menu or a toolbar. When commands are undone or redone, QUndoStack
updates the text properties of these actions to reflect what change
they will trigger. The actions are also disabled when no command is
available for undo or redo. These actions are returned by <a href="qundostack.html#createUndoAction">QUndoStack.createUndoAction</a>()
and <a href="qundostack.html#createRedoAction">QUndoStack.createRedoAction</a>().</p>
<a id="command-compression-and-macros" name="command-compression-and-macros" />
<h3>Command Compression and Macros</h3>
<p>Command compression is useful when several commands can be
compressed into a single command that can be undone and redone in a
single operation. For example, when a user types a character in a
text editor, a new command is created. This command inserts the
character into the document at the cursor position. However, it is
more convenient for the user to be able to undo or redo typing of
whole words, sentences, or paragraphs. Command compression allows
these single-character commands to be merged into a single command
which inserts or deletes sections of text. For more information,
see <a href="qundocommand.html#mergeWith">QUndoCommand.mergeWith</a>() and
<a href="qundostack.html#push">push</a>().</p>
<p>A command macro is a sequence of commands, all of which are
undone and redone in one go. Command macros are created by giving a
command a list of child commands. Undoing or redoing the parent
command will cause the child commands to be undone or redone.
Command macros may be created explicitly by specifying a parent in
the <a href="qundocommand.html">QUndoCommand</a> constructor, or by
using the convenience functions <a href="qundostack.html#beginMacro">beginMacro</a>() and <a href="qundostack.html#endMacro">endMacro</a>().</p>
<p>Although command compression and macros appear to have the same
effect to the user, they often have different uses in an
application. Commands that perform small changes to a document may
be usefully compressed if there is no need to individually record
them, and if only larger changes are relevant to the user. However,
for commands that need to be recorded individually, or those that
cannot be compressed, it is useful to use macros to provide a more
convenient user experience while maintaining a record of each
command.</p>
<a id="clean-state" name="clean-state" />
<h3>Clean State</h3>
<p>QUndoStack supports the concept of a clean state. When the
document is saved to disk, the stack can be marked as clean using
<a href="qundostack.html#setClean">setClean</a>(). Whenever the
stack returns to this state through undoing and redoing commands,
it emits the signal <a href="qundostack.html#cleanChanged">cleanChanged</a>(). This signal is
also emitted when the stack leaves the clean state. This signal is
usually used to enable and disable the save actions in the
application, and to update the document's title to reflect that it
contains unsaved changes.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QUndoStack" />QUndoStack.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an empty undo stack with the parent <i>parent</i>.
The stack will initially be in the clean state. If <i>parent</i> is
a <a href="qundogroup.html">QUndoGroup</a> object, the stack is
automatically added to the group.</p>
<p><b>See also</b> <a href="qundostack.html#push">push</a>().</p>


<h3 class="fn"><a name="beginMacro" />QUndoStack.beginMacro (<i>self</i>, QString&#160;<i>text</i>)</h3><p>Begins composition of a macro command with the given <i>text</i>
description.</p>
<p>An empty command described by the specified <i>text</i> is
pushed on the stack. Any subsequent commands pushed on the stack
will be appended to the empty command's children until <a href="qundostack.html#endMacro">endMacro</a>() is called.</p>
<p>Calls to beginMacro() and <a href="qundostack.html#endMacro">endMacro</a>() may be nested, but every
call to beginMacro() must have a matching call to <a href="qundostack.html#endMacro">endMacro</a>().</p>
<p>While a macro is composed, the stack is disabled. This means
that:</p>
<ul>
<li><a href="qundostack.html#indexChanged">indexChanged</a>() and
<a href="qundostack.html#cleanChanged">cleanChanged</a>() are not
emitted,</li>
<li><a href="qundostack.html#canUndo">canUndo</a>() and <a href="qundostack.html#canRedo">canRedo</a>() return false,</li>
<li>calling <a href="qundostack.html#undo">undo</a>() or <a href="qundostack.html#redo">redo</a>() has no effect,</li>
<li>the undo/redo actions are disabled.</li>
</ul>
<p>The stack becomes enabled and appropriate signals are emitted
when <a href="qundostack.html#endMacro">endMacro</a>() is called
for the outermost macro.</p>
<pre class="cpp">
 stack<span class="operator">.</span>beginMacro(<span class="string">"insert red text"</span>);
 stack<span class="operator">.</span><a href="qundostack.html#push">push</a>(<span class="keyword">new</span> InsertText(document<span class="operator">,</span> idx<span class="operator">,</span> text));
 stack<span class="operator">.</span><a href="qundostack.html#push">push</a>(<span class="keyword">new</span> SetColor(document<span class="operator">,</span> idx<span class="operator">,</span> text<span class="operator">.</span>length()<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>red));
 stack<span class="operator">.</span><a href="qundostack.html#endMacro">endMacro</a>(); <span class="comment">// indexChanged() is emitted</span>
</pre>
<p>This code is equivalent to:</p>
<pre class="cpp">
 <span class="type"><a href="qundocommand.html">QUndoCommand</a></span> <span class="operator">*</span>insertRed <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qundocommand.html">QUndoCommand</a></span>(); <span class="comment">// an empty command</span>
 insertRed<span class="operator">-</span><span class="operator">&gt;</span>setText(<span class="string">"insert red text"</span>);

 <span class="keyword">new</span> InsertText(document<span class="operator">,</span> idx<span class="operator">,</span> text<span class="operator">,</span> insertRed); <span class="comment">// becomes child of insertRed</span>
 <span class="keyword">new</span> SetColor(document<span class="operator">,</span> idx<span class="operator">,</span> text<span class="operator">.</span>length()<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>red<span class="operator">,</span> insertRed);

 stack<span class="operator">.</span><a href="qundostack.html#push">push</a>(insertRed);
</pre>
<p><b>See also</b> <a href="qundostack.html#endMacro">endMacro</a>().</p>


<h3 class="fn"><a name="canRedo" />bool QUndoStack.canRedo (<i>self</i>)</h3><p>Returns true if there is a command available for redo; otherwise
returns false.</p>
<p>This function returns false if the stack is empty or if the top
command on the stack has already been redone.</p>
<p>Synonymous with <a href="qundostack.html#index">index</a>() ==
<a href="qundostack.html#count">count</a>().</p>
<p><b>See also</b> <a href="qundostack.html#index">index</a>() and
<a href="qundostack.html#canUndo">canUndo</a>().</p>


<h3 class="fn"><a name="canUndo" />bool QUndoStack.canUndo (<i>self</i>)</h3><p>Returns true if there is a command available for undo; otherwise
returns false.</p>
<p>This function returns false if the stack is empty, or if the
bottom command on the stack has already been undone.</p>
<p>Synonymous with <a href="qundostack.html#index">index</a>() ==
0.</p>
<p><b>See also</b> <a href="qundostack.html#index">index</a>() and
<a href="qundostack.html#canRedo">canRedo</a>().</p>


<h3 class="fn"><a name="cleanIndex" />int QUndoStack.cleanIndex (<i>self</i>)</h3><p>Returns the clean index. This is the index at which <a href="qundostack.html#setClean">setClean</a>() was called.</p>
<p>A stack may not have a clean index. This happens if a document
is saved, some commands are undone, then a new command is pushed.
Since <a href="qundostack.html#push">push</a>() deletes all the
undone commands before pushing the new command, the stack can't
return to the clean state again. In this case, this function
returns -1.</p>
<p><b>See also</b> <a href="qundostack.html#isClean">isClean</a>()
and <a href="qundostack.html#setClean">setClean</a>().</p>


<h3 class="fn"><a name="clear" />QUndoStack.clear (<i>self</i>)</h3><p>Clears the command stack by deleting all commands on it, and
returns the stack to the clean state.</p>
<p>Commands are not undone or redone; the state of the edited
object remains unchanged.</p>
<p>This function is usually used when the contents of the document
are abandoned.</p>
<p><b>See also</b> <a href="qundostack.html#QUndoStack">QUndoStack</a>().</p>


<h3 class="fn"><a name="command" /><a href="qundocommand.html">QUndoCommand</a> QUndoStack.command (<i>self</i>, int&#160;<i>index</i>)</h3><p>Returns a const pointer to the command at <i>index</i>.</p>
<p>This function returns a const pointer, because modifying a
command, once it has been pushed onto the stack and executed,
almost always causes corruption of the state of the document, if
the command is later undone or redone.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qundocommand.html#child">QUndoCommand.child</a>().</p>


<h3 class="fn"><a name="count" />int QUndoStack.count (<i>self</i>)</h3><p>Returns the number of commands on the stack. Macro commands are
counted as one command.</p>
<p><b>See also</b> <a href="qundostack.html#index">index</a>(),
<a href="qundostack.html#setIndex">setIndex</a>(), and <a href="qundostack.html#command">command</a>().</p>


<h3 class="fn"><a name="createRedoAction" /><a href="qaction.html">QAction</a> QUndoStack.createRedoAction (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>, QString&#160;<i>prefix</i>&#160;=&#160;QString())</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Creates an redo <a href="qaction.html">QAction</a> object with
the given <i>parent</i>.</p>
<p>Triggering this action will cause a call to <a href="qundostack.html#redo">redo</a>(). The text of this action is the
text of the command which will be redone in the next call to
<a href="qundostack.html#redo">redo</a>(), prefixed by the
specified <i>prefix</i>. If there is no command available for redo,
this action will be disabled.</p>
<p>If <i>prefix</i> is empty, the default template "Redo %1" is
used instead of prefix. Before Qt 4.8, the prefix "Redo" was used
by default.</p>
<p><b>See also</b> <a href="qundostack.html#createUndoAction">createUndoAction</a>(), <a href="qundostack.html#canRedo">canRedo</a>(), and <a href="qundocommand.html#text">QUndoCommand.text</a>().</p>


<h3 class="fn"><a name="createUndoAction" /><a href="qaction.html">QAction</a> QUndoStack.createUndoAction (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>, QString&#160;<i>prefix</i>&#160;=&#160;QString())</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Creates an undo <a href="qaction.html">QAction</a> object with
the given <i>parent</i>.</p>
<p>Triggering this action will cause a call to <a href="qundostack.html#undo">undo</a>(). The text of this action is the
text of the command which will be undone in the next call to
<a href="qundostack.html#undo">undo</a>(), prefixed by the
specified <i>prefix</i>. If there is no command available for undo,
this action will be disabled.</p>
<p>If <i>prefix</i> is empty, the default template "Undo %1" is
used instead of prefix. Before Qt 4.8, the prefix "Undo" was used
by default.</p>
<p><b>See also</b> <a href="qundostack.html#createRedoAction">createRedoAction</a>(), <a href="qundostack.html#canUndo">canUndo</a>(), and <a href="qundocommand.html#text">QUndoCommand.text</a>().</p>


<h3 class="fn"><a name="endMacro" />QUndoStack.endMacro (<i>self</i>)</h3><p>Ends composition of a macro command.</p>
<p>If this is the outermost macro in a set nested macros, this
function emits <a href="qundostack.html#indexChanged">indexChanged</a>() once for the
entire macro command.</p>
<p><b>See also</b> <a href="qundostack.html#beginMacro">beginMacro</a>().</p>


<h3 class="fn"><a name="index" />int QUndoStack.index (<i>self</i>)</h3><p>Returns the index of the current command. This is the command
that will be executed on the next call to <a href="qundostack.html#redo">redo</a>(). It is not always the top-most
command on the stack, since a number of commands may have been
undone.</p>
<p><b>See also</b> <a href="qundostack.html#setIndex">setIndex</a>(), <a href="qundostack.html#undo">undo</a>(), <a href="qundostack.html#redo">redo</a>(), and <a href="qundostack.html#count">count</a>().</p>


<h3 class="fn"><a name="isActive" />bool QUndoStack.isActive (<i>self</i>)</h3><h3 class="fn"><a name="isClean" />bool QUndoStack.isClean (<i>self</i>)</h3><p>If the stack is in the clean state, returns true; otherwise
returns false.</p>
<p><b>See also</b> <a href="qundostack.html#setClean">setClean</a>() and <a href="qundostack.html#cleanIndex">cleanIndex</a>().</p>


<h3 class="fn"><a name="push" />QUndoStack.push (<i>self</i>, <a href="qundocommand.html">QUndoCommand</a>&#160;<i>cmd</i>)</h3><p>The <i>cmd</i> argument has it's ownership transferred to Qt.</p><p>Pushes <i>cmd</i> on the stack or merges it with the most
recently executed command. In either case, executes <i>cmd</i> by
calling its <a href="qundostack.html#redo">redo</a>() function.</p>
<p>If <i>cmd</i>'s id is not -1, and if the id is the same as that
of the most recently executed command, <a href="qundostack.html">QUndoStack</a> will attempt to merge the two
commands by calling <a href="qundocommand.html#mergeWith">QUndoCommand.mergeWith</a>() on the
most recently executed command. If <a href="qundocommand.html#mergeWith">QUndoCommand.mergeWith</a>() returns
true, <i>cmd</i> is deleted.</p>
<p>In all other cases <i>cmd</i> is simply pushed on the stack.</p>
<p>If commands were undone before <i>cmd</i> was pushed, the
current command and all commands above it are deleted. Hence
<i>cmd</i> always ends up being the top-most on the stack.</p>
<p>Once a command is pushed, the stack takes ownership of it. There
are no getters to return the command, since modifying it after it
has been executed will almost always lead to corruption of the
document's state.</p>
<p><b>See also</b> <a href="qundocommand.html#id">QUndoCommand.id</a>() and <a href="qundocommand.html#mergeWith">QUndoCommand.mergeWith</a>().</p>


<h3 class="fn"><a name="redo" />QUndoStack.redo (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void redo()</tt>.</p><p>Redoes the current command by calling <a href="qundocommand.html#redo">QUndoCommand.redo</a>(). Increments the
current command index.</p>
<p>If the stack is empty, or if the top command on the stack has
already been redone, this function does nothing.</p>
<p><b>See also</b> <a href="qundostack.html#undo">undo</a>() and
<a href="qundostack.html#index">index</a>().</p>


<h3 class="fn"><a name="redoText" />QString QUndoStack.redoText (<i>self</i>)</h3><p>Returns the text of the command which will be redone in the next
call to <a href="qundostack.html#redo">redo</a>().</p>
<p><b>See also</b> <a href="qundocommand.html#actionText">QUndoCommand.actionText</a>() and
<a href="qundostack.html#undoText">undoText</a>().</p>


<h3 class="fn"><a name="setActive" />QUndoStack.setActive (<i>self</i>, bool&#160;<i>active</i>&#160;=&#160;True)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setActive(bool = 1)</tt>.</p><h3 class="fn"><a name="setClean" />QUndoStack.setClean (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setClean()</tt>.</p><p>Marks the stack as clean and emits <a href="qundostack.html#cleanChanged">cleanChanged</a>() if the stack was
not already clean.</p>
<p>Whenever the stack returns to this state through the use of
undo/redo commands, it emits the signal <a href="qundostack.html#cleanChanged">cleanChanged</a>(). This signal is
also emitted when the stack leaves the clean state.</p>
<p><b>See also</b> <a href="qundostack.html#isClean">isClean</a>()
and <a href="qundostack.html#cleanIndex">cleanIndex</a>().</p>


<h3 class="fn"><a name="setIndex" />QUndoStack.setIndex (<i>self</i>, int&#160;<i>idx</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setIndex(int)</tt>.</p><p>Repeatedly calls <a href="qundostack.html#undo">undo</a>() or
<a href="qundostack.html#redo">redo</a>() until the current command
index reaches <i>idx</i>. This function can be used to roll the
state of the document forwards of backwards. <a href="qundostack.html#indexChanged">indexChanged</a>() is emitted only
once.</p>
<p><b>See also</b> <a href="qundostack.html#index">index</a>(),
<a href="qundostack.html#count">count</a>(), <a href="qundostack.html#undo">undo</a>(), and <a href="qundostack.html#redo">redo</a>().</p>


<h3 class="fn"><a name="setUndoLimit" />QUndoStack.setUndoLimit (<i>self</i>, int&#160;<i>limit</i>)</h3><h3 class="fn"><a name="text" />QString QUndoStack.text (<i>self</i>, int&#160;<i>idx</i>)</h3><p>Returns the text of the command at index <i>idx</i>.</p>
<p><b>See also</b> <a href="qundostack.html#beginMacro">beginMacro</a>().</p>


<h3 class="fn"><a name="undo" />QUndoStack.undo (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void undo()</tt>.</p><p>Undoes the command below the current command by calling <a href="qundocommand.html#undo">QUndoCommand.undo</a>(). Decrements the
current command index.</p>
<p>If the stack is empty, or if the bottom command on the stack has
already been undone, this function does nothing.</p>
<p><b>See also</b> <a href="qundostack.html#redo">redo</a>() and
<a href="qundostack.html#index">index</a>().</p>


<h3 class="fn"><a name="undoLimit" />int QUndoStack.undoLimit (<i>self</i>)</h3><h3 class="fn"><a name="undoText" />QString QUndoStack.undoText (<i>self</i>)</h3><p>Returns the text of the command which will be undone in the next
call to <a href="qundostack.html#undo">undo</a>().</p>
<p><b>See also</b> <a href="qundocommand.html#actionText">QUndoCommand.actionText</a>() and
<a href="qundostack.html#redoText">redoText</a>().</p>


<h3 class="fn"><a name="__len__" /> QUndoStack.__len__ (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="canRedoChanged" />void canRedoChanged (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the value of <a href="qundostack.html#canRedo">canRedo</a>() changes. It is used to
enable or disable the redo action returned by <a href="qundostack.html#createRedoAction">createRedoAction</a>().
<i>canRedo</i> specifies the new value.</p>


<h3 class="fn"><a name="canUndoChanged" />void canUndoChanged (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the value of <a href="qundostack.html#canUndo">canUndo</a>() changes. It is used to
enable or disable the undo action returned by <a href="qundostack.html#createUndoAction">createUndoAction</a>().
<i>canUndo</i> specifies the new value.</p>


<h3 class="fn"><a name="cleanChanged" />void cleanChanged (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the stack enters or leaves the
clean state. If <i>clean</i> is true, the stack is in a clean
state; otherwise this signal indicates that it has left the clean
state.</p>
<p><b>See also</b> <a href="qundostack.html#isClean">isClean</a>()
and <a href="qundostack.html#setClean">setClean</a>().</p>


<h3 class="fn"><a name="indexChanged" />void indexChanged (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever a command modifies the state of
the document. This happens when a command is undone or redone. When
a macro command is undone or redone, or <a href="qundostack.html#setIndex">setIndex</a>() is called, this signal is
emitted only once.</p>
<p><i>idx</i> specifies the index of the current command, ie. the
command which will be executed on the next call to <a href="qundostack.html#redo">redo</a>().</p>
<p><b>See also</b> <a href="qundostack.html#index">index</a>() and
<a href="qundostack.html#setIndex">setIndex</a>().</p>


<h3 class="fn"><a name="redoTextChanged" />void redoTextChanged (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the value of <a href="qundostack.html#redoText">redoText</a>() changes. It is used to
update the text property of the redo action returned by <a href="qundostack.html#createRedoAction">createRedoAction</a>().
<i>redoText</i> specifies the new text.</p>


<h3 class="fn"><a name="undoTextChanged" />void undoTextChanged (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the value of <a href="qundostack.html#undoText">undoText</a>() changes. It is used to
update the text property of the undo action returned by <a href="qundostack.html#createUndoAction">createUndoAction</a>().
<i>undoText</i> specifies the new text.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>