Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QTextCursorPrivate Class Reference

#include <qtextcursor_p.h>

+ Inheritance diagram for QTextCursorPrivate:
+ Collaboration diagram for QTextCursorPrivate:

Public Types

enum  AdjustResult { CursorMoved , CursorUnchanged }
 

Public Member Functions

 QTextCursorPrivate (QTextDocumentPrivate *p)
 
 QTextCursorPrivate (const QTextCursorPrivate &rhs)
 
 ~QTextCursorPrivate ()
 
AdjustResult adjustPosition (int positionOfChange, int charsAddedOrRemoved, QTextUndoCommand::Operation op)
 
void adjustCursor (QTextCursor::MoveOperation m)
 
void remove ()
 
void clearCells (QTextTable *table, int startRow, int startCol, int numRows, int numCols, QTextUndoCommand::Operation op)
 
bool setPosition (int newPosition)
 
void setX ()
 
bool canDelete (int pos) const
 
void insertBlock (const QTextBlockFormat &format, const QTextCharFormat &charFormat)
 
bool movePosition (QTextCursor::MoveOperation op, QTextCursor::MoveMode mode=QTextCursor::MoveAnchor)
 
QTextBlock block () const
 
QTextBlockFormat blockFormat () const
 
QTextLayoutblockLayout (QTextBlock &block) const
 
QTextTablecomplexSelectionTable () const
 
void selectedTableCells (int *firstRow, int *numRows, int *firstColumn, int *numColumns) const
 
void setBlockCharFormat (const QTextCharFormat &format, QTextDocumentPrivate::FormatChangeMode changeMode)
 
void setBlockFormat (const QTextBlockFormat &format, QTextDocumentPrivate::FormatChangeMode changeMode)
 
void setCharFormat (const QTextCharFormat &format, QTextDocumentPrivate::FormatChangeMode changeMode)
 
void aboutToRemoveCell (int from, int to)
 
- Public Member Functions inherited from QSharedData
 QSharedData () noexcept
 Constructs a QSharedData object with a reference count of 0.
 
 QSharedData (const QSharedData &) noexcept
 Constructs a QSharedData object with reference count 0.
 
QSharedDataoperator= (const QSharedData &)=delete
 
 ~QSharedData ()=default
 

Static Public Member Functions

static QTextCursorPrivategetPrivate (QTextCursor *c)
 
static QTextCursor fromPosition (QTextDocumentPrivate *d, int pos)
 

Public Attributes

QTextDocumentPrivatepriv
 
qreal x
 
int position
 
int anchor
 
int adjusted_anchor
 
int currentCharFormat
 
uint visualNavigation: 1
 
uint keepPositionOnInsert: 1
 
uint changed: 1
 
- Public Attributes inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Definition at line 27 of file qtextcursor_p.h.

Member Enumeration Documentation

◆ AdjustResult

Enumerator
CursorMoved 
CursorUnchanged 

Definition at line 36 of file qtextcursor_p.h.

Constructor & Destructor Documentation

◆ QTextCursorPrivate() [1/2]

QTextCursorPrivate::QTextCursorPrivate ( QTextDocumentPrivate * p)

Definition at line 27 of file qtextcursor.cpp.

References QTextDocumentPrivate::addCursor(), and priv.

+ Here is the call graph for this function:

◆ QTextCursorPrivate() [2/2]

QTextCursorPrivate::QTextCursorPrivate ( const QTextCursorPrivate & rhs)

Definition at line 35 of file qtextcursor.cpp.

References QTextDocumentPrivate::addCursor(), adjusted_anchor, anchor, changed, currentCharFormat, keepPositionOnInsert, position, priv, visualNavigation, and x.

+ Here is the call graph for this function:

◆ ~QTextCursorPrivate()

QTextCursorPrivate::~QTextCursorPrivate ( )

Definition at line 51 of file qtextcursor.cpp.

References priv, and QTextDocumentPrivate::removeCursor().

+ Here is the call graph for this function:

Member Function Documentation

◆ aboutToRemoveCell()

void QTextCursorPrivate::aboutToRemoveCell ( int from,
int to )

Definition at line 243 of file qtextcursor.cpp.

References adjusted_anchor, anchor, QTextTableCell::firstPosition(), QTextDocumentPrivate::frameAt(), QTextTableCell::isValid(), position, priv, Q_ASSERT, qSwap(), and setPosition().

+ Here is the call graph for this function:

◆ adjustCursor()

void QTextCursorPrivate::adjustCursor ( QTextCursor::MoveOperation m)

Definition at line 177 of file qtextcursor.cpp.

References adjusted_anchor, anchor, currentCharFormat, QTextTableCell::firstPosition(), QTextDocumentPrivate::frameAt(), i, QTextFrame::parentFrame(), position, priv, Q_ASSERT, qMin(), and QTextCursor::WordLeft.

