<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # QUndoStack Class Reference ## [[QtGui](index.htm) module] 該QUndoStack類是一個堆棧的[QUndoCommand](qundocommand.html)對象。[More...](#details) 繼承[QObject](qobject.html)。 ### Methods * `__init__ (self, QObject?parent?=?None)` * `beginMacro (self, QString?text)` * `bool canRedo (self)` * `bool canUndo (self)` * `int cleanIndex (self)` * `clear (self)` * `QUndoCommand command (self, int?index)` * `int count (self)` * `QAction createRedoAction (self, QObject?parent, QString?prefix?=?QString())` * `QAction createUndoAction (self, QObject?parent, QString?prefix?=?QString())` * `endMacro (self)` * `int index (self)` * `bool isActive (self)` * `bool isClean (self)` * `push (self, QUndoCommand?cmd)` * `redo (self)` * `QString redoText (self)` * `setActive (self, bool?active?=?True)` * `setClean (self)` * `setIndex (self, int?idx)` * `setUndoLimit (self, int?limit)` * `QString text (self, int?idx)` * `undo (self)` * `int undoLimit (self)` * `QString undoText (self)` ### Special Methods * `__len__ (self)` ### Qt Signals * `void canRedoChanged (bool)` * `void canUndoChanged (bool)` * `void cleanChanged (bool)` * `void indexChanged (int)` * `void redoTextChanged (const QString&)` * `void undoTextChanged (const QString&)` * * * ## Detailed Description 該QUndoStack類是一個堆棧的[QUndoCommand](qundocommand.html)對象。 對于Qt的復原框架的概述,請參閱[overview document](index.htm)。 一個撤消堆棧保持堆棧已應用于文檔的命令。 新的命令使用壓入堆棧[push](qundostack.html#push)( ) 。命令可以撤消和重做的使用[undo](qundostack.html#undo)()和[redo](qundostack.html#redo)( ) ,或通過觸發返回的行動[createUndoAction](qundostack.html#createUndoAction)()和[createRedoAction](qundostack.html#createRedoAction)( ) 。 QUndoStack跟蹤的_current_命令。這是將由下一個呼叫要執行的命令[redo](qundostack.html#redo)( ) 。這個命令的指數是由返回[index](qundostack.html#index)( ) 。編輯的對象的狀態可以卷向前或向后使用[setIndex](qundostack.html#setIndex)( ) 。如果堆棧最上面的命令已經被重做,[index](qundostack.html#index)( )等于[count](qundostack.html#count)( ) 。 QUndoStack提供支持撤消和重做操作,命令壓縮,命令宏和支持的概念_clean state_。 ### Undo and Redo Actions QUndoStack提供方便的撤銷和重做[QAction](qaction.html)對象,它們可以被插入到一個菜單或工具欄上。當命令被撤消或重做, QUndoStack更新這些行動的文本屬性,以反映什么樣的變化,他們將觸發。當沒有命令可用于撤消或重做的動作也被禁用。這些行動是由返回[QUndoStack.createUndoAction](qundostack.html#createUndoAction)()和[QUndoStack.createRedoAction](qundostack.html#createRedoAction)( ) 。 ### Command Compression and Macros 當幾個命令可以被壓縮成可以撤消一個命令,并在重做一個單一的操作命令壓縮是非常有用的。例如,當用戶在文本編輯字符時,一個新的命令被創建。這個命令插入字符插入到文檔中光標所在的位置。但是,對于用戶更加方便,能夠撤消或重做整個單詞,句子或段落打字。命令壓縮使這些單字符命令合并到其中插入或刪除文本部分的單一命令。欲了解更多信息,請參見[QUndoCommand.mergeWith](qundocommand.html#mergeWith)()和[push](qundostack.html#push)( ) 。 命令宏命令,所有這一切都是撤消和重做一次過的序列。命令宏被賦予一個命令子命令列表創建的。撤消或重做父的命令會讓孩子命令撤消或重做。命令宏可以顯式的指定在一個父級要創建[QUndoCommand](qundocommand.html)構造函數,或者使用的方便功能[beginMacro](qundostack.html#beginMacro)()和[endMacro](qundostack.html#endMacro)( ) 。 雖然壓縮命令和宏似乎有同樣的效果給用戶,他們往往有不同的用途中的應用程序。執行的微小變化到一個文件的命令可以有效地壓縮,如果沒有必要單獨地記錄它們,并且如果只有較大的變化是相關的用戶。然而,對于需要被單獨記錄的,或者是那些不能被壓縮的命令,這是很有用的宏,以提供更方便的用戶體驗,同時保持每個命令的記錄。 ### Clean State QUndoStack支持的清潔狀態的概念。當文件被保存到磁盤,堆棧可以使用被標記為干凈[setClean](qundostack.html#setClean)( ) 。只要堆棧通過撤銷和重做命令返回到這個狀態,它發出的信號[cleanChanged](qundostack.html#cleanChanged)( ) 。當堆棧離開干凈的狀態,這個信號被發射也。這個信號通常是用來啟用和禁用應用程序中保存的動作,并更新文檔的標題,以反映它包含未保存的更改。 * * * ## Method Documentation ``` QUndoStack.__init__ (self, QObject?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個空撤消堆棧與父_parent_。該協議棧將首先在干凈的狀態。如果_parent_是[QUndoGroup](qundogroup.html)對象,堆棧會自動添加到組中。 **See also** [push](qundostack.html#push)( ) 。 ``` QUndoStack.beginMacro (self, QString?text) ``` 開始一個宏命令組成與給定_text_描述。 由指定的描述一個空的命令_text_被壓入堆棧。壓入堆棧上的任何后續命令將被追加到空命令的孩子,直到[endMacro](qundostack.html#endMacro)()被調用。 調用beginMacro ()和[endMacro](qundostack.html#endMacro)( )可以嵌套,但每次調用beginMacro ( )必須有匹配的調用[endMacro](qundostack.html#endMacro)( ) 。 雖然宏組成,堆棧被禁用。這意味著: * [indexChanged](qundostack.html#indexChanged)() and [cleanChanged](qundostack.html#cleanChanged)() are not emitted, * [canUndo](qundostack.html#canUndo)() and [canRedo](qundostack.html#canRedo)() return false, * calling [undo](qundostack.html#undo)() or [redo](qundostack.html#redo)() has no effect, * the undo/redo actions are disabled. 堆棧是可用的,適當的信號被發射時,[endMacro](qundostack.html#endMacro)()被調用用于最外層的宏。 ``` stack.beginMacro("insert red text"); stack.push(new InsertText(document, idx, text)); stack.push(new SetColor(document, idx, text.length(), [Qt](qt.html).red)); stack.endMacro(); // indexChanged() is emitted ``` 這段代碼等同于: ``` [QUndoCommand](qundocommand.html) *insertRed = new [QUndoCommand](qundocommand.html)(); // an empty command insertRed->setText("insert red text"); new InsertText(document, idx, text, insertRed); // becomes child of insertRed new SetColor(document, idx, text.length(), [Qt](qt.html).red, insertRed); stack.push(insertRed); ``` **See also** [endMacro](qundostack.html#endMacro)( ) 。 ``` bool QUndoStack.canRedo (self) ``` 返回True如果有可用的重做命令,否則返回False 。 如果堆棧為空或者棧頂的命令已經被重做這個函數返回False 。 代名詞[index](qundostack.html#index)()==[count](qundostack.html#count)( ) 。 **See also** [index](qundostack.html#index)()和[canUndo](qundostack.html#canUndo)( ) 。 ``` bool QUndoStack.canUndo (self) ``` 返回True如果有可用撤消命令,否則返回False 。 這個函數返回False,如果堆棧為空,或者如果堆棧底部的命令已被撤銷。 代名詞[index](qundostack.html#index)()== 0 。 **See also** [index](qundostack.html#index)()和[canRedo](qundostack.html#canRedo)( ) 。 ``` int QUndoStack.cleanIndex (self) ``` 返回干凈的索引。這是該指數在這[setClean](qundostack.html#setClean)( )被調用。 堆棧可能沒有一個干凈的索引。出現這種情況,如果一個文件被保存,一些命令被撤消,那么一個新的命令被按下。自[push](qundostack.html#push)( )刪除所有推新命令之前未完成的指令,堆棧不能返回到干凈的狀態了。在這種情況下,該函數返回-1 。 **See also** [isClean](qundostack.html#isClean)()和[setClean](qundostack.html#setClean)( ) 。 ``` QUndoStack.clear (self) ``` 清除命令堆棧刪除其上的所有命令,并返回堆棧到干凈的狀態。 命令都不會撤消或重做;編輯的對象的狀態保持不變。 此功能通常用于當該文件的內容被放棄。 **See also** [QUndoStack](qundostack.html#QUndoStack)( ) 。 ``` QUndoCommand QUndoStack.command (self, int?index) ``` [ 在返回一個const指針,指向命令_index_。 這個函數返回一個const指針,因為修改的命令,一旦被壓入堆棧和執行的,幾乎總是會導致文檔的狀態的腐敗,如果命令是后來撤消或重做。 此功能被引入Qt的4.4 。 ](qundocommand.html) [**See also**](qundocommand.html) [QUndoCommand.child](qundocommand.html#child)( ) 。 ``` int QUndoStack.count (self) ``` 返回命令的堆棧數。宏命令都算作一個命令。 **See also** [index](qundostack.html#index)( )[setIndex](qundostack.html#setIndex)()和[command](qundostack.html#command)( ) 。 ``` QAction QUndoStack.createRedoAction (self, QObject?parent, QString?prefix?=?QString()) ``` [ 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 ](qaction.html) [創建一個重做](qaction.html)[QAction](qaction.html)與給定對象_parent_。 觸發此動作將導致調用[redo](qundostack.html#redo)( ) 。這個動作的文本命令,將在下一呼叫重做文本[redo](qundostack.html#redo)( ) ,前綴由指定的_prefix_。如果沒有可用的重做命令,這個動作將被禁用。 If _prefix_為空,則默認模板“重做% 1 ”是用來代替前綴。 Qt的4.8之前,前綴“重做”被默認使用。 **See also** [createUndoAction](qundostack.html#createUndoAction)( )[canRedo](qundostack.html#canRedo)()和[QUndoCommand.text](qundocommand.html#text)( ) 。 ``` QAction QUndoStack.createUndoAction (self, QObject?parent, QString?prefix?=?QString()) ``` [ 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 ](qaction.html) [創建一個撤消](qaction.html)[QAction](qaction.html)與給定對象_parent_。 觸發此動作將導致調用[undo](qundostack.html#undo)( ) 。這個動作的文本將在下一呼叫撤消命令的文本[undo](qundostack.html#undo)( ) ,前綴由指定的_prefix_。如果沒有可用的undo命令,這個動作將被禁用。 If _prefix_為空,則使用默認模板,而不是前綴“還原% 1 ” 。 Qt的4.8之前,前綴“撤消”被默認使用。 **See also** [createRedoAction](qundostack.html#createRedoAction)( )[canUndo](qundostack.html#canUndo)()和[QUndoCommand.text](qundocommand.html#text)( ) 。 ``` QUndoStack.endMacro (self) ``` 結束一個宏命令組成。 如果是這樣的最外層的宏在一組嵌套的宏,該功能會發出[indexChanged](qundostack.html#indexChanged)( )一旦整個宏命令。 **See also** [beginMacro](qundostack.html#beginMacro)( ) 。 ``` int QUndoStack.index (self) ``` 返回當前指令的索引。這是將要到下一個調用執行的命令[redo](qundostack.html#redo)( ) 。它并不總是在堆棧中最上面的命令,因為一些命令可能已被撤消。 **See also** [setIndex](qundostack.html#setIndex)( )[undo](qundostack.html#undo)( )[redo](qundostack.html#redo)()和[count](qundostack.html#count)( ) 。 ``` bool QUndoStack.isActive (self) ``` ``` bool QUndoStack.isClean (self) ``` 如果堆棧是在干凈的狀態,返回True,否則返回False 。 **See also** [setClean](qundostack.html#setClean)()和[cleanIndex](qundostack.html#cleanIndex)( ) 。 ``` QUndoStack.push (self, QUndoCommand?cmd) ``` 該_cmd_說法有它的所有權轉移給Qt的。 Pushes _cmd_在堆棧上或與最近執行的命令將其合并。在任一情況下,執行時_cmd_通過調用其[redo](qundostack.html#redo)()函數。 If _cmd_的ID不是-1,如果ID是相同的最近執行的命令的,[QUndoStack](qundostack.html)將嘗試通過調用合并兩個命令[QUndoCommand.mergeWith](qundocommand.html#mergeWith)( )在最近執行的命令。如果[QUndoCommand.mergeWith](qundocommand.html#mergeWith)( )返回True ,_cmd_被刪除。 在所有其他情況下,_cmd_簡直是壓入堆棧。 如果命令之前被撤銷_cmd_被按下時,電流指令和它上面的所有命令都被刪除。故_cmd_總是最終被堆棧中的最頂層。 一旦命令被按下時,堆棧采用它的所有權。有沒有getter方法??返回的命令,因為它修改它已經被執行后,將幾乎總是導致文檔的狀態的腐敗。 **See also** [QUndoCommand.id](qundocommand.html#id)()和[QUndoCommand.mergeWith](qundocommand.html#mergeWith)( ) 。 ``` QUndoStack.redo (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void redo()`。 通過調用重做當前命令[QUndoCommand.redo](qundocommand.html#redo)( ) 。增加當前命令索引。 如果堆棧為空,或者如果堆棧頂部的命令已經被重做,這個函數不執行任何操作。 **See also** [undo](qundostack.html#undo)()和[index](qundostack.html#index)( ) 。 ``` QString QUndoStack.redoText (self) ``` 返回的命令,將在下一呼叫重做文本[redo](qundostack.html#redo)( ) 。 **See also** [QUndoCommand.actionText](qundocommand.html#actionText)()和[undoText](qundostack.html#undoText)( ) 。 ``` QUndoStack.setActive (self, bool?active?=?True) ``` 這種方法也是一個Qt槽與C + +的簽名`void setActive(bool = 1)`。 ``` QUndoStack.setClean (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void setClean()`。 標記堆棧干凈并發出[cleanChanged](qundostack.html#cleanChanged)()如果堆棧是不是已經干凈了。 每當通過使用撤銷/的堆棧恢復到這個狀態重做命令,它發出的信號[cleanChanged](qundostack.html#cleanChanged)( ) 。當堆棧離開干凈的狀態,這個信號被發射也。 **See also** [isClean](qundostack.html#isClean)()和[cleanIndex](qundostack.html#cleanIndex)( ) 。 ``` QUndoStack.setIndex (self, int?idx) ``` 這種方法也是一個Qt槽與C + +的簽名`void setIndex(int)`。 反復調用[undo](qundostack.html#undo)()或[redo](qundostack.html#redo)( ),直到當前命令指數達到_idx_。此功能可用于滾動文檔的狀態向前向后。[indexChanged](qundostack.html#indexChanged)()被發射一次。 **See also** [index](qundostack.html#index)( )[count](qundostack.html#count)( )[undo](qundostack.html#undo)()和[redo](qundostack.html#redo)( ) 。 ``` QUndoStack.setUndoLimit (self, int?limit) ``` ``` QString QUndoStack.text (self, int?idx) ``` 在索引返回的命令的文本_idx_。 **See also** [beginMacro](qundostack.html#beginMacro)( ) 。 ``` QUndoStack.undo (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void undo()`。 通過調用撤消當前命令下面的命令[QUndoCommand.undo](qundocommand.html#undo)( ) 。減少當前命令索引。 如果堆棧是空的,或者如果堆棧底部的命令已被撤銷,該函數不起作用。 **See also** [redo](qundostack.html#redo)()和[index](qundostack.html#index)( ) 。 ``` int QUndoStack.undoLimit (self) ``` ``` QString QUndoStack.undoText (self) ``` 返回的命令,將在下一呼叫撤消文本[undo](qundostack.html#undo)( ) 。 **See also** [QUndoCommand.actionText](qundocommand.html#actionText)()和[redoText](qundostack.html#redoText)( ) 。 ``` QUndoStack.__len__ (self) ``` * * * ## Qt Signal Documentation ``` void canRedoChanged (bool) ``` 這是該信號的默認超載。 這個信號被發射時的值[canRedo](qundostack.html#canRedo)()的變化。它是用來啟用或禁用通過返回重做動作[createRedoAction](qundostack.html#createRedoAction)( ) 。_canRedo_指定的新值。 ``` void canUndoChanged (bool) ``` 這是該信號的默認超載。 這個信號被發射時的值[canUndo](qundostack.html#canUndo)()的變化。它是用來啟用或禁用通過返回的撤消操作[createUndoAction](qundostack.html#createUndoAction)( ) 。_canUndo_指定的新值。 ``` void cleanChanged (bool) ``` 這是該信號的默認超載。 每當堆棧進入或離開干凈的狀態這個信號被發射。如果_clean_誠然,堆棧是在一個干凈的狀態,否則這個信號表明,它已經離開了干凈的狀態。 **See also** [isClean](qundostack.html#isClean)()和[setClean](qundostack.html#setClean)( ) 。 ``` void indexChanged (int) ``` 這是該信號的默認超載。 這個信號被發射時的命令修改文檔的狀態。這發生在一個命令撤消或重做。當一個宏命令撤消或重做,或[setIndex](qundostack.html#setIndex)()被調用時,這個信號被發射一次。 _idx_指定當前命令,即索引。這將是到下一個調用執行的命令[redo](qundostack.html#redo)( ) 。 **See also** [index](qundostack.html#index)()和[setIndex](qundostack.html#setIndex)( ) 。 ``` void redoTextChanged (const QString&) ``` 這是該信號的默認超載。 這個信號被發射時的值[redoText](qundostack.html#redoText)()的變化。它是用來更新由返回重做動作的text屬性[createRedoAction](qundostack.html#createRedoAction)( ) 。_redoText_指定新文本。 ``` void undoTextChanged (const QString&) ``` 這是該信號的默認超載。 這個信號被發射時的值[undoText](qundostack.html#undoText)()的變化。它是用來更新返回的撤消操作的text屬性[createUndoAction](qundostack.html#createUndoAction)( ) 。_undoText_指定新文本。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看