<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.5.0_09) on Tue Aug 07 17:06:32 CEST 2007 --> <TITLE> QUndoCommand </TITLE> <META NAME="keywords" CONTENT="com.trolltech.qt.gui.QUndoCommand class"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="QUndoCommand"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/trolltech/qt/gui/QTreeWidgetItemIterator.IteratorFlags.html" title="class in com.trolltech.qt.gui"><B>PREV CLASS</B></A> <A HREF="../../../../com/trolltech/qt/gui/QUndoGroup.html" title="class in com.trolltech.qt.gui"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/trolltech/qt/gui/QUndoCommand.html" target="_top"><B>FRAMES</B></A> <A HREF="QUndoCommand.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_classes_inherited_from_class_com.trolltech.qt.QSignalEmitter">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.trolltech.qt.gui</FONT> <BR> Class QUndoCommand</H2> <PRE> java.lang.Object <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">com.trolltech.qt.QSignalEmitter</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../com/trolltech/qt/QtJambiObject.html" title="class in com.trolltech.qt">com.trolltech.qt.QtJambiObject</A> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.trolltech.qt.gui.QUndoCommand</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../com/trolltech/qt/QtJambiInterface.html" title="interface in com.trolltech.qt">QtJambiInterface</A></DD> </DL> <HR> <DL> <DT><PRE>public class <B>QUndoCommand</B><DT>extends <A HREF="../../../../com/trolltech/qt/QtJambiObject.html" title="class in com.trolltech.qt">QtJambiObject</A></DL> </PRE> <P> <p>The <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> class is the base class of all commands stored on a <a href="QUndoStack.html"><tt>QUndoStack</tt></a>.</p> <p>For an overview of Qt's Undo Framework, see the <a href="%2E%2E/qundo.html">overview document</tt></a>.</p> <p>A <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> represents a single editing action on a document; for example, inserting or deleting a block of text in a text editor. <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> can apply a change to the document with <a href="QUndoCommand.html#redo()"><tt>redo</tt></a> and undo the change with <a href="QUndoCommand.html#undo()"><tt>undo</tt></a>. The implementations for these functions must be provided in a derived class.</p> <pre> class AppendText : public QUndoCommand { public: AppendText(QString *doc, const QString &text) : m_document(doc), m_text(text) { setText("append text"); } virtual void undo() { m_document->chop(m_text.length()); } virtual void redo() { m_document->append(m_text); } private: QString *m_document; QString m_text; };</pre> <p>A <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> has an associated <a href="QUndoCommand.html#text()"><tt>text</tt></a>. This is a short string describing what the command does. It is used to update the text properties of the stack's undo and redo actions; see QUndoStack::createUndoAction() and QUndoStack::createRedoAction().</p> <p><a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> objects are owned by the stack they were pushed on. <a href="QUndoStack.html"><tt>QUndoStack</tt></a> deletes a command if it has been undone and a new command is pushed. For example:</p> <pre> MyCommand *command1 = new MyCommand(); stack->push(command1); MyCommand *command2 = new MyCommand(); stack->push(command2); stack->undo(); MyCommand *command3 = new MyCommand(); stack->push(command3); <span class="comment">// command2 gets deleted</span></pre> <p>In effect, when a command is pushed, it becomes the top-most command on the stack.</p> <p>To support command compression, <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> has an <a href="QUndoCommand.html#id()"><tt>id</tt></a> and the virtual function <a href="QUndoCommand.html#mergeWith(com.trolltech.qt.gui.QUndoCommand)"><tt>mergeWith</tt></a>. These functions are used by QUndoStack::push().</p> <p>To support command macros, a <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> object can have any number of child commands. Undoing or redoing the parent command will cause the child commands to be undone or redone. A command can be assigned to a parent explicitly in the constructor. In this case, the command will be owned by the parent.</p> <p>The parent in this case is usually an empty command, in that it doesn't provide its own implementation of <a href="QUndoCommand.html#undo()"><tt>undo</tt></a> and <a href="QUndoCommand.html#redo()"><tt>redo</tt></a>. Instead, it uses the base implementations of these functions, which simply call <a href="QUndoCommand.html#undo()"><tt>undo</tt></a> or <a href="QUndoCommand.html#redo()"><tt>redo</tt></a> on all its children. The parent should, however, have a meaningful <a href="QUndoCommand.html#text()"><tt>text</tt></a>.</p> <pre> QUndoCommand *insertRed = new QUndoCommand(); <span class="comment">// an empty command</span> insertRed->setText("insert red text"); new InsertText(document, idx, text, insertRed); <span class="comment">// becomes child of insertRed</span> new SetColor(document, idx, text.length(), Qt::red, insertRed); stack.push(insertRed);</pre> <p>Another way to create macros is to use the convenience functions QUndoStack::beginMacro() and QUndoStack::endMacro().</p> <P> <P> <DL> <DT><B>See Also:</B><DD><a href="QUndoStack.html"><tt>QUndoStack</tt></a></DL> <HR> <P> <!-- ======== NESTED CLASS SUMMARY ======== --> <A NAME="nested_class_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Nested Class Summary</B></FONT></TH> </TR> </TABLE> <A NAME="nested_classes_inherited_from_class_com.trolltech.qt.QSignalEmitter"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Nested classes/interfaces inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">QSignalEmitter</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal0.html" title="class in com.trolltech.qt">QSignalEmitter.Signal0</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal1.html" title="class in com.trolltech.qt">QSignalEmitter.Signal1</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal1.html" title="type parameter in QSignalEmitter.Signal1">A</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="class in com.trolltech.qt">QSignalEmitter.Signal2</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="type parameter in QSignalEmitter.Signal2">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal2.html" title="type parameter in QSignalEmitter.Signal2">B</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="class in com.trolltech.qt">QSignalEmitter.Signal3</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal3.html" title="type parameter in QSignalEmitter.Signal3">C</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="class in com.trolltech.qt">QSignalEmitter.Signal4</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal4.html" title="type parameter in QSignalEmitter.Signal4">D</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="class in com.trolltech.qt">QSignalEmitter.Signal5</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal5.html" title="type parameter in QSignalEmitter.Signal5">E</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="class in com.trolltech.qt">QSignalEmitter.Signal6</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal6.html" title="type parameter in QSignalEmitter.Signal6">F</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="class in com.trolltech.qt">QSignalEmitter.Signal7</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal7.html" title="type parameter in QSignalEmitter.Signal7">G</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="class in com.trolltech.qt">QSignalEmitter.Signal8</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">G</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal8.html" title="type parameter in QSignalEmitter.Signal8">H</A>>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="class in com.trolltech.qt">QSignalEmitter.Signal9</A><<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">A</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">B</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">C</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">D</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">E</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">F</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">G</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">H</A>,<A HREF="../../../../com/trolltech/qt/QSignalEmitter.Signal9.html" title="type parameter in QSignalEmitter.Signal9">I</A>></CODE></TD> </TR> </TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#QUndoCommand()">QUndoCommand</A></B>()</CODE> <BR> Equivalent to <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a>(0).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#QUndoCommand(com.trolltech.qt.gui.QUndoCommand)">QUndoCommand</A></B>(<A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html" title="class in com.trolltech.qt.gui">QUndoCommand</A> parent)</CODE> <BR> Constructs a <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> object with parent <tt>parent</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#QUndoCommand(java.lang.String)">QUndoCommand</A></B>(java.lang.String text)</CODE> <BR> Equivalent to <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a>(<tt>text</tt>, 0).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)">QUndoCommand</A></B>(java.lang.String text, <A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html" title="class in com.trolltech.qt.gui">QUndoCommand</A> parent)</CODE> <BR> Constructs a <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> object with the given <tt>parent</tt> and <tt>text</tt>.</TD> </TR> </TABLE> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html" title="class in com.trolltech.qt.gui">QUndoCommand</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#fromNativePointer(com.trolltech.qt.QNativePointer)">fromNativePointer</A></B>(<A HREF="../../../../com/trolltech/qt/QNativePointer.html" title="class in com.trolltech.qt">QNativePointer</A> nativePointer)</CODE> <BR> This function returns the QUndoCommand instance pointed to by nativePointer</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#id()">id</A></B>()</CODE> <BR> Returns the ID of this command.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#mergeWith(com.trolltech.qt.gui.QUndoCommand)">mergeWith</A></B>(<A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html" title="class in com.trolltech.qt.gui">QUndoCommand</A> other)</CODE> <BR> Attempts to merge this command with <tt>other</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#redo()">redo</A></B>()</CODE> <BR> Applies a change to the document.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#setText(java.lang.String)">setText</A></B>(java.lang.String text)</CODE> <BR> Sets the command's text to be the <tt>text</tt> specified.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#text()">text</A></B>()</CODE> <BR> Returns a short text string describing what this command does; for example, "insert text".</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html#undo()">undo</A></B>()</CODE> <BR> Reverts a change to the document.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_com.trolltech.qt.QtJambiObject"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QtJambiObject.html" title="class in com.trolltech.qt">QtJambiObject</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/QtJambiObject.html#dispose()">dispose</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#disposed()">disposed</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#finalize()">finalize</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#reassignNativeResources(com.trolltech.qt.QtJambiObject, java.lang.Class)">reassignNativeResources</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String)">tr</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String, java.lang.String)">tr</A>, <A HREF="../../../../com/trolltech/qt/QtJambiObject.html#tr(java.lang.String, java.lang.String, int)">tr</A></CODE></TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_com.trolltech.qt.QSignalEmitter"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QSignalEmitter.html" title="class in com.trolltech.qt">QSignalEmitter</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#blockSignals(boolean)">blockSignals</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#disconnect()">disconnect</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#disconnect(java.lang.Object)">disconnect</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#signalsBlocked()">signalsBlocked</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#signalSender()">signalSender</A>, <A HREF="../../../../com/trolltech/qt/QSignalEmitter.html#thread()">thread</A></CODE></TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_com.trolltech.qt.QtJambiInterface"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from interface com.trolltech.qt.<A HREF="../../../../com/trolltech/qt/QtJambiInterface.html" title="interface in com.trolltech.qt">QtJambiInterface</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#disableGarbageCollection()">disableGarbageCollection</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#nativeId()">nativeId</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#nativePointer()">nativePointer</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#reenableGarbageCollection()">reenableGarbageCollection</A>, <A HREF="../../../../com/trolltech/qt/QtJambiInterface.html#setJavaOwnership()">setJavaOwnership</A></CODE></TD> </TR> </TABLE> <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="QUndoCommand()"><!-- --></A><H3> QUndoCommand</H3> <PRE> public <B>QUndoCommand</B>()</PRE> <DL> <DD><p>Equivalent to <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a>(0). <P> </DL> <HR> <A NAME="QUndoCommand(com.trolltech.qt.gui.QUndoCommand)"><!-- --></A><H3> QUndoCommand</H3> <PRE> public <B>QUndoCommand</B>(<A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html" title="class in com.trolltech.qt.gui">QUndoCommand</A> parent)</PRE> <DL> <DD><p>Constructs a <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> object with parent <tt>parent</tt>.</p> <p>If <tt>parent</tt> is not 0, this command is appended to parent's child list. The parent command then owns this command and will delete it in its destructor.</p> <P> <DL> <DT><B>See Also:</B><DD><tt>~QUndoCommand</tt></DL> </DL> <HR> <A NAME="QUndoCommand(java.lang.String)"><!-- --></A><H3> QUndoCommand</H3> <PRE> public <B>QUndoCommand</B>(java.lang.String text)</PRE> <DL> <DD><p>Equivalent to <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a>(<tt>text</tt>, 0). <P> </DL> <HR> <A NAME="QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><!-- --></A><H3> QUndoCommand</H3> <PRE> public <B>QUndoCommand</B>(java.lang.String text, <A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html" title="class in com.trolltech.qt.gui">QUndoCommand</A> parent)</PRE> <DL> <DD><p>Constructs a <a href="QUndoCommand.html#QUndoCommand(java.lang.String, com.trolltech.qt.gui.QUndoCommand)"><tt>QUndoCommand</tt></a> object with the given <tt>parent</tt> and <tt>text</tt>.</p> <p>If <tt>parent</tt> is not 0, this command is appended to parent's child list. The parent command then owns this command and will delete it in its destructor.</p> <P> <DL> <DT><B>See Also:</B><DD><tt>~QUndoCommand</tt></DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="setText(java.lang.String)"><!-- --></A><H3> setText</H3> <PRE> public final void <B>setText</B>(java.lang.String text)</PRE> <DL> <DD><p>Sets the command's text to be the <tt>text</tt> specified.</p> <p>The specified text should be a short user-readable string describing what this command does.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QUndoCommand.html#text()"><tt>text</tt></a>, <tt>QUndoStack::createUndoAction</tt>, <tt>QUndoStack::createRedoAction</tt></DL> </DD> </DL> <HR> <A NAME="text()"><!-- --></A><H3> text</H3> <PRE> public final java.lang.String <B>text</B>()</PRE> <DL> <DD><p>Returns a short text string describing what this command does; for example, "insert text".</p> <p>The text is used when the text properties of the stack's undo and redo actions are updated.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QUndoCommand.html#setText(java.lang.String)"><tt>setText</tt></a>, <tt>QUndoStack::createUndoAction</tt>, <tt>QUndoStack::createRedoAction</tt></DL> </DD> </DL> <HR> <A NAME="id()"><!-- --></A><H3> id</H3> <PRE> public int <B>id</B>()</PRE> <DL> <DD><p>Returns the ID of this command.</p> <p>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.</p> <p>If the command supports compression this function must be overridden in the derived class to return the correct ID. The base implementation returns -1.</p> <p>QUndoStack::push() will only try to merge two commands if they have the same ID, and the ID is not -1.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QUndoCommand.html#mergeWith(com.trolltech.qt.gui.QUndoCommand)"><tt>mergeWith</tt></a>, <tt>QUndoStack::push</tt></DL> </DD> </DL> <HR> <A NAME="mergeWith(com.trolltech.qt.gui.QUndoCommand)"><!-- --></A><H3> mergeWith</H3> <PRE> public boolean <B>mergeWith</B>(<A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html" title="class in com.trolltech.qt.gui">QUndoCommand</A> other)</PRE> <DL> <DD><p>Attempts to merge this command with <tt>other</tt>. Returns true on success; otherwise returns false.</p> <p>If this function returns true, calling this command's <a href="QUndoCommand.html#redo()"><tt>redo</tt></a> must have the same effect as redoing both this command and <tt>other</tt>. Similarly, calling this command's <a href="QUndoCommand.html#undo()"><tt>undo</tt></a> must have the same effect as undoing <tt>other</tt> and this command.</p> <p><a href="QUndoStack.html"><tt>QUndoStack</tt></a> will only try to merge two commands if they have the same id, and the id is not -1.</p> <p>The default implementation returns false.</p> <pre> bool AppendText::mergeWith(const QUndoCommand *other) { if (other->id() != id()) <span class="comment">// make sure other is also an AppendText command</span> return false; m_text += static_cast<const AppendText*>(other)->m_text; return true; }</pre> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QUndoCommand.html#id()"><tt>id</tt></a>, <tt>QUndoStack::push</tt></DL> </DD> </DL> <HR> <A NAME="redo()"><!-- --></A><H3> redo</H3> <PRE> public void <B>redo</B>()</PRE> <DL> <DD><p>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.</p> <p>The default implementation calls <a href="QUndoCommand.html#redo()"><tt>redo</tt></a> on all child commands.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QUndoCommand.html#undo()"><tt>undo</tt></a></DL> </DD> </DL> <HR> <A NAME="undo()"><!-- --></A><H3> undo</H3> <PRE> public void <B>undo</B>()</PRE> <DL> <DD><p>Reverts a change to the document. After <a href="QUndoCommand.html#undo()"><tt>undo</tt></a> is called, the state of the document should be the same as before <a href="QUndoCommand.html#redo()"><tt>redo</tt></a> 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.</p> <p>The default implementation calls <a href="QUndoCommand.html#undo()"><tt>undo</tt></a> on all child commands in reverse order.</p> <P> <DD><DL> <DT><B>See Also:</B><DD><a href="QUndoCommand.html#redo()"><tt>redo</tt></a></DL> </DD> </DL> <HR> <A NAME="fromNativePointer(com.trolltech.qt.QNativePointer)"><!-- --></A><H3> fromNativePointer</H3> <PRE> public static <A HREF="../../../../com/trolltech/qt/gui/QUndoCommand.html" title="class in com.trolltech.qt.gui">QUndoCommand</A> <B>fromNativePointer</B>(<A HREF="../../../../com/trolltech/qt/QNativePointer.html" title="class in com.trolltech.qt">QNativePointer</A> nativePointer)</PRE> <DL> <DD>This function returns the QUndoCommand instance pointed to by nativePointer <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>nativePointer</CODE> - the QNativePointer of which object should be returned.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/trolltech/qt/gui/QTreeWidgetItemIterator.IteratorFlags.html" title="class in com.trolltech.qt.gui"><B>PREV CLASS</B></A> <A HREF="../../../../com/trolltech/qt/gui/QUndoGroup.html" title="class in com.trolltech.qt.gui"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/trolltech/qt/gui/QUndoCommand.html" target="_top"><B>FRAMES</B></A> <A HREF="QUndoCommand.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_classes_inherited_from_class_com.trolltech.qt.QSignalEmitter">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>