KTextEditor::Document::EditingTransaction

KTextEditor::Document::EditingTransaction Class Reference

#include <document.h>

Public Member Functions

 EditingTransaction (Document *document)
 
 ~EditingTransaction ()
 
void finish ()
 
void start ()
 

Detailed Description

Editing transaction support.

Edit commands during this sequence will be bunched together so that they represent a single undo command in the editor, and so that repaint events do not occur in between.

Your application should not return control to the event loop while it has an unterminated (i.e. this object is not destructed) editing sequence (result undefined) - so do all of your work in one go!

Using this class typically looks as follows:

void foo() {
// now call editing functions
document->removeText(...)
document->insertText(...)
}

Although usually not required, the EditingTransaction additionally allows to manually call finish() and start() in between.

See also
editingStarted(), editingFinished()

Definition at line 472 of file document.h.

Constructor & Destructor Documentation

Document::EditingTransaction::EditingTransaction ( Document document)
explicit

Constructs the object and starts an editing transaction by calling start().

Parameters
documentdocument for the transaction
See also
start()

Definition at line 43 of file document.cpp.

Document::EditingTransaction::~EditingTransaction ( )

Destructs the object and, if needed, finishes a running editing transaction by calling finish().

See also
finish()

Definition at line 73 of file document.cpp.

Member Function Documentation

void Document::EditingTransaction::finish ( )

By calling finish(), the editing transaction can be finished already before destruction of this instance.

See also
start()

Definition at line 65 of file document.cpp.

void Document::EditingTransaction::start ( )

By calling start(), the editing transaction can be started again.

This function only is of use in combination with finish().

See also
finish()

Definition at line 57 of file document.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Oct 25 2020 23:02:01 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.