[][src]Struct qt_widgets::QUndoGroup

#[repr(C)]pub struct QUndoGroup { /* fields omitted */ }

The QUndoGroup class is a group of QUndoStack objects.

C++ class: QUndoGroup.

C++ documentation:

The QUndoGroup class is a group of QUndoStack objects.

For an overview of the Qt's undo framework, see the overview.

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() and redo() slot, which calls QUndoStack::undo() and QUndoStack::redo() for the active stack. It also has the functions createUndoAction() and 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.

Methods

impl QUndoGroup[src]

pub fn slot_undo(&self) -> Receiver<()>[src]

Calls QUndoStack::undo() on the active stack.

Returns a built-in Qt slot QUndoGroup::undo that can be passed to qt_core::Signal::connect.

C++ documentation:

Calls QUndoStack::undo() on the active stack.

If none of the stacks are active, or if the group is empty, this function does nothing.

See also redo(), canUndo(), and setActiveStack().

pub fn slot_redo(&self) -> Receiver<()>[src]

Calls QUndoStack::redo() on the active stack.

Returns a built-in Qt slot QUndoGroup::redo that can be passed to qt_core::Signal::connect.

C++ documentation:

Calls QUndoStack::redo() on the active stack.

If none of the stacks are active, or if the group is empty, this function does nothing.

See also undo(), canRedo(), and setActiveStack().

pub fn slot_set_active_stack(&self) -> Receiver<(*mut QUndoStack,)>[src]

Sets the active stack of this group to stack.

Returns a built-in Qt slot QUndoGroup::setActiveStack that can be passed to qt_core::Signal::connect.

C++ documentation:

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() on stack.

The actions returned by createUndoAction() and createRedoAction() will now behave in the same way as those returned by stack's QUndoStack::createUndoAction() and QUndoStack::createRedoAction().

See also QUndoStack::setActive() and activeStack().

pub fn active_stack_changed(&self) -> Signal<(*mut QUndoStack,)>[src]

This signal is emitted whenever the active stack of the group changes. This can happen when setActiveStack() or QUndoStack::setActive() is called, or when the active stack is removed form the group. stack is the new active stack. If no stack is active, stack is 0.

Returns a built-in Qt signal QUndoGroup::activeStackChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever the active stack of the group changes. This can happen when setActiveStack() or QUndoStack::setActive() is called, or when the active stack is removed form the group. stack is the new active stack. If no stack is active, stack is 0.

See also setActiveStack() and QUndoStack::setActive().

pub fn index_changed(&self) -> Signal<(c_int,)>[src]

This signal is emitted whenever the active stack emits QUndoStack::indexChanged() or the active stack changes.

Returns a built-in Qt signal QUndoGroup::indexChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever the active stack emits QUndoStack::indexChanged() or the active stack changes.

idx is the new current index, or 0 if the active stack is 0.

See also QUndoStack::indexChanged() and setActiveStack().

pub fn clean_changed(&self) -> Signal<(bool,)>[src]

This signal is emitted whenever the active stack emits QUndoStack::cleanChanged() or the active stack changes.

Returns a built-in Qt signal QUndoGroup::cleanChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever the active stack emits QUndoStack::cleanChanged() or the active stack changes.

clean is the new state, or true if the active stack is 0.

See also QUndoStack::cleanChanged() and setActiveStack().

pub fn can_undo_changed(&self) -> Signal<(bool,)>[src]

This signal is emitted whenever the active stack emits QUndoStack::canUndoChanged() or the active stack changes.

Returns a built-in Qt signal QUndoGroup::canUndoChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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.

See also QUndoStack::canUndoChanged() and setActiveStack().

pub fn can_redo_changed(&self) -> Signal<(bool,)>[src]

This signal is emitted whenever the active stack emits QUndoStack::canRedoChanged() or the active stack changes.

Returns a built-in Qt signal QUndoGroup::canRedoChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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.

See also QUndoStack::canRedoChanged() and setActiveStack().

pub fn undo_text_changed(&self) -> Signal<(*const QString,)>[src]

This signal is emitted whenever the active stack emits QUndoStack::undoTextChanged() or the active stack changes.

Returns a built-in Qt signal QUndoGroup::undoTextChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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.

See also QUndoStack::undoTextChanged() and setActiveStack().

