1// qtextcursor.sip generated by MetaSIP 2// 3// This file is part of the QtGui Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 8// 9// This file may be used under the terms of the GNU General Public License 10// version 3.0 as published by the Free Software Foundation and appearing in 11// the file LICENSE included in the packaging of this file. Please review the 12// following information to ensure the GNU General Public License version 3.0 13// requirements will be met: http://www.gnu.org/copyleft/gpl.html. 14// 15// If you do not wish to use this file under the terms of the GPL version 3.0 16// then you may purchase a commercial license. For more information contact 17// info@riverbankcomputing.com. 18// 19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 22 23class QTextCursor 24{ 25%TypeHeaderCode 26#include <qtextcursor.h> 27%End 28 29public: 30 QTextCursor(); 31 explicit QTextCursor(QTextDocument *document); 32 explicit QTextCursor(QTextFrame *frame); 33 explicit QTextCursor(const QTextBlock &block); 34 QTextCursor(const QTextCursor &cursor); 35 ~QTextCursor(); 36 bool isNull() const; 37 38 enum MoveMode 39 { 40 MoveAnchor, 41 KeepAnchor, 42 }; 43 44 void setPosition(int pos, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); 45 int position() const; 46 int anchor() const; 47 void insertText(const QString &text); 48 void insertText(const QString &text, const QTextCharFormat &format); 49 50 enum MoveOperation 51 { 52 NoMove, 53 Start, 54 Up, 55 StartOfLine, 56 StartOfBlock, 57 StartOfWord, 58 PreviousBlock, 59 PreviousCharacter, 60 PreviousWord, 61 Left, 62 WordLeft, 63 End, 64 Down, 65 EndOfLine, 66 EndOfWord, 67 EndOfBlock, 68 NextBlock, 69 NextCharacter, 70 NextWord, 71 Right, 72 WordRight, 73 NextCell, 74 PreviousCell, 75 NextRow, 76 PreviousRow, 77 }; 78 79 bool movePosition(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor, int n = 1); 80 void deleteChar(); 81 void deletePreviousChar(); 82 83 enum SelectionType 84 { 85 WordUnderCursor, 86 LineUnderCursor, 87 BlockUnderCursor, 88 Document, 89 }; 90 91 void select(QTextCursor::SelectionType selection); 92 bool hasSelection() const; 93 bool hasComplexSelection() const; 94 void removeSelectedText(); 95 void clearSelection(); 96 int selectionStart() const; 97 int selectionEnd() const; 98 QString selectedText() const; 99 QTextDocumentFragment selection() const; 100 void selectedTableCells(int *firstRow, int *numRows, int *firstColumn, int *numColumns) const; 101 QTextBlock block() const; 102 QTextCharFormat charFormat() const; 103 void setCharFormat(const QTextCharFormat &format); 104 void mergeCharFormat(const QTextCharFormat &modifier); 105 QTextBlockFormat blockFormat() const; 106 void setBlockFormat(const QTextBlockFormat &format); 107 void mergeBlockFormat(const QTextBlockFormat &modifier); 108 QTextCharFormat blockCharFormat() const; 109 void setBlockCharFormat(const QTextCharFormat &format); 110 void mergeBlockCharFormat(const QTextCharFormat &modifier); 111 bool atBlockStart() const; 112 bool atBlockEnd() const; 113 bool atStart() const; 114 bool atEnd() const; 115 void insertBlock(); 116 void insertBlock(const QTextBlockFormat &format); 117 void insertBlock(const QTextBlockFormat &format, const QTextCharFormat &charFormat); 118 QTextList *insertList(const QTextListFormat &format); 119 QTextList *insertList(QTextListFormat::Style style); 120 QTextList *createList(const QTextListFormat &format); 121 QTextList *createList(QTextListFormat::Style style); 122 QTextList *currentList() const; 123 QTextTable *insertTable(int rows, int cols, const QTextTableFormat &format); 124 QTextTable *insertTable(int rows, int cols); 125 QTextTable *currentTable() const; 126 QTextFrame *insertFrame(const QTextFrameFormat &format); 127 QTextFrame *currentFrame() const; 128 void insertFragment(const QTextDocumentFragment &fragment); 129 void insertHtml(const QString &html); 130 void insertImage(const QTextImageFormat &format); 131 void insertImage(const QTextImageFormat &format, QTextFrameFormat::Position alignment); 132 void insertImage(const QString &name); 133 void insertImage(const QImage &image, const QString &name = QString()); 134 void beginEditBlock(); 135 void joinPreviousEditBlock(); 136 void endEditBlock(); 137 int blockNumber() const; 138 int columnNumber() const; 139 bool operator!=(const QTextCursor &rhs) const; 140 bool operator<(const QTextCursor &rhs) const; 141 bool operator<=(const QTextCursor &rhs) const; 142 bool operator==(const QTextCursor &rhs) const; 143 bool operator>=(const QTextCursor &rhs) const; 144 bool operator>(const QTextCursor &rhs) const; 145 bool isCopyOf(const QTextCursor &other) const; 146 bool visualNavigation() const; 147 void setVisualNavigation(bool b); 148 QTextDocument *document() const; 149 int positionInBlock() const; 150 void setVerticalMovementX(int x); 151 int verticalMovementX() const; 152 void setKeepPositionOnInsert(bool b); 153 bool keepPositionOnInsert() const; 154 void swap(QTextCursor &other /Constrained/); 155}; 156