QUndoGroup 类是组为 QUndoStack 对象。 更多...
继承 QObject .
QUndoGroup 类是组为 QUndoStack 对象。
有关 Qt 撤消框架的概述,见 概述 .
An application often has multiple undo stacks, one for each opened document. At the same time, an application usually has one undo action and one redo action, which triggers undo or redo in the active document.
QUndoGroup is a group of QUndoStack objects, one of which may be active. It has an undo () 和 redo () slot, which calls QUndoStack.undo () 和 QUndoStack.redo () for the active stack. It also has the functions createUndoAction () 和 createRedoAction (). The actions returned by these functions behave in the same way as those returned by QUndoStack.createUndoAction () and QUndoStack.createRedoAction () of the active stack.
Stacks are added to a group with addStack () and removed with removeStack (). A stack is implicitly added to a group when it is created with the group as its parent QObject .
It is the programmer's responsibility to specify which stack is active by calling QUndoStack.setActive (), usually when the associated document window receives focus. The active stack may also be set with setActiveStack (), and is returned by activeStack ().
When a stack is added to a group using addStack (), the group does not take ownership of the stack. This means the stack has to be deleted separately from the group. When a stack is deleted, it is automatically removed from a group. A stack may belong to only one group. Adding it to another group will cause it to be removed from the previous group.
A QUndoGroup is also useful in conjunction with QUndoView . If a QUndoView is set to watch a group using QUndoView.setGroup (), it will update itself to display the active stack.
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
Creates an empty QUndoGroup object 采用父级 parent .
另请参阅 addStack ().
Returns the active stack of this group.
If none of the stacks are active, or if the group is empty, this function returns 0.
另请参阅 setActiveStack () 和 QUndoStack.setActive ().
添加 stack to this group. The group does not take ownership of the stack. Another way of adding a stack to a group is by specifying the group as the stack's parent QObject in QUndoStack.QUndoStack (). In this case, the stack is deleted when the group is deleted, in the usual manner of QObjects .
另请参阅 removeStack (), stacks (),和 QUndoStack.QUndoStack ().
Returns the value of the active stack's QUndoStack.canRedo ().
If none of the stacks are active, or if the group is empty, this function returns false.
另请参阅 canUndo () and setActiveStack ().
Returns the value of the active stack's QUndoStack.canUndo ().
If none of the stacks are active, or if the group is empty, this function returns false.
另请参阅 canRedo () and setActiveStack ().
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
Creates an redo QAction object with parent parent .
Triggering this action will cause a call to QUndoStack.redo () on the active stack. The text of this action will always be the text of the command which will be redone in the next call to redo (), prefixed by prefix 。若 there is no command available for redo, if the group is empty or if none of the stacks are active, this action will be disabled.
若 prefix is empty, the default template "Redo %1" is used instead of prefix. Before Qt 4.8, the prefix "Redo" was used 在默认情况下。
另请参阅 createUndoAction (), canRedo (),和 QUndoCommand.text ().
parent argument, if not None, causes self to be owned by Qt instead of PyQt.
Creates an undo QAction object with parent parent .
Triggering this action will cause a call to QUndoStack.undo () on the active stack. The text of this action will always be the text of the command which will be undone in the next call to undo (), prefixed by prefix 。若 there is no command available for undo, if the group is empty or if none of the stacks are active, this action will be disabled.
若 prefix is empty, the default template "Undo %1" is used instead of prefix. Before Qt 4.8, the prefix "Undo" was used 在默认情况下。
另请参阅 createRedoAction (), canUndo (),和 QUndoCommand.text ().
Returns the value of the active stack's QUndoStack.isClean ().
If none of the stacks are active, or if the group is empty, this function returns true.
另请参阅 setActiveStack ().
This method is also a Qt slot with the C++ signature void redo() .
调用 QUndoStack.redo () 在 the active stack.
If none of the stacks are active, or if the group is empty, this function does nothing.
另请参阅 undo (), canRedo (),和 setActiveStack ().
Returns the value of the active stack's QUndoStack.redoText ().
If none of the stacks are active, or if the group is empty, this function returns an empty string.
另请参阅 undoText () 和 setActiveStack ().
移除 stack from this group. If the stack was the active stack in the group, the active stack becomes 0.
另请参阅 addStack (), stacks (),和 QUndoStack.~QUndoStack ().
This method is also a Qt slot with the C++ signature void setActiveStack(QUndoStack*) .
Sets the active stack of this group to stack .
If the stack is not a member of this group, this function does nothing.
Synonymous with calling QUndoStack.setActive () 在 stack .
The actions returned by createUndoAction () 和 createRedoAction () will now behave in the same way as those returned by stack 's QUndoStack.createUndoAction () and QUndoStack.createRedoAction ().
另请参阅 QUndoStack.setActive () 和 activeStack ().
Returns a list of stacks in this group.
另请参阅 addStack () 和 removeStack ().
This method is also a Qt slot with the C++ signature void undo() .
调用 QUndoStack.undo () 在 the active stack.
If none of the stacks are active, or if the group is empty, this function does nothing.
另请参阅 redo (), canUndo (),和 setActiveStack ().
Returns the value of the active stack's QUndoStack.undoText ().
If none of the stacks are active, or if the group is empty, this function returns an empty string.
另请参阅 redoText () 和 setActiveStack ().
This is the default overload of this signal.
This signal is emitted whenever the active stack of the group changes. This can happen when setActiveStack () 或 QUndoStack.setActive () 是 called, or when the active stack is removed form the group. stack is the new active stack. If no stack is active, stack 为 0。
另请参阅 setActiveStack () 和 QUndoStack.setActive ().
This is the default overload of this signal.
This signal is emitted whenever the active stack emits QUndoStack.canRedoChanged () or the active stack changes.
canRedo is the new state, or false if the active stack is 0.
另请参阅 QUndoStack.canRedoChanged () and setActiveStack ().
This is the default overload of this signal.
This signal is emitted whenever the active stack emits QUndoStack.canUndoChanged () or the active stack changes.
canUndo is the new state, or false if the active stack is 0.
另请参阅 QUndoStack.canUndoChanged () and setActiveStack ().
This is the default overload of this signal.
This signal is emitted whenever the active stack emits QUndoStack.cleanChanged () 或 the active stack changes.
clean is the new state, or true if the active stack is 0.
另请参阅 QUndoStack.cleanChanged () 和 setActiveStack ().
This is the default overload of this signal.
This signal is emitted whenever the active stack emits QUndoStack.indexChanged () 或 the active stack changes.
idx is the new current index, or 0 if the active stack is 0.
另请参阅 QUndoStack.indexChanged () 和 setActiveStack ().
This is the default overload of this signal.
This signal is emitted whenever the active stack emits QUndoStack.redoTextChanged () or the active stack changes.
redoText is the new state, or an empty string if the active stack is 0.
另请参阅 QUndoStack.redoTextChanged () and setActiveStack ().
This is the default overload of this signal.
This signal is emitted whenever the active stack emits QUndoStack.undoTextChanged () or the active stack changes.
undoText is the new state, or an empty string if the active stack is 0.
另请参阅 QUndoStack.undoTextChanged () and setActiveStack ().