Referenced by movePosition(), and QTextCursor::setPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ adjustPosition()

QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition ( int positionOfChange,
int charsAddedOrRemoved,
QTextUndoCommand::Operation op )

◆ block()

QTextBlock QTextCursorPrivate::block ( ) const
inline

Definition at line 58 of file qtextcursor_p.h.

References position(), and priv().

Referenced by QTextCursor::atBlockEnd(), QTextCursor::atBlockStart(), QTextCursor::block(), QTextCursor::blockCharFormat(), QTextCursor::blockFormat(), blockLayout(), QTextCursor::blockNumber(), QTextCursor::charFormat(), QTextCursor::columnNumber(), QTextCursor::movePosition(), movePosition(), QTextCursor::positionInBlock(), QTextCursor::select(), and setX().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blockFormat()

QTextBlockFormat QTextCursorPrivate::blockFormat ( ) const
inline

Definition at line 60 of file qtextcursor_p.h.

◆ blockLayout()

QTextLayout * QTextCursorPrivate::blockLayout ( QTextBlock & block) const

Definition at line 835 of file qtextcursor.cpp.

References block(), QAbstractTextDocumentLayout::blockBoundingRect(), QTextDocumentPrivate::layout(), QTextBlock::layout(), QTextLayout::lineCount(), and priv.

Referenced by QTextCursor::columnNumber(), movePosition(), and setX().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canDelete()

bool QTextCursorPrivate::canDelete ( int pos) const

Definition at line 160 of file qtextcursor.cpp.

References QTextFormatCollection::charFormat(), QTextDocumentPrivate::find(), fmt, QTextDocumentPrivate::formatCollection(), QTextFormat::ImageObject, pos, and priv.

Referenced by QTextCursor::deleteChar(), and QTextCursor::deletePreviousChar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearCells()

void QTextCursorPrivate::clearCells ( QTextTable * table,
int startRow,
int startCol,
int numRows,
int numCols,
QTextUndoCommand::Operation op )

Definition at line 144 of file qtextcursor.cpp.

References QTextDocumentPrivate::beginEditBlock(), QTextDocumentPrivate::endEditBlock(), QTextTableCell::firstPosition(), QTextTableCell::lastPosition(), priv, Q_ASSERT, and QTextDocumentPrivate::remove().

Referenced by remove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ complexSelectionTable()

QTextTable * QTextCursorPrivate::complexSelectionTable ( ) const

Definition at line 635 of file qtextcursor.cpp.

References adjusted_anchor, anchor, QTextDocumentPrivate::frameAt(), position, priv, and Q_ASSERT.

Referenced by QTextCursor::hasComplexSelection(), movePosition(), remove(), QTextCursor::selectedText(), setBlockCharFormat(), setBlockFormat(), and setCharFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromPosition()

static QTextCursor QTextCursorPrivate::fromPosition ( QTextDocumentPrivate * d,
int pos )
inlinestatic

Definition at line 74 of file qtextcursor_p.h.

References d, and pos.

Referenced by findInBlock(), QTextFrame::firstCursorPosition(), QTextTableCell::firstCursorPosition(), QTextFrame::lastCursorPosition(), QTextTableCell::lastCursorPosition(), QTextTable::mergeCells(), QTextTable::rowEnd(), and QTextTable::rowStart().

+ Here is the caller graph for this function:

◆ getPrivate()

static QTextCursorPrivate * QTextCursorPrivate::getPrivate ( QTextCursor * c)
inlinestatic

Definition at line 34 of file qtextcursor_p.h.

◆ insertBlock()

void QTextCursorPrivate::insertBlock ( const QTextBlockFormat & format,
const QTextCharFormat & charFormat )

Definition at line 167 of file qtextcursor.cpp.

References currentCharFormat, QTextDocumentPrivate::formatCollection(), QTextFormatCollection::indexForFormat(), QTextDocumentPrivate::insertBlock(), position, priv, and Q_ASSERT.

Referenced by QTextCursor::insertBlock(), and QTextCursor::insertText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ movePosition()

bool QTextCursorPrivate::movePosition ( QTextCursor::MoveOperation op,
QTextCursor::MoveMode mode = QTextCursor::MoveAnchor )

Definition at line 304 of file qtextcursor.cpp.

