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
Utils::TextCursor Class Reference

#include <qtextcursor_p.h>

+ Collaboration diagram for Utils::TextCursor:

Public Types

enum  MoveOperation {
  NoMove , Start , PreviousCharacter , End ,
  NextCharacter
}
 
enum  MoveMode { MoveAnchor , KeepAnchor }
 
enum  SelectionType { Document }
 

Public Member Functions

 TextCursor ()
 
 TextCursor (const TextBlock &block)
 
 TextCursor (TextDocument *document)
 
bool movePosition (MoveOperation op, MoveMode=MoveAnchor, int n=1)
 
int position () const
 
void setPosition (int pos, MoveMode mode=MoveAnchor)
 
QString selectedText () const
 
void clearSelection ()
 
int anchor () const
 
TextDocumentdocument () const
 
void insertText (const QString &text)
 
TextBlock block () const
 
int positionInBlock () const
 
int blockNumber () const
 
void select (SelectionType selection)
 
bool hasSelection () const
 
void removeSelectedText ()
 
int selectionEnd () const
 
bool isNull () const
 

Detailed Description

Definition at line 25 of file qtextcursor_p.h.

Member Enumeration Documentation

◆ MoveMode

Enumerator
MoveAnchor 
KeepAnchor 

Definition at line 36 of file qtextcursor_p.h.

◆ MoveOperation

Enumerator
NoMove 
Start 
PreviousCharacter 
End 
NextCharacter 

Definition at line 28 of file qtextcursor_p.h.

◆ SelectionType

Enumerator
Document 

Definition at line 38 of file qtextcursor_p.h.

Constructor & Destructor Documentation

◆ TextCursor() [1/3]

Utils::TextCursor::TextCursor ( )

◆ TextCursor() [2/3]

Utils::TextCursor::TextCursor ( const TextBlock & block)

◆ TextCursor() [3/3]

Utils::TextCursor::TextCursor ( TextDocument * document)

Definition at line 14 of file qtextcursor.cpp.

Member Function Documentation

◆ anchor()

int Utils::TextCursor::anchor ( ) const

◆ block()

TextBlock Utils::TextCursor::block ( ) const

Definition at line 85 of file qtextcursor.cpp.

References Utils::TextDocument::firstBlock(), Utils::TextBlock::isValid(), Utils::TextBlock::length(), Utils::TextBlock::next(), Utils::TextBlock::position(), and position().

Referenced by blockNumber(), and positionInBlock().

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

◆ blockNumber()

int Utils::TextCursor::blockNumber ( ) const

Definition at line 102 of file qtextcursor.cpp.

References block(), and Utils::TextBlock::blockNumber().

+ Here is the call graph for this function:

◆ clearSelection()

void Utils::TextCursor::clearSelection ( )

Definition at line 67 of file qtextcursor.cpp.

◆ document()

TextDocument * Utils::TextCursor::document ( ) const

Definition at line 72 of file qtextcursor.cpp.

◆ hasSelection()

bool Utils::TextCursor::hasSelection ( ) const

◆ insertText()

void Utils::TextCursor::insertText ( const QString & text)

Definition at line 77 of file qtextcursor.cpp.

References QString::left(), QString::mid(), qMax(), qMin(), Utils::TextDocument::setPlainText(), text, and Utils::TextDocument::toPlainText().

Referenced by removeSelectedText().

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

◆ isNull()

bool Utils::TextCursor::isNull ( ) const

Definition at line 117 of file qtextcursor.cpp.

◆ movePosition()

bool Utils::TextCursor::movePosition ( TextCursor::MoveOperation op,
TextCursor::MoveMode mode = MoveAnchor,
int n = 1 )

Definition at line 16 of file qtextcursor.cpp.

References Utils::TextDocument::characterCount(), End, MoveAnchor, NextCharacter, NoMove, PreviousCharacter, Q_UNUSED, and Start.

+ Here is the call graph for this function:

◆ position()

int Utils::TextCursor::position ( ) const

Definition at line 50 of file qtextcursor.cpp.

Referenced by block().

+ Here is the caller graph for this function:

◆ positionInBlock()

int Utils::TextCursor::positionInBlock ( ) const

Definition at line 97 of file qtextcursor.cpp.

References block(), and Utils::TextBlock::position().

+ Here is the call graph for this function:

◆ removeSelectedText()

void Utils::TextCursor::removeSelectedText ( )

Definition at line 107 of file qtextcursor.cpp.

References insertText().

+ Here is the call graph for this function:

◆ select()

void Utils::TextCursor::select ( SelectionType selection)

◆ selectedText()

QString Utils::TextCursor::selectedText ( ) const

Definition at line 62 of file qtextcursor.cpp.

References QString::mid(), qAbs(), qMin(), and Utils::TextDocument::toPlainText().

+ Here is the call graph for this function:

◆ selectionEnd()

int Utils::TextCursor::selectionEnd ( ) const

Definition at line 112 of file qtextcursor.cpp.

References qMax().

+ Here is the call graph for this function:

◆ setPosition()

void Utils::TextCursor::setPosition ( int pos,
MoveMode mode = MoveAnchor )

Definition at line 55 of file qtextcursor.cpp.

References MoveAnchor, and pos.


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