Into

Modules

Documentation

classPiiUndoCommandProducer

#include <PiiUndoCommandProducer.h>

An interface for UI components that support undo/redo functionality.

Description

Using this interface makes it possible to combine undo/redo functionality provided by diverse software components into a global undo/redo function.

Classes

class

A listener interface for applied undoable commands.

Constructors and destructor

Default constructor.

virtual

Virtual destructor.

Public member functions

void
( )

Set the listener.

Get the listener.

Static public member functions

static int

Generate a unique id number for a class of undoable commands.

Protected member functions

void
(
  • QUndoCommand * command
)

Called by subclasses to indicate that an undoable command has been performed.

Function details

  • PiiUndoCommandProducer

    ()

    Default constructor.

  • virtual ~PiiUndoCommandProducer

    ()
    [virtual]

    Virtual destructor.

    Does nothing.

  • void setUndoCommandListener

    ( )

    Set the listener.

  • Listener * undoCommandListener

    ()

    Get the listener.

  • static int generateId

    ()
    [static]

    Generate a unique id number for a class of undoable commands.

    Unique id numbers can be utilized by Qt's undo system in merging successive commands. Using the technique described in the example below ensures application-wide unique command identifiers and ensures that no overlapping ids will be used by independent components.

     // MyCommand.h
     class MyCommand : public QUndoCommand
     {
     public:
       //...
       int id() { return iCommandId; }
     private:
       static int iCommandId;
     };
    
     // MyCommand.cc
     int MyCommand::iCommandId = PiiUndoCommandProducer::generateId();
    
  • void undoCommandPerformed

    (
    • QUndoCommand * command
    )
    [protected]

    Called by subclasses to indicate that an undoable command has been performed.

    The caller must release the ownership of the pointer. If there is a listener, the command will be passed to its undoCommandPerformed() function. If there is no listener, the command will be deleted.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.