References adjustCursor(), adjusted_anchor, anchor, QString::at(), block(), blockLayout(), QTextDocumentPrivate::blocksBegin(), QTextDocumentPrivate::blocksEnd(), QTextDocumentPrivate::blocksFind(), QTextTableCell::column(), QTextTableCell::columnSpan(), complexSelectionTable(), currentCharFormat, QTextDocumentPrivate::defaultCursorMoveStyle, QTextCursor::Down, QTextCursor::End, QTextCursor::EndOfBlock, QTextCursor::EndOfLine, QTextCursor::EndOfWord, engine, QTextTableCell::firstPosition(), QTextDocumentPrivate::frameAt(), i, QTextDocumentPrivate::isInEditBlock(), QTextTableCell::isValid(), QTextCursor::KeepAnchor, QTextTableCell::lastPosition(), layout, QTextCursor::Left, QTextDocumentPrivate::leftCursorPosition(), QTextDocumentPrivate::length(), QString::length(), line, QTextCursor::MoveAnchor, QTextBlock::next(), QTextCursor::NextBlock, QTextCursor::NextCell, QTextCursor::NextCharacter, QTextDocumentPrivate::nextCursorPosition(), QTextCursor::NextRow, QTextCursor::NextWord, QTextCursor::NoMove, position, QTextBlock::previous(), QTextCursor::PreviousBlock, QTextCursor::PreviousCell, QTextCursor::PreviousCharacter, QTextDocumentPrivate::previousCursorPosition(), QTextCursor::PreviousRow, QTextCursor::PreviousWord, priv, Q_ASSERT, Q_FALLTHROUGH, qMax(), qMin(), QTextCursor::Right, QTextDocumentPrivate::rightCursorPosition(), Qt::RightToLeft, QTextTableCell::row(), QTextTableCell::rowSpan(), setPosition(), setX(), QTextLayout::SkipCharacters, QTextLayout::SkipWords, QTextCursor::Start, QTextCursor::StartOfBlock, QTextCursor::StartOfLine, QTextCursor::StartOfWord, text, QTextCursor::Up, Qt::VisualMoveStyle, QCharAttributes::whiteSpace, QTextCursor::WordLeft, and QTextCursor::WordRight.

Referenced by QTextCursor::movePosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

void QTextCursorPrivate::remove ( )

Definition at line 114 of file qtextcursor.cpp.

References adjusted_anchor, anchor, QTextDocumentPrivate::beginEditBlock(), clearCells(), complexSelectionTable(), currentCharFormat, QTextDocumentPrivate::endEditBlock(), QTextUndoCommand::KeepCursor, QTextUndoCommand::MoveCursor, position, priv, QTextDocumentPrivate::remove(), and selectedTableCells().

Referenced by QTextCursor::deleteChar(), QTextCursor::deletePreviousChar(), QTextCursor::insertBlock(), QTextCursor::insertFragment(), QTextCursor::insertImage(), QTextCursor::insertText(), and QTextCursor::removeSelectedText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectedTableCells()

void QTextCursorPrivate::selectedTableCells ( int * firstRow,
int * numRows,
int * firstColumn,
int * numColumns ) const

Definition at line 653 of file qtextcursor.cpp.

References adjusted_anchor, anchor, QTextDocumentPrivate::frameAt(), position, priv, Q_ASSERT, qMax(), and qMin().

Referenced by remove(), QTextCursor::selectedTableCells(), setBlockCharFormat(), setBlockFormat(), and setCharFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBlockCharFormat()

void QTextCursorPrivate::setBlockCharFormat ( const QTextCharFormat & format,
QTextDocumentPrivate::FormatChangeMode changeMode )

Definition at line 694 of file qtextcursor.cpp.

References adjusted_anchor, QTextDocumentPrivate::beginEditBlock(), QTextFormat::clearProperty(), QTextTableCell::column(), QTextTableCell::columnSpan(), complexSelectionTable(), QTextDocumentPrivate::endEditBlock(), QTextTableCell::firstPosition(), QTextTableCell::lastPosition(), QTextFormat::ObjectIndex, position, priv, Q_ASSERT, QTextTableCell::row(), QTextTableCell::rowSpan(), selectedTableCells(), and setBlockCharFormatHelper().

Referenced by QTextCursor::mergeBlockCharFormat(), and QTextCursor::setBlockCharFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBlockFormat()

void QTextCursorPrivate::setBlockFormat ( const QTextBlockFormat & format,
QTextDocumentPrivate::FormatChangeMode changeMode )

Definition at line 743 of file qtextcursor.cpp.

References adjusted_anchor, QTextDocumentPrivate::beginEditBlock(), QTextDocumentPrivate::blocksFind(), QTextTableCell::column(), QTextTableCell::columnSpan(), complexSelectionTable(), QTextDocumentPrivate::endEditBlock(), QTextTableCell::firstPosition(), QTextTableCell::lastPosition(), position, priv, Q_ASSERT, QTextTableCell::row(), QTextTableCell::rowSpan(), selectedTableCells(), and QTextDocumentPrivate::setBlockFormat().

