The QTextCursor 類提供訪問和修改 QTextDocument 的 API。 更多...
| 頭: | #include <QTextCursor> |
| qmake: | QT += gui |
注意: 此類的所有函數 可重入 .
| enum | MoveMode { MoveAnchor, KeepAnchor } |
| enum | MoveOperation { NoMove, Start, StartOfLine, StartOfBlock, ..., PreviousRow } |
| enum | SelectionType { Document, BlockUnderCursor, LineUnderCursor, WordUnderCursor } |
| QTextCursor () | |
| QTextCursor (QTextDocument * document ) | |
| QTextCursor (QTextFrame * frame ) | |
| QTextCursor (const QTextBlock & block ) | |
| QTextCursor (const QTextCursor & cursor ) | |
| ~QTextCursor () | |
| int | anchor () const |
| bool | atBlockEnd () const |
| bool | atBlockStart () const |
| bool | atEnd () const |
| bool | atStart () const |
| void | beginEditBlock () |
| QTextBlock | block () const |
| QTextCharFormat | blockCharFormat () const |
| QTextBlockFormat | blockFormat () const |
| int | blockNumber () const |
| QTextCharFormat | charFormat () const |
| void | clearSelection () |
| int | columnNumber () const |
| QTextList * | createList (const QTextListFormat & format ) |
| QTextList * | createList (QTextListFormat::Style style ) |
| QTextFrame * | currentFrame () const |
| QTextList * | currentList () const |
| QTextTable * | currentTable () const |
| void | deleteChar () |
| void | deletePreviousChar () |
| QTextDocument * | document () const |
| void | endEditBlock () |
| bool | hasComplexSelection () const |
| bool | hasSelection () const |
| void | insertBlock () |
| void | insertBlock (const QTextBlockFormat & format ) |
| void | insertBlock (const QTextBlockFormat & format , const QTextCharFormat & charFormat ) |
| void | insertFragment (const QTextDocumentFragment & fragment ) |
| QTextFrame * | insertFrame (const QTextFrameFormat & format ) |
| void | insertHtml (const QString & html ) |
| void | insertImage (const QTextImageFormat & format ) |
| void | insertImage (const QTextImageFormat & format , QTextFrameFormat::Position alignment ) |
| void | insertImage (const QString & name ) |
| void | insertImage (const QImage & image , const QString & name = QString()) |
| QTextList * | insertList (const QTextListFormat & format ) |
| QTextList * | insertList (QTextListFormat::Style style ) |
| QTextTable * | insertTable (int rows , int columns , const QTextTableFormat & format ) |
| QTextTable * | insertTable (int rows , int columns ) |
| void | insertText (const QString & text ) |
| void | insertText (const QString & text , const QTextCharFormat & format ) |
| bool | isCopyOf (const QTextCursor & other ) const |
| bool | isNull () const |
| void | joinPreviousEditBlock () |
| bool | keepPositionOnInsert () const |
| void | mergeBlockCharFormat (const QTextCharFormat & modifier ) |
| void | mergeBlockFormat (const QTextBlockFormat & modifier ) |
| void | mergeCharFormat (const QTextCharFormat & modifier ) |
| bool | movePosition (QTextCursor::MoveOperation operation , QTextCursor::MoveMode mode = MoveAnchor, int n = 1) |
| int | position () const |
| int | positionInBlock () const |
| void | removeSelectedText () |
| void | select (QTextCursor::SelectionType selection ) |
| void | selectedTableCells (int * firstRow , int * numRows , int * firstColumn , int * numColumns ) const |
| QString | selectedText () const |
| QTextDocumentFragment | selection () const |
| int | selectionEnd () const |
| int | selectionStart () const |
| void | setBlockCharFormat (const QTextCharFormat & format ) |
| void | setBlockFormat (const QTextBlockFormat & format ) |
| void | setCharFormat (const QTextCharFormat & format ) |
| void | setKeepPositionOnInsert (bool b ) |
| void | setPosition (int pos , QTextCursor::MoveMode m = MoveAnchor) |
| void | setVerticalMovementX (int x ) |
| void | setVisualNavigation (bool b ) |
| void | swap (QTextCursor & other ) |
| int | verticalMovementX () const |
| bool | visualNavigation () const |
| bool | operator!= (const QTextCursor & other ) const |
| bool | operator< (const QTextCursor & other ) const |
| bool | operator<= (const QTextCursor & other ) const |
| QTextCursor & | operator= (QTextCursor && other ) |
| QTextCursor & | operator= (const QTextCursor & cursor ) |
| bool | operator== (const QTextCursor & other ) const |
| bool | operator> (const QTextCursor & other ) const |
| bool | operator>= (const QTextCursor & other ) const |
The QTextCursor 類提供訪問和修改 QTextDocument 的 API。
文本光標是用於訪問和修改文本文檔內容和底層結構的對象,憑藉模仿文本編輯器光標行為的編程接口。 QTextCursor 包含的信息有關光標位置在 QTextDocument 和它所做的任何選擇。
QTextCursor is modeled on the way a text cursor behaves in a text editor, providing a programmatic means of performing standard actions through the user interface. A document can be thought of as a single string of characters. The cursor's current position () 則始終要麼 between 2 連續字符在字符串中,要麼否則 before 恰好第一字符或 after the very last character in the string. Documents can also contain tables, lists, images, and other objects in addition to text but, from the developer's point of view, the document can be treated as one long string. Some portions of that string can be considered to lie within particular blocks (e.g. paragraphs), or within a table's cell, or a list's item, or other structural elements. When we refer to "current character" we mean the character immediately before the cursor position () in the document. Similarly, the "current block" is the block that contains the cursor position ().
A QTextCursor also has an anchor () 位置。文本介於 anchor () 和 position () 是選定。若 anchor () == position (),沒有選定。
可以按編程方式改變光標位置使用 setPosition () 和 movePosition ();後者還可用於選定文本。對於選定見 selectionStart (), selectionEnd (), hasSelection (), clearSelection (),和 removeSelectedText ().
若
position
() 位於塊開頭,
atBlockStart
() 返迴
true
;和若它位於塊末尾,
atBlockEnd
() 返迴 true。當前字符格式的返迴通過
charFormat
(),和當前塊格式的返迴通過
blockFormat
().
可以將格式化應用到當前文本文檔使用 setCharFormat (), mergeCharFormat (), setBlockFormat () 和 mergeBlockFormat () functions. The 'set' functions will replace the cursor's current character or block format, while the 'merge' functions add the given format properties to the cursor's current format. If the cursor has a selection, the given format is applied to the current selection. Note that when only a part of a block is selected, the block format is applied to the entire block. The text at the current character position can be turned into a list using createList ().
刪除可以達成使用 deleteChar (), deletePreviousChar (),和 removeSelectedText ().
Text strings can be inserted into the document with the insertText () function, blocks (representing new paragraphs) can be inserted with insertBlock ().
Existing fragments of text can be inserted with insertFragment () but, if you want to insert pieces of text in various formats, it is usually still easier to use insertText () and supply a character format.
Various types of higher-level structure can also be inserted into the document with the cursor:
Actions can be grouped (i.e. treated as a single action for undo/redo) using beginEditBlock () 和 endEditBlock ().
Cursor movements are limited to valid cursor positions. In Latin writing this is between any two consecutive characters in the text, before the first character, or after the last character. In some other writing systems cursor movements are limited to "clusters" (e.g. a syllable in Devanagari, or a base letter plus diacritics). Functions such as movePosition () 和 deleteChar () limit cursor movement to these valid positions.
另請參閱 富文本處理 .
| 常量 | 值 | 描述 |
|---|---|---|
QTextCursor::MoveAnchor
|
0
|
將錨點移到如光標自身的相同位置。 |
QTextCursor::KeepAnchor
|
1
|
保持錨點位置。 |
若 anchor () 保持位置且 position () 被移動,會選中之間文本。
| 常量 | 值 | 描述 |
|---|---|---|
QTextCursor::NoMove
|
0
|
保持光標位置 |
QTextCursor::Start
|
1
|
移至文檔開頭。 |
QTextCursor::StartOfLine
|
3
|
移至當前行首。 |
QTextCursor::StartOfBlock
|
4
|
移至當前塊開頭。 |
QTextCursor::StartOfWord
|
5
|
移至當前單詞開頭。 |
QTextCursor::PreviousBlock
|
6
|
移至先前塊開頭。 |
QTextCursor::PreviousCharacter
|
7
|
移至上一字符。 |
QTextCursor::PreviousWord
|
8
|
移至先前單詞開頭。 |
QTextCursor::Up
|
2
|
上移一行。 |
QTextCursor::Left
|
9
|
左移一字符。 |
QTextCursor::WordLeft
|
10
|
左移一單詞。 |
QTextCursor::End
|
11
|
移至文檔末尾。 |
QTextCursor::EndOfLine
|
13
|
移至當前行末尾。 |
QTextCursor::EndOfWord
|
14
|
移至當前單詞末尾。 |
QTextCursor::EndOfBlock
|
15
|
移至當前塊末尾。 |
QTextCursor::NextBlock
|
16
|
移至下一塊起始。 |
QTextCursor::NextCharacter
|
17
|
移至下一字符。 |
QTextCursor::NextWord
|
18
|
移至下一單詞。 |
QTextCursor::Down
|
12
|
下移一行。 |
QTextCursor::Right
|
19
|
右移一字符。 |
QTextCursor::WordRight
|
20
|
右移一單詞。 |
QTextCursor::NextCell
|
21
|
移到當前錶格下一錶格單元格的起始。若當前單元格是行的最後單元格,則光標移到下一行的第一單元格。 |
QTextCursor::PreviousCell
|
22
|
移到當前錶格上一錶格單元格的起始。若當前單元格是行的第一單元格,則光標將移到上一行的最後單元格。 |
QTextCursor::NextRow
|
23
|
移到當前錶格下一行的第一新單元格。 |
QTextCursor::PreviousRow
|
24
|
移到當前錶格上一行的最後單元格。 |
另請參閱 movePosition ().
此枚舉描述的選定類型可應用於 select () 函數。
| 常量 | 值 | 描述 |
|---|---|---|
QTextCursor::Document
|
3
|
選擇整個文檔。 |
QTextCursor::BlockUnderCursor
|
2
|
選擇光標下的文本塊。 |
QTextCursor::LineUnderCursor
|
1
|
選擇光標下的文本行。 |
QTextCursor::WordUnderCursor
|
0
|
選擇光標下的單詞。若光標不在可選字符的字符串內,則不選擇文本。 |
構造 null 光標。
構造指嚮起始的光標為 document .
構造指嚮起始的光標為 frame .
構造指嚮起始的光標為 block .
構造新副本光標為 cursor .
銷毀 QTextCursor .
返迴錨點位置;這如同 position () 除非存在選取,在這種情況下 position () 標記選擇的一端而 anchor() 標記另一端。就像光標位置,錨點位置也在字符之間。
另請參閱 position (), setPosition (), movePosition (), selectionStart (),和 selectionEnd ().
返迴
true
若光標在塊末尾;否則返迴
false
.
另請參閱 atBlockStart () 和 atEnd ().
返迴
true
若光標在塊開頭;否則返迴
false
.
另請參閱 atBlockEnd () 和 atStart ().
返迴
true
若光標在文檔末尾;否則返迴
false
.
該函數在 Qt 4.6 引入。
另請參閱 atStart () 和 atBlockEnd ().
返迴
true
若光標在文檔開頭;否則返迴
false
.
另請參閱 atBlockStart () 和 atEnd ().
開始在文檔中編輯操作塊的指示,這應該作為單一操作齣現 (從撤銷/重做角度來看)。
例如:
QTextCursor cursor(textDocument); cursor.beginEditBlock(); cursor.insertText("Hello"); cursor.insertText("World"); cursor.endEditBlock(); textDocument->undo();
調用 undo() 將導緻 2 插入被撤消,導緻 World 和 Hello 兩者被移除。
可以嵌套調用 beginEditBlock 和 endEditBlock 。最上麵的一對將確定撤消/重做操作的作用域。
另請參閱 endEditBlock ().
返迴包含光標的塊。
返迴光標所在塊的塊字符格式。
塊字符格式是所用格式,當在空塊開頭插入文本時。
另請參閱 setBlockCharFormat ().
返迴光標所在塊的塊格式。
另請參閱 setBlockFormat () 和 charFormat ().
返迴光標所在塊的編號,或 0 若光標無效。
注意:此函數在文檔中纔有意義,沒有復雜對象 (譬如:錶格或框架)。
該函數在 Qt 4.2 引入。
立即返迴光標之前的字符格式,在 position ()。若光標位於非空文本塊的開頭,則立即返迴光標之後的字符格式。
另請參閱 setCharFormat (), insertText (),和 blockFormat ().
清零當前選定,通過把錨點設置到光標位置。
注意,它 not 刪除選定文本。
另請參閱 removeSelectedText () 和 hasSelection ().
返迴在其包含行內的光標位置。
注意:這是相對於換行而不是相對於塊 (即:段落) 的列號。
可能想要調用 positionInBlock () 代替。
該函數在 Qt 4.2 引入。
另請參閱 positionInBlock ().
創建並返迴新列錶采用給定 format ,並使當前段落光標位於第一列錶項。
另請參閱 insertList () 和 currentList ().
這是重載函數。
創建並返迴新列錶采用給定 style ,使光標的當前段落成為第一列錶項。
定義要使用樣式通過 QTextListFormat::Style 枚舉。
另請參閱 insertList () 和 currentList ().
返迴當前框架指針。返迴
nullptr
若光標無效。
另請參閱 insertFrame ().
返迴當前列錶若光標
position
() 在屬於列錶的塊內;否則返迴
nullptr
.
另請參閱 insertList () 和 createList ().
返迴當前錶格指針若光標
position
() 在屬於錶格的塊內;否則返迴
nullptr
.
另請參閱 insertTable ().
若沒有選中文本,刪除字符 at 當前光標位置;否則刪除選中文本。
另請參閱 deletePreviousChar (), hasSelection (),和 clearSelection ().
若沒有選中文本,刪除字符 before 當前光標位置;否則刪除選中文本。
另請參閱 deleteChar (), hasSelection (),和 clearSelection ().
返迴此光標關聯的文檔。
該函數在 Qt 4.5 引入。
指示應齣現作為單操作的文檔塊編輯操作結束,從撤消/重做角度來看。
另請參閱 beginEditBlock ().
返迴
true
若光標包含的選定範圍不隻是從
selectionStart
() 到
selectionEnd
();否則返迴
false
.
復雜選定是至少跨 2 錶格單元格的選定;它們範圍的指定是通過 selectedTableCells ().
返迴
true
光標包含選定;否則返迴
false
.
插入新的空塊在光標 position () 采用當前 blockFormat () 和 charFormat ().
另請參閱 setBlockFormat ().
這是重載函數。
插入新的空塊在光標 position () 采用塊格式 format 和當前 charFormat () 作為塊字符格式。
另請參閱 setBlockFormat ().
這是重載函數。
插入新的空塊在光標 position () 采用塊格式 format and charFormat 作為塊字符格式。
另請參閱 setBlockFormat ().
插入文本 fragment 在當前 position ().
插入框架采用給定 format 在當前光標 position (),移動光標 position () 在框架內,並返迴框架。
若光標保有選定,整個選定被移入框架。
另請參閱 hasSelection ().
插入文本 html 在當前 position ()。文本被解釋成 HTML。
注意: 當采用樣式錶使用此函數時,樣式錶將僅應用於文檔當前塊。為整個文檔應用樣式錶,使用 QTextDocument::setDefaultStyleSheet () 代替。
該函數在 Qt 4.2 引入。
插入圖像定義通過 format 在當前 position ().
這是重載函數。
插入圖像定義通過給定 format 在光標的當前位置采用指定 alignment .
該函數在 Qt 4.2 引入。
另請參閱 position ().
這是重載函數。
用於插入圖像的方便方法采用給定 name 在當前 position ().
QImage img = ... textDocument->addResource(QTextDocument::ImageResource, QUrl("myimage"), img); cursor.insertImage("myimage");
這是重載函數。
方便函數用於插入給定 image 采用可選 name 在當前 position ().
該函數在 Qt 4.5 引入。
Inserts a new block at the current position and makes it the first list item of a newly created list with the given format 。返迴創建列錶。
另請參閱 currentList (), createList (),和 insertBlock ().
這是重載函數。
Inserts a new block at the current position and makes it the first list item of a newly created list with the given style 。返迴創建列錶。
另請參閱 currentList (), createList (),和 insertBlock ().
創建新的錶格采用給定數量的 rows and columns 以指定 format ,將它插入在當前光標 position () 在文檔,並返迴錶格對象。移動光標到第一單元格開頭。
錶格必須至少存在一行一列。
另請參閱 currentTable ().
這是重載函數。
創建新的錶格采用給定數量的 rows and columns ,將它插入在當前光標 position () 在文檔,並返迴錶格對象。移動光標到第一單元格開頭。
錶格必須至少存在一行一列。
另請參閱 currentTable ().
插入 text 在當前位置,使用當前字符格式。
若存在選定,刪除選定並替換以 text ,例如:
cursor.clearSelection(); cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); cursor.insertText("Hello World");
這會清零任何現有選定,選擇光標處單詞 (即:從 position () 起嚮前),並以短語 Hello World 替換選定。
插入文本中的任何 ASCII 換行符 \n 會被變換成 Unicode 塊分隔符,對應 insertBlock () 調用。
另請參閱 charFormat () 和 hasSelection ().
這是重載函數。
插入 text 在當前位置采用給定 format .
返迴
true
若此光標和
other
是彼此的副本 (即:它們中之一是作為另一的副本創建的,且從那之後兩者未移動)。這比相等嚴格得多。
另請參閱 operator= () 和 operator== ().
返迴
true
若光標為 null;否則返迴
false
。null 光標被創建通過默認構造函數。
像 beginEditBlock () indicates the start of a block of editing operations that should appear as a single operation for undo/redo. However unlike beginEditBlock () it does not start a new block but reverses the previous call to endEditBlock () and therefore makes following operations part of the previous edit block created.
例如:
QTextCursor cursor(textDocument); cursor.beginEditBlock(); cursor.insertText("Hello"); cursor.insertText("World"); cursor.endEditBlock(); ... cursor.joinPreviousEditBlock(); cursor.insertText("Hey"); cursor.endEditBlock(); textDocument->undo();
調用 undo() 將導緻所有 3 插入被撤消。
另請參閱 beginEditBlock () 和 endEditBlock ().
返迴是否應該保持光標在當前位置,當將文本插入在光標位置處時。
默認為 false;
該函數在 Qt 4.7 引入。
另請參閱 setKeepPositionOnInsert ().
Modifies the block char format of the current block (or all blocks that are contained in the selection) with the block format specified by modifier .
另請參閱 setBlockCharFormat ().
Modifies the block format of the current block (or all blocks that are contained in the selection) with the block format specified by modifier .
另請參閱 setBlockFormat () 和 blockFormat ().
閤並光標的當前字符格式與特性描述通過格式 modifier 。若光標擁有選定,此函數將應用所有特性設置按 modifier 到選定部分的所有字符格式。
另請參閱 hasSelection () 和 setCharFormat ().
移動光標通過履行給定
operation
n
次,使用指定
mode
,並返迴
true
若所有操作均成功完成;否則返迴
false
.
例如:若重復使用此函數以尋址下一單詞的末尾,它最終將失敗,當到達文檔末尾時。
默認情況下,移動操作被履行一次 ( n = 1).
若
mode
is
KeepAnchor
,光標選擇由它移動覆蓋的文本。這與用戶達成的效果相同,當按下 Shift 鍵和采用光標鍵移動光標時。
另請參閱 setVisualNavigation ().
返迴光標在文檔中的絕對位置。光標位於字符之間。
注意: 在這種情況下,Characters 是指字符串對於 QChar 對象 (即:16 位 Unicode 字符),且位置被視為是此字符串的索引。這不必對應書寫係統中的各個字形,因為單個字形可能由多個 Unicode 字符 (譬如:代理對、語言連字或音調符號) 錶示。
另請參閱 setPosition (), movePosition (), anchor (),和 positionInBlock ().
返迴塊內光標的相對位置。光標位於字符之間。
這相當於
position() - block().position()
.
注意: 在這種情況下,Characters 是指字符串對於 QChar 對象 (即:16 位 Unicode 字符),且位置被視為是此字符串的索引。這不必對應書寫係統中的各個字形,因為單個字形可能由多個 Unicode 字符 (譬如:代理對、語言連字或音調符號) 錶示。
該函數在 Qt 4.7 引入。
另請參閱 position ().
若存在選定,其內容被刪除;否則什麼都不做。
另請參閱 hasSelection ().
選擇文檔文本,根據給定 selection .
若選擇跨越錶格單元格, firstRow 是第一選定行的填充編號, firstColumn 是第一選定列的編號,而 numRows and numColumns 是選定行數和列數。若選定未跨越任何錶格單元格,則結果是無害的但不確定。
返迴當前選定文本 (可能為空)。這僅返迴文本,沒有富文本格式化信息。若想要文檔片段 (即:格式化的富文本),使用 selection () 代替。
注意:
若從編輯器獲得的選定跨越換行符,文本將包含 Unicode U+2029 段落分隔符,而不是換行
\n
字符。使用
QString::replace
() 以采用換行符替換這些字符。
返迴當前選定 (可能為空) 自帶其所有格式信息。若僅僅希望選擇文本 (即:純文本),使用 selectedText () 代替。
注意: 不像 QTextDocumentFragment::toPlainText (), selectedText () 可能包括特殊 Unicode 字符,譬如 QChar::ParagraphSeparator .
另請參閱 QTextDocumentFragment::toPlainText ().
返迴選定的結束,或 position () 若光標沒有選定。
另請參閱 selectionStart (), position (),和 anchor ().
返迴選定的起始,或 position () 若光標沒有選定。
另請參閱 selectionEnd (), position (),和 anchor ().
將當前塊 (或選定包含的所有塊) 的塊字符格式設為 format .
另請參閱 blockCharFormat ().
將當前塊 (或選定包含的所有塊) 的塊格式設為 format .
另請參閱 blockFormat () 和 mergeBlockFormat ().
把光標當前字符格式設為給定 format 。若光標擁有選定,給定 format 將應用於當前選定。
另請參閱 charFormat (), hasSelection (),和 mergeCharFormat ().
Defines whether the cursor should keep its current position when text gets inserted at the current position of the cursor.
若 b is true, the cursor keeps its current position when text gets inserted at the positing of the cursor. If b is false, the cursor moves along with the inserted text.
默認為 false。
Note that a cursor always moves when text is inserted before the current position of the cursor, and it always keeps its position when text is inserted after the current position of the cursor.
該函數在 Qt 4.7 引入。
另請參閱 keepPositionOnInsert ().
移動光標到文檔絕對位置,指定通過
pos
使用
MoveMode
指定通過
m
。光標位於字符之間。
注意: 在這種情況下,Characters 是指字符串對於 QChar 對象 (即:16 位 Unicode 字符),和 pos 被視為是此字符串的索引。這不必對應書寫係統中的各個字形,因為單個字形可能由多個 Unicode 字符 (譬如:代理對、語言連字或音調符號) 錶示。導航文檔的更一般方式,是使用 movePosition (),將遵守文本的實際字形邊界。
另請參閱 position (), movePosition (),和 anchor ().
將垂直移動光標的視覺 X 位置設為 x .
The vertical movement x position is cleared automatically when the cursor moves horizontally, and kept unchanged when the cursor moves vertically. The mechanism allows the cursor to move up and down on a visually straight line with proportional fonts, and to gently "jump" over short lines.
A value of -1 indicates no predefined x position. It will then be set automatically the next time the cursor moves up or down.
該函數在 Qt 4.7 引入。
另請參閱 verticalMovementX ().
把視覺導航設為 b .
視覺導航意味著跳過隱藏文本段落。默認為 false。
該函數在 Qt 4.4 引入。
另請參閱 visualNavigation () 和 movePosition ().
交換此文本光標實例與 other 。此函數非常快且從不失敗。
該函數在 Qt 5.0 引入。
返迴垂直移動光標的視覺 X 位置。
A value of -1 indicates no predefined x position. It will then be set automatically the next time the cursor moves up or down.
該函數在 Qt 4.7 引入。
另請參閱 setVerticalMovementX ().
返迴
true
若光標做視覺導航;否則返迴
false
.
視覺導航意味著跳過隱藏文本段落。默認為 false。
該函數在 Qt 4.4 引入。
另請參閱 setVisualNavigation () 和 movePosition ().
返迴
true
若
other
cursor is at a different position in the document as this cursor; otherwise returns
false
.
返迴
true
若
other
cursor is positioned later in the document than this cursor; otherwise returns
false
.
返迴
true
若
other
cursor is positioned later or at the same position in the document as this cursor; otherwise returns false.
移動賦值運算符。
製作副本為 cursor 並將其賦值給此 QTextCursor 。注意, QTextCursor 是 隱式共享 類。
返迴
true
若
other
光標如此光標在文檔中的位置相同; 否則返迴
false
.
返迴
true
若
other
cursor is positioned earlier in the document than this cursor; otherwise returns
false
.
返迴
true
若
other
cursor is positioned earlier or at the same position in the document as this cursor; otherwise returns false.