KTextEditor::Document::EditingTransaction

Search for usage in LXR

KTextEditor::Document::EditingTransaction Class Reference

#include <document.h>

Public Member Functions

 EditingTransaction (const EditingTransaction &)=delete
 
 EditingTransaction (Document *document)
 
 ~EditingTransaction ()
 
void finish ()
 
EditingTransactionoperator= (const EditingTransaction &)=delete
 
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(...)
}
Editing transaction support.
Definition document.h:574

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

See also
editingStarted(), editingFinished()

Definition at line 573 of file document.h.

Constructor & Destructor Documentation

◆ EditingTransaction() [1/2]

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 41 of file document.cpp.

◆ EditingTransaction() [2/2]

KTextEditor::Document::EditingTransaction::EditingTransaction ( const EditingTransaction & )
delete

No copy constructor, don't allow this to be copied.

◆ ~EditingTransaction()

Document::EditingTransaction::~EditingTransaction ( )

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

See also
finish()

Definition at line 71 of file document.cpp.

Member Function Documentation

◆ finish()

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 63 of file document.cpp.

◆ operator=()

EditingTransaction & KTextEditor::Document::EditingTransaction::operator= ( const EditingTransaction & )
delete

No assignment operator, no copying around editing transations.

◆ start()

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 55 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-2024 The KDE developers.
Generated on Fri Oct 4 2024 12:03:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.