![]() |
Qt 6.x
The Qt SDK
|
#include <qtextcursor_p.h>
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 |
TextDocument * | document () 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 |
Definition at line 25 of file qtextcursor_p.h.
Enumerator | |
---|---|
MoveAnchor | |
KeepAnchor |
Definition at line 36 of file qtextcursor_p.h.
Enumerator | |
---|---|
NoMove | |
Start | |
PreviousCharacter | |
End | |
NextCharacter |
Definition at line 28 of file qtextcursor_p.h.
Enumerator | |
---|---|
Document |
Definition at line 38 of file qtextcursor_p.h.
Utils::TextCursor::TextCursor | ( | ) |
Utils::TextCursor::TextCursor | ( | const TextBlock & | block | ) |
Utils::TextCursor::TextCursor | ( | TextDocument * | document | ) |
Definition at line 14 of file qtextcursor.cpp.
int Utils::TextCursor::anchor | ( | ) | const |
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().
int Utils::TextCursor::blockNumber | ( | ) | const |
Definition at line 102 of file qtextcursor.cpp.
References block(), and Utils::TextBlock::blockNumber().
void Utils::TextCursor::clearSelection | ( | ) |
Definition at line 67 of file qtextcursor.cpp.
TextDocument * Utils::TextCursor::document | ( | ) | const |
Definition at line 72 of file qtextcursor.cpp.
bool Utils::TextCursor::hasSelection | ( | ) | const |
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().
bool Utils::TextCursor::isNull | ( | ) | const |
Definition at line 117 of file qtextcursor.cpp.
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.
int Utils::TextCursor::position | ( | ) | const |
Definition at line 50 of file qtextcursor.cpp.
Referenced by block().
int Utils::TextCursor::positionInBlock | ( | ) | const |
Definition at line 97 of file qtextcursor.cpp.
References block(), and Utils::TextBlock::position().
void Utils::TextCursor::removeSelectedText | ( | ) |
Definition at line 107 of file qtextcursor.cpp.
References insertText().
void Utils::TextCursor::select | ( | SelectionType | selection | ) |
QString Utils::TextCursor::selectedText | ( | ) | const |
Definition at line 62 of file qtextcursor.cpp.
References QString::mid(), qAbs(), qMin(), and Utils::TextDocument::toPlainText().
int Utils::TextCursor::selectionEnd | ( | ) | const |
Definition at line 112 of file qtextcursor.cpp.
References qMax().
void Utils::TextCursor::setPosition | ( | int | pos, |
MoveMode | mode = MoveAnchor |
||
) |
Definition at line 55 of file qtextcursor.cpp.
References MoveAnchor, and pos.