Referenced by QTextCursor::mergeBlockFormat(), and QTextCursor::setBlockFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCharFormat()

void QTextCursorPrivate::setCharFormat ( const QTextCharFormat & format,
QTextDocumentPrivate::FormatChangeMode changeMode )

Definition at line 786 of file qtextcursor.cpp.

References adjusted_anchor, anchor, QTextDocumentPrivate::beginEditBlock(), QTextFormat::clearProperty(), QTextTableCell::column(), QTextTableCell::columnSpan(), complexSelectionTable(), QTextDocumentPrivate::endEditBlock(), QTextTableCell::firstPosition(), QTextTableCell::lastPosition(), QTextFormat::ObjectIndex, position, priv, Q_ASSERT, QTextTableCell::row(), QTextTableCell::rowSpan(), selectedTableCells(), and QTextDocumentPrivate::setCharFormat().

Referenced by QTextCursor::mergeCharFormat(), and QTextCursor::setCharFormat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPosition()

bool QTextCursorPrivate::setPosition ( int newPosition)
inline

Definition at line 43 of file qtextcursor_p.h.

References position(), and Q_ASSERT.

Referenced by QTextCursor::insertTable(), QTextCursor::movePosition(), and QTextCursor::setPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setX()

void QTextCursorPrivate::setX ( )

Definition at line 96 of file qtextcursor.cpp.

References block(), blockLayout(), QTextDocumentPrivate::inContentsChange, QTextDocumentPrivate::isInEditBlock(), layout, line, pos, position, QTextBlock::position(), and priv.

Referenced by QTextCursor::QTextCursor(), QTextCursor::deleteChar(), QTextCursor::deletePreviousChar(), QWidgetTextControlPrivate::inputMethodEvent(), QTextCursor::insertBlock(), QTextCursor::insertFragment(), QTextCursor::insertText(), QWidgetTextControlPrivate::keyPressEvent(), movePosition(), QTextCursor::removeSelectedText(), and QTextCursor::setPosition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ adjusted_anchor

◆ anchor

◆ changed

uint QTextCursorPrivate::changed

Definition at line 85 of file qtextcursor_p.h.

Referenced by QTextCursorPrivate().

◆ currentCharFormat

◆ keepPositionOnInsert

uint QTextCursorPrivate::keepPositionOnInsert

◆ position

◆ priv

QTextDocumentPrivate* QTextCursorPrivate::priv

Definition at line 77 of file qtextcursor_p.h.

Referenced by QTextCopyHelper::QTextCopyHelper(), QTextCursorPrivate(), QTextCursorPrivate(), ~QTextCursorPrivate(), aboutToRemoveCell(), adjustCursor(), QTextCursor::anchor(), QTextCursor::atBlockEnd(), QTextCursor::atBlockStart(), QTextCursor::atEnd(), QTextCursor::atStart(), QTextCursor::beginEditBlock(), QTextCursor::block(), QTextCursor::blockCharFormat(), QTextCursor::blockFormat(), blockLayout(), QTextCursor::blockNumber(), canDelete(), QTextCursor::charFormat(), clearCells(), QTextCursor::columnNumber(), complexSelectionTable(), QTextCursor::createList(), QTextCursor::currentFrame(), QTextCursor::currentList(), QTextCursor::currentTable(), QTextCursor::deleteChar(), QTextCursor::deletePreviousChar(), QTextCursor::document(), QTextCursor::endEditBlock(), QTextCursor::insertBlock(), insertBlock(), QTextCursor::insertFragment(), QTextCursor::insertFrame(), QTextCursor::insertHtml(), QTextCursor::insertImage(), QTextCursor::insertImage(), QTextCursor::insertTable(), QTextCursor::insertText(), QTextCursor::isNull(), QTextCursor::joinPreviousEditBlock(), QTextCursor::mergeBlockCharFormat(), QTextCursor::mergeBlockFormat(), QTextCursor::mergeCharFormat(), QTextCursor::movePosition(), movePosition(), QTextCursor::operator<(), QTextCursor::operator<=(), QTextCursor::operator==(), QTextCursor::operator>(), QTextCursor::operator>=(), QTextCursor::position(), QTextCursor::positionInBlock(), remove(), QTextCursor::removeSelectedText(), QTextCursor::select(), selectedTableCells(), QTextCursor::selectedText(), QTextCursor::selectionEnd(), QTextCursor::selectionStart(), QTextCursor::setBlockCharFormat(), setBlockCharFormat(), QTextCursor::setBlockFormat(), setBlockFormat(), QTextCursor::setCharFormat(), setCharFormat(), QTextCursor::setPosition(), and setX().

◆ visualNavigation

uint QTextCursorPrivate::visualNavigation

◆ x

qreal QTextCursorPrivate::x

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