Image Formats NG
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
Document Class Reference

Base class for all documents. More...

Inherits QObject.

Inherited by ImageDocument, and SimpleDocument.

Public Slots

void undo ()
 Undoes the last operation.
 
void redo ()
 Redoes the current operation.
 

Signals

void modificationChanged (bool modified)
 This signal is emitted whenever the content of the document changes in a way that affects the modification state. More...
 

Public Member Functions

 Document (QObject *parent=Q_NULLPTR)
 Constructs an AbstractDocument with the given parent.
 
 ~Document ()
 Destroys the AbstractDocument object.
 
bool isModified () const
 This property holds whether the document has been modified by the user. More...
 
void clearUndoStack ()
 Clears the undo redo stack.
 

Protected Member Functions

 Document (DocumentPrivate &dd, QObject *parent=Q_NULLPTR)
 Constructs an AbstractDocument with the given parent and private class dd.
 
QUndoStack * undoStack () const
 Returns pointer to the undo-redo stack. More...
 

Properties

bool canRedo
 This property holds whether there are any commands to redo.
 
bool canUndo
 This property holds whether there are any commands to redo.
 

Detailed Description

Base class for all documents.

Provides base functionality like modified state or undo-redo stack.

Member Function Documentation

◆ isModified()

bool Document::isModified ( ) const

This property holds whether the document has been modified by the user.

By default, this property is false.

See also
modificationChanged()

◆ modificationChanged

Document::modificationChanged ( bool  changed)
signal

This signal is emitted whenever the content of the document changes in a way that affects the modification state.

If changed is true, the document has been modified; otherwise it is false.

For example, calling setModified(false) on a document and then changing a document causes the signal to get emitted. If you undo that operation, causing the document to return to its original unmodified state, the signal will get emitted again.

◆ undoStack()

QUndoStack * Document::undoStack ( ) const
protected

Returns pointer to the undo-redo stack.

Can be used to insert undo-redo commands.