Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtGui/qtextcursor.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QTEXTCURSOR_H
0005 #define QTEXTCURSOR_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qstring.h>
0009 #include <QtCore/qshareddata.h>
0010 #include <QtGui/qtextdocument.h>
0011 #include <QtGui/qtextformat.h>
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QTextCursorPrivate;
0016 class QTextDocumentFragment;
0017 class QTextCharFormat;
0018 class QTextBlockFormat;
0019 class QTextListFormat;
0020 class QTextTableFormat;
0021 class QTextFrameFormat;
0022 class QTextImageFormat;
0023 class QTextDocumentPrivate;
0024 class QTextList;
0025 class QTextTable;
0026 class QTextFrame;
0027 class QTextBlock;
0028 
0029 class Q_GUI_EXPORT QTextCursor
0030 {
0031 public:
0032     QTextCursor();
0033     explicit QTextCursor(QTextDocument *document);
0034     QTextCursor(QTextDocumentPrivate *p, int pos);
0035     explicit QTextCursor(QTextCursorPrivate *d);
0036     explicit QTextCursor(QTextFrame *frame);
0037     explicit QTextCursor(const QTextBlock &block);
0038     QTextCursor(const QTextCursor &cursor);
0039     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QTextCursor)
0040     QTextCursor &operator=(const QTextCursor &other);
0041     ~QTextCursor();
0042 
0043     void swap(QTextCursor &other) noexcept { d.swap(other.d); }
0044 
0045     bool isNull() const;
0046 
0047     enum MoveMode {
0048         MoveAnchor,
0049         KeepAnchor
0050     };
0051 
0052     void setPosition(int pos, MoveMode mode = MoveAnchor);
0053     int position() const;
0054     int positionInBlock() const;
0055 
0056     int anchor() const;
0057 
0058     void insertText(const QString &text);
0059     void insertText(const QString &text, const QTextCharFormat &format);
0060 
0061     enum MoveOperation {
0062         NoMove,
0063 
0064         Start,
0065         Up,
0066         StartOfLine,
0067         StartOfBlock,
0068         StartOfWord,
0069         PreviousBlock,
0070         PreviousCharacter,
0071         PreviousWord,
0072         Left,
0073         WordLeft,
0074 
0075         End,
0076         Down,
0077         EndOfLine,
0078         EndOfWord,
0079         EndOfBlock,
0080         NextBlock,
0081         NextCharacter,
0082         NextWord,
0083         Right,
0084         WordRight,
0085 
0086         NextCell,
0087         PreviousCell,
0088         NextRow,
0089         PreviousRow
0090     };
0091 
0092     bool movePosition(MoveOperation op, MoveMode = MoveAnchor, int n = 1);
0093 
0094     bool visualNavigation() const;
0095     void setVisualNavigation(bool b);
0096 
0097     void setVerticalMovementX(int x);
0098     int verticalMovementX() const;
0099 
0100     void setKeepPositionOnInsert(bool b);
0101     bool keepPositionOnInsert() const;
0102 
0103     void deleteChar();
0104     void deletePreviousChar();
0105 
0106     enum SelectionType {
0107         WordUnderCursor,
0108         LineUnderCursor,
0109         BlockUnderCursor,
0110         Document
0111     };
0112     void select(SelectionType selection);
0113 
0114     bool hasSelection() const;
0115     bool hasComplexSelection() const;
0116     void removeSelectedText();
0117     void clearSelection();
0118     int selectionStart() const;
0119     int selectionEnd() const;
0120 
0121     QString selectedText() const;
0122     QTextDocumentFragment selection() const;
0123     void selectedTableCells(int *firstRow, int *numRows, int *firstColumn, int *numColumns) const;
0124 
0125     QTextBlock block() const;
0126 
0127     QTextCharFormat charFormat() const;
0128     void setCharFormat(const QTextCharFormat &format);
0129     void mergeCharFormat(const QTextCharFormat &modifier);
0130 
0131     QTextBlockFormat blockFormat() const;
0132     void setBlockFormat(const QTextBlockFormat &format);
0133     void mergeBlockFormat(const QTextBlockFormat &modifier);
0134 
0135     QTextCharFormat blockCharFormat() const;
0136     void setBlockCharFormat(const QTextCharFormat &format);
0137     void mergeBlockCharFormat(const QTextCharFormat &modifier);
0138 
0139     bool atBlockStart() const;
0140     bool atBlockEnd() const;
0141     bool atStart() const;
0142     bool atEnd() const;
0143 
0144     void insertBlock();
0145     void insertBlock(const QTextBlockFormat &format);
0146     void insertBlock(const QTextBlockFormat &format, const QTextCharFormat &charFormat);
0147 
0148     QTextList *insertList(const QTextListFormat &format);
0149     QTextList *insertList(QTextListFormat::Style style);
0150 
0151     QTextList *createList(const QTextListFormat &format);
0152     QTextList *createList(QTextListFormat::Style style);
0153     QTextList *currentList() const;
0154 
0155     QTextTable *insertTable(int rows, int cols, const QTextTableFormat &format);
0156     QTextTable *insertTable(int rows, int cols);
0157     QTextTable *currentTable() const;
0158 
0159     QTextFrame *insertFrame(const QTextFrameFormat &format);
0160     QTextFrame *currentFrame() const;
0161 
0162     void insertFragment(const QTextDocumentFragment &fragment);
0163 
0164 #ifndef QT_NO_TEXTHTMLPARSER
0165     void insertHtml(const QString &html);
0166 #endif // QT_NO_TEXTHTMLPARSER
0167 #if QT_CONFIG(textmarkdownreader)
0168     void insertMarkdown(const QString &markdown,
0169                         QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub);
0170 #endif // textmarkdownreader
0171 
0172     void insertImage(const QTextImageFormat &format, QTextFrameFormat::Position alignment);
0173     void insertImage(const QTextImageFormat &format);
0174     void insertImage(const QString &name);
0175     void insertImage(const QImage &image, const QString &name = QString());
0176 
0177     void beginEditBlock();
0178     void joinPreviousEditBlock();
0179     void endEditBlock();
0180 
0181     bool operator!=(const QTextCursor &rhs) const;
0182     bool operator<(const QTextCursor &rhs) const;
0183     bool operator<=(const QTextCursor &rhs) const;
0184     bool operator==(const QTextCursor &rhs) const;
0185     bool operator>=(const QTextCursor &rhs) const;
0186     bool operator>(const QTextCursor &rhs) const;
0187 
0188     bool isCopyOf(const QTextCursor &other) const;
0189 
0190     int blockNumber() const;
0191     int columnNumber() const;
0192 
0193     QTextDocument *document() const;
0194 
0195 private:
0196     QSharedDataPointer<QTextCursorPrivate> d;
0197     friend class QTextCursorPrivate;
0198     friend class QTextDocumentPrivate;
0199     friend class QTextDocumentFragmentPrivate;
0200     friend class QTextCopyHelper;
0201     friend class QWidgetTextControlPrivate;
0202 };
0203 
0204 Q_DECLARE_SHARED(QTextCursor)
0205 
0206 QT_END_NAMESPACE
0207 
0208 #endif // QTEXTCURSOR_H