pub fn redo_text_changed(&self) -> Signal<(*const QString,)>[src]

This signal is emitted whenever the active stack emits QUndoStack::redoTextChanged() or the active stack changes.

Returns a built-in Qt signal QUndoGroup::redoTextChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

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.

See also QUndoStack::redoTextChanged() and setActiveStack().

pub unsafe fn active_stack(&self) -> QPtr<QUndoStack>[src]

Returns the active stack of this group.

Calls C++ function: QUndoStack* QUndoGroup::activeStack() const.

C++ documentation:

Returns the active stack of this group.

If none of the stacks are active, or if the group is empty, this function returns 0.

See also setActiveStack() and QUndoStack::setActive().

pub unsafe fn add_stack(&self, stack: impl CastInto<Ptr<QUndoStack>>)[src]

Adds 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.

Calls C++ function: void QUndoGroup::addStack(QUndoStack* stack).

C++ documentation:

Adds 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.

See also removeStack(), stacks(), and QUndoStack::QUndoStack().

pub unsafe fn can_redo(&self) -> bool[src]

Returns the value of the active stack's QUndoStack::canRedo().

Calls C++ function: bool QUndoGroup::canRedo() const.

C++ documentation:

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.

See also canUndo() and setActiveStack().

pub unsafe fn can_undo(&self) -> bool[src]

Returns the value of the active stack's QUndoStack::canUndo().

Calls C++ function: bool QUndoGroup::canUndo() const.

C++ documentation:

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.

See also canRedo() and setActiveStack().

pub unsafe fn create_redo_action_2a(
    &self,
    parent: impl CastInto<Ptr<QObject>>,
    prefix: impl CastInto<Ref<QString>>
) -> QPtr<QAction>
[src]

Creates an redo QAction object with parent parent.

Calls C++ function: QAction* QUndoGroup::createRedoAction(QObject* parent, const QString& prefix = …) const.

C++ documentation:

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. If 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.

If prefix is empty, the default template "Redo %1" is used instead of prefix. Before Qt 4.8, the prefix "Redo" was used by default.

See also createUndoAction(), canRedo(), and QUndoCommand::text().

pub unsafe fn create_redo_action_1a(
    &self,
    parent: impl CastInto<Ptr<QObject>>
) -> QPtr<QAction>
[src]

Creates an redo QAction object with parent parent.

Calls C++ function: QAction* QUndoGroup::createRedoAction(QObject* parent) const.

C++ documentation:

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. If 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.

If prefix is empty, the default template "Redo %1" is used instead of prefix. Before Qt 4.8, the prefix "Redo" was used by default.

See also createUndoAction(), canRedo(), and QUndoCommand::text().

pub unsafe fn create_undo_action_2a(
    &self,
    parent: impl CastInto<Ptr<QObject>>,
    prefix: impl CastInto<Ref<QString>>
) -> QPtr<QAction>
[src]

Creates an undo QAction object with parent parent.

Calls C++ function: QAction* QUndoGroup::createUndoAction(QObject* parent, const QString& prefix = …) const.

C++ documentation:

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. If 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.

If prefix is empty, the default template "Undo %1" is used instead of prefix. Before Qt 4.8, the prefix "Undo" was used by default.

See also createRedoAction(), canUndo(), and QUndoCommand::text().

pub unsafe fn create_undo_action_1a(
    &self,
    parent: impl CastInto<Ptr<QObject>>
) -> QPtr<QAction>
[src]

Creates an undo QAction object with parent parent.

Calls C++ function: QAction* QUndoGroup::createUndoAction(QObject* parent) const.

C++ documentation:

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. If 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.

If prefix is empty, the default template "Undo %1" is used instead of prefix. Before Qt 4.8, the prefix "Undo" was used by default.

See also createRedoAction(), canUndo(), and QUndoCommand::text().

pub unsafe fn is_clean(&self) -> bool[src]

Returns the value of the active stack's QUndoStack::isClean().

Calls C++ function: bool QUndoGroup::isClean() const.

C++ documentation:

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.

See also setActiveStack().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QUndoGroup::metaObject() const.

pub unsafe fn new_1a(parent: impl CastInto<Ptr<QObject>>) -> QBox<QUndoGroup>[src]

Creates an empty QUndoGroup object with parent parent.

Calls C++ function: [constructor] void QUndoGroup::QUndoGroup(QObject* parent = …).

C++ documentation:

Creates an empty QUndoGroup object with parent parent.

See also addStack().

pub unsafe fn new_0a() -> QBox<QUndoGroup>[src]

The QUndoGroup class is a group of QUndoStack objects.

Calls C++ function: [constructor] void QUndoGroup::QUndoGroup().

C++ documentation:

The QUndoGroup class is a group of QUndoStack objects.

For an overview of the Qt's undo framework, see the overview.

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() and redo() slot, which calls QUndoStack::undo() and QUndoStack::redo() for the active stack. It also has the functions createUndoAction() and 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.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QUndoGroup::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QUndoGroup::qt_metacast(const char* arg1).

pub unsafe fn redo(&self)[src]

Calls QUndoStack::redo() on the active stack.

Calls C++ function: [slot] void QUndoGroup::redo().

C++ documentation:

Calls QUndoStack::redo() on the active stack.

If none of the stacks are active, or if the group is empty, this function does nothing.

See also undo(), canRedo(), and setActiveStack().

pub unsafe fn redo_text(&self) -> CppBox<QString>[src]

Returns the value of the active stack's QUndoStack::redoText().

Calls C++ function: QString QUndoGroup::redoText() const.

C++ documentation:

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.

See also undoText() and setActiveStack().

pub unsafe fn remove_stack(&self, stack: impl CastInto<Ptr<QUndoStack>>)[src]

Removes stack from this group. If the stack was the active stack in the group, the active stack becomes 0.

Calls C++ function: void QUndoGroup::removeStack(QUndoStack* stack).

C++ documentation:

Removes stack from this group. If the stack was the active stack in the group, the active stack becomes 0.

See also addStack(), stacks(), and QUndoStack::~QUndoStack().

pub unsafe fn set_active_stack(&self, stack: impl CastInto<Ptr<QUndoStack>>)[src]

Sets the active stack of this group to stack.

Calls C++ function: [slot] void QUndoGroup::setActiveStack(QUndoStack* stack).

C++ documentation:

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() on stack.

The actions returned by createUndoAction() and createRedoAction() will now behave in the same way as those returned by stack's QUndoStack::createUndoAction() and QUndoStack::createRedoAction().

See also QUndoStack::setActive() and activeStack().

pub unsafe fn stacks(&self) -> CppBox<QListOfQUndoStack>[src]

Returns a list of stacks in this group.

Calls C++ function: QList<QUndoStack*> QUndoGroup::stacks() const.

C++ documentation:

Returns a list of stacks in this group.

See also addStack() and removeStack().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QUndoGroup::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QUndoGroup::trUtf8(const char* s, const char* c, int n).

pub unsafe fn undo(&self)[src]

Calls QUndoStack::undo() on the active stack.

Calls C++ function: [slot] void QUndoGroup::undo().

C++ documentation:

Calls QUndoStack::undo() on the active stack.

If none of the stacks are active, or if the group is empty, this function does nothing.

See also redo(), canUndo(), and setActiveStack().

pub unsafe fn undo_text(&self) -> CppBox<QString>[src]

Returns the value of the active stack's QUndoStack::undoText().

Calls C++ function: QString QUndoGroup::undoText() const.

C++ documentation:

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.

See also redoText() and setActiveStack().

Trait Implementations

impl CppDeletable for QUndoGroup[src]

unsafe fn delete(&self)[src]

Destroys the QUndoGroup.

Calls C++ function: virtual [destructor] void QUndoGroup::~QUndoGroup().

C++ documentation:

Destroys the QUndoGroup.

impl Deref for QUndoGroup[src]

type Target = QObject

The resulting type after dereferencing.

fn deref(&self) -> &QObject[src]

Calls C++ function: QObject* static_cast<QObject*>(QUndoGroup* ptr).

impl DynamicCast<QUndoGroup> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QUndoGroup>[src]

Calls C++ function: QUndoGroup* dynamic_cast<QUndoGroup*>(QObject* ptr).

impl StaticDowncast<QUndoGroup> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QUndoGroup>[src]

Calls C++ function: QUndoGroup* static_cast<QUndoGroup*>(QObject* ptr).

impl StaticUpcast<QObject> for QUndoGroup[src]

unsafe fn static_upcast(ptr: Ptr<QUndoGroup>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QUndoGroup* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.