Qt 4.8
Public Functions | Public Variables | List of all members
QTextDocumentFragmentPrivate Class Reference

#include <qtextdocumentfragment_p.h>

Public Functions

void insert (QTextCursor &cursor) const
 
 QTextDocumentFragmentPrivate (const QTextCursor &cursor=QTextCursor())
 
 ~QTextDocumentFragmentPrivate ()
 

Public Variables

QTextDocumentdoc
 
uint importedFromPlainText: 1
 
QAtomicInt ref
 

Detailed Description

Definition at line 100 of file qtextdocumentfragment_p.h.

Constructors and Destructors

◆ QTextDocumentFragmentPrivate()

QTextDocumentFragmentPrivate::QTextDocumentFragmentPrivate ( const QTextCursor cursor = QTextCursor())

Definition at line 222 of file qtextdocumentfragment.cpp.

223  : ref(1), doc(new QTextDocument), importedFromPlainText(false)
224 {
225  doc->setUndoRedoEnabled(false);
226 
227  if (!_cursor.hasSelection())
228  return;
229 
231  QTextCursor destCursor(doc);
232  QTextCopyHelper(_cursor, destCursor).copy();
233  doc->docHandle()->endEditBlock();
234 
235  if (_cursor.d)
236  doc->docHandle()->mergeCachedResources(_cursor.d->priv);
237 }
QTextDocumentPrivate * docHandle() const
So that not all classes have to be friends of each other.
The QTextCursor class offers an API to access and modify QTextDocuments.
Definition: qtextcursor.h:70
void mergeCachedResources(const QTextDocumentPrivate *priv)
void setUndoRedoEnabled(bool enable)
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...

◆ ~QTextDocumentFragmentPrivate()

QTextDocumentFragmentPrivate::~QTextDocumentFragmentPrivate ( )
inline

Definition at line 104 of file qtextdocumentfragment_p.h.

104 { delete doc; }

Functions

◆ insert()

void QTextDocumentFragmentPrivate::insert ( QTextCursor cursor) const

Definition at line 239 of file qtextdocumentfragment.cpp.

Referenced by QTextCursor::insertFragment().

240 {
241  if (_cursor.isNull())
242  return;
243 
244  QTextDocumentPrivate *destPieceTable = _cursor.d->priv;
245  destPieceTable->beginEditBlock();
246 
247  QTextCursor sourceCursor(doc);
248  sourceCursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
249  QTextCopyHelper(sourceCursor, _cursor, importedFromPlainText, _cursor.charFormat()).copy();
250 
251  destPieceTable->endEditBlock();
252 }
The QTextCursor class offers an API to access and modify QTextDocuments.
Definition: qtextcursor.h:70

Properties

◆ doc

QTextDocument* QTextDocumentFragmentPrivate::doc

◆ importedFromPlainText

uint QTextDocumentFragmentPrivate::importedFromPlainText

Definition at line 111 of file qtextdocumentfragment_p.h.

Referenced by QTextDocumentFragment::fromPlainText(), and insert().

◆ ref

QAtomicInt QTextDocumentFragmentPrivate::ref

The documentation for this class was generated from the following files: