Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QTextEdit class provides a widget that is used to edit and display both plain and rich text. More...
#include <qtextedit.h>
Classes | |
class | ExtraSelection |
The QTextEdit::ExtraSelection structure provides a way of specifying a character format for a given selection in a document. More... | |
Public Types | |
enum | LineWrapMode { NoWrap , WidgetWidth , FixedPixelWidth , FixedColumnWidth } |
\value NoWrap \value WidgetWidth \value FixedPixelWidth \value FixedColumnWidth More... | |
enum | AutoFormattingFlag { AutoNone = 0 , AutoBulletList = 0x00000001 , AutoAll = 0xffffffff } |
\value AutoNone Don't do any automatic formatting. More... | |
Public Slots | |
void | setFontPointSize (qreal s) |
Sets the point size of the current format to s. | |
void | setFontFamily (const QString &fontFamily) |
Sets the font family of the current format to fontFamily. | |
void | setFontWeight (int w) |
Sets the font weight of the current format to the given weight, where the value used is in the range defined by the QFont::Weight enum. | |
void | setFontUnderline (bool b) |
If underline is true, sets the current format to underline; otherwise sets the current format to non-underline. | |
void | setFontItalic (bool b) |
If italic is true, sets the current format to italic; otherwise sets the current format to non-italic. | |
void | setTextColor (const QColor &c) |
Sets the text color of the current format to c. | |
void | setTextBackgroundColor (const QColor &c) |
void | setCurrentFont (const QFont &f) |
Sets the font of the current format to f. | |
void | setAlignment (Qt::Alignment a) |
Sets the alignment of the current paragraph to a. | |
void | setPlainText (const QString &text) |
Changes the text of the text edit to the string text. | |
void | setHtml (const QString &text) |
void | setText (const QString &text) |
void | cut () |
Copies the selected text to the clipboard and deletes it from the text edit. | |
void | copy () |
Copies any selected text to the clipboard. | |
void | paste () |
Pastes the text from the clipboard into the text edit at the current cursor position. | |
void | undo () |
void | redo () |
void | clear () |
Deletes all the text in the text edit. | |
void | selectAll () |
Selects all text. | |
void | insertPlainText (const QString &text) |
Convenience slot that inserts text at the current cursor position. | |
void | insertHtml (const QString &text) |
Convenience slot that inserts text which is assumed to be of html formatting at the current cursor position. | |
void | append (const QString &text) |
Appends a new paragraph with text to the end of the text edit. | |
void | scrollToAnchor (const QString &name) |
Scrolls the text edit so that the anchor with the given name is visible; does nothing if the name is empty, or is already visible, or isn't found. | |
void | zoomIn (int range=1) |
Zooms in on the text by making the base font size range points larger and recalculating all font sizes to be the new size. | |
void | zoomOut (int range=1) |
Zooms out on the text by making the base font size range points smaller and recalculating all font sizes to be the new size. | |
Signals | |
void | textChanged () |
This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied. | |
void | undoAvailable (bool b) |
This signal is emitted whenever undo operations become available (available is true) or unavailable (available is false). | |
void | redoAvailable (bool b) |
This signal is emitted whenever redo operations become available (available is true) or unavailable (available is false). | |
void | currentCharFormatChanged (const QTextCharFormat &format) |
This signal is emitted if the current character format has changed, for example caused by a change of the cursor position. | |
void | copyAvailable (bool b) |
This signal is emitted when text is selected or de-selected in the text edit. | |
void | selectionChanged () |
This signal is emitted whenever the selection changes. | |
void | cursorPositionChanged () |
This signal is emitted whenever the position of the cursor changed. | |
Public Member Functions | |
QTextEdit (QWidget *parent=nullptr) | |
Constructs an empty QTextEdit with parent parent. | |
QTextEdit (const QString &text, QWidget *parent=nullptr) | |
Constructs a QTextEdit with parent parent. | |
virtual | ~QTextEdit () |
Destructor. | |
void | setDocument (QTextDocument *document) |
QTextDocument * | document () const |
void | setPlaceholderText (const QString &placeholderText) |
QString | placeholderText () const |
void | setTextCursor (const QTextCursor &cursor) |
Sets the visible cursor. | |
QTextCursor | textCursor () const |
Returns a copy of the QTextCursor that represents the currently visible cursor. | |
bool | isReadOnly () const |
void | setReadOnly (bool ro) |
void | setTextInteractionFlags (Qt::TextInteractionFlags flags) |
Qt::TextInteractionFlags | textInteractionFlags () const |
qreal | fontPointSize () const |
Returns the point size of the font of the current format. | |
QString | fontFamily () const |
Returns the font family of the current format. | |
int | fontWeight () const |
Returns the font weight of the current format. | |
bool | fontUnderline () const |
Returns true if the font of the current format is underlined; otherwise returns false. | |
bool | fontItalic () const |
Returns true if the font of the current format is italic; otherwise returns false. | |
QColor | textColor () const |
Returns the text color of the current format. | |
QColor | textBackgroundColor () const |
QFont | currentFont () const |
Returns the font of the current format. | |
Qt::Alignment | alignment () const |
Returns the alignment of the current paragraph. | |
void | mergeCurrentCharFormat (const QTextCharFormat &modifier) |
Merges the properties specified in modifier into the current character format by calling QTextCursor::mergeCharFormat on the editor's cursor. | |
void | setCurrentCharFormat (const QTextCharFormat &format) |
Sets the char format that is be used when inserting new text to format by calling QTextCursor::setCharFormat() on the editor's cursor. | |
QTextCharFormat | currentCharFormat () const |
Returns the char format that is used when inserting new text. | |
AutoFormatting | autoFormatting () const |
void | setAutoFormatting (AutoFormatting features) |
bool | tabChangesFocus () const |
void | setTabChangesFocus (bool b) |
void | setDocumentTitle (const QString &title) |
QString | documentTitle () const |
bool | isUndoRedoEnabled () const |
void | setUndoRedoEnabled (bool enable) |
LineWrapMode | lineWrapMode () const |
void | setLineWrapMode (LineWrapMode mode) |
int | lineWrapColumnOrWidth () const |
void | setLineWrapColumnOrWidth (int w) |
QTextOption::WrapMode | wordWrapMode () const |
the mode QTextEdit will use when wrapping text by words | |
void | setWordWrapMode (QTextOption::WrapMode policy) |
bool | find (const QString &exp, QTextDocument::FindFlags options=QTextDocument::FindFlags()) |
Finds the next occurrence of the string, exp, using the given options. | |
QString | toPlainText () const |
QString QTextEdit::toPlainText() const. | |
QString | toHtml () const |
void | ensureCursorVisible () |
Ensures that the cursor is visible by scrolling the text edit if necessary. | |
virtual Q_INVOKABLE QVariant | loadResource (int type, const QUrl &name) |
Loads the resource specified by the given type and name. | |
QMenu * | createStandardContextMenu () |
\reimp | |
QMenu * | createStandardContextMenu (const QPoint &position) |
QTextCursor | cursorForPosition (const QPoint &pos) const |
returns a QTextCursor at position pos (in viewport coordinates). | |
QRect | cursorRect (const QTextCursor &cursor) const |
returns a rectangle (in viewport coordinates) that includes the cursor. | |
QRect | cursorRect () const |
returns a rectangle (in viewport coordinates) that includes the cursor of the text edit. | |
QString | anchorAt (const QPoint &pos) const |
Returns the reference of the anchor at position pos, or an empty string if no anchor exists at that point. | |
bool | overwriteMode () const |
void | setOverwriteMode (bool overwrite) |
qreal | tabStopDistance () const |
void | setTabStopDistance (qreal distance) |
int | cursorWidth () const |
void | setCursorWidth (int width) |
bool | acceptRichText () const |
void | setAcceptRichText (bool accept) |
void | setExtraSelections (const QList< ExtraSelection > &selections) |
\variable QTextEdit::ExtraSelection::cursor A cursor that contains a selection in a QTextDocument | |
QList< ExtraSelection > | extraSelections () const |
void | moveCursor (QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode=QTextCursor::MoveAnchor) |
bool | canPaste () const |
void | print (QPagedPaintDevice *printer) const |
QVariant | inputMethodQuery (Qt::InputMethodQuery property) const override |
\reimp | |
Q_INVOKABLE QVariant | inputMethodQuery (Qt::InputMethodQuery query, QVariant argument) const |
Protected Member Functions | |
virtual bool | event (QEvent *e) override |
virtual void | timerEvent (QTimerEvent *e) override |
virtual void | keyPressEvent (QKeyEvent *e) override |
\reimp | |
virtual void | keyReleaseEvent (QKeyEvent *e) override |
\reimp | |
virtual void | resizeEvent (QResizeEvent *e) override |
\reimp | |
virtual void | paintEvent (QPaintEvent *e) override |
This event handler can be reimplemented in a subclass to receive paint events passed in event. | |
virtual void | mousePressEvent (QMouseEvent *e) override |
\reimp | |
virtual void | mouseMoveEvent (QMouseEvent *e) override |
\reimp | |
virtual void | mouseReleaseEvent (QMouseEvent *e) override |
\reimp | |
virtual void | mouseDoubleClickEvent (QMouseEvent *e) override |
\reimp | |
virtual bool | focusNextPrevChild (bool next) override |
\reimp | |
virtual void | contextMenuEvent (QContextMenuEvent *e) override |
Shows the standard context menu created with createStandardContextMenu(). | |
virtual void | focusInEvent (QFocusEvent *e) override |
\reimp | |
virtual void | focusOutEvent (QFocusEvent *e) override |
\reimp | |
virtual void | showEvent (QShowEvent *) override |
\reimp | |
virtual void | changeEvent (QEvent *e) override |
\reimp | |
virtual QMimeData * | createMimeDataFromSelection () const |
This function returns a new MIME data object to represent the contents of the text edit's current selection. | |
virtual bool | canInsertFromMimeData (const QMimeData *source) const |
This function returns true if the contents of the MIME data object, specified by source, can be decoded and inserted into the document. | |
virtual void | insertFromMimeData (const QMimeData *source) |
This function inserts the contents of the MIME data object, specified by source, into the text edit at the current cursor position. | |
virtual void | inputMethodEvent (QInputMethodEvent *) override |
\reimp | |
QTextEdit (QTextEditPrivate &dd, QWidget *parent) | |
virtual void | scrollContentsBy (int dx, int dy) override |
\reimp | |
virtual void | doSetTextCursor (const QTextCursor &cursor) |
void | zoomInF (float range) |
Properties | |
AutoFormatting | autoFormatting |
the enabled set of auto formatting features | |
bool | tabChangesFocus |
whether \uicontrol Tab changes focus or is accepted as input | |
QString | documentTitle |
the title of the document parsed from the text. | |
bool | undoRedoEnabled |
whether undo and redo are enabled. | |
LineWrapMode | lineWrapMode |
the line wrap mode | |
int | lineWrapColumnOrWidth |
the position (in pixels or columns depending on the wrap mode) where text will be wrapped | |
bool | readOnly |
whether the text edit is read-only | |
QString | html |
This property provides an HTML interface to the text of the text edit. | |
QString | plainText |
the text editor's contents as plain text. | |
bool | overwriteMode |
whether text entered by the user will overwrite existing text | |
qreal | tabStopDistance |
the tab stop distance in pixels | |
bool | acceptRichText |
whether the text edit accepts rich text insertions by the user | |
int | cursorWidth |
Qt::TextInteractionFlags | textInteractionFlags |
QTextDocument * | document |
the underlying document of the text editor. | |
QString | placeholderText |
the editor placeholder text | |
Friends | |
class | QTextEditControl |
class | QTextDocument |
class | QWidgetTextControl |
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
\inmodule QtWidgets
Definition at line 26 of file qtextedit.h.
\value AutoNone Don't do any automatic formatting.
\value AutoBulletList Automatically create bullet lists (e.g. when the user enters an asterisk ('*') in the left most column, or presses Enter in an existing list item. \value AutoAll Apply all automatic formatting. Currently only automatic bullet lists are supported.
Enumerator | |
---|---|
AutoNone | |
AutoBulletList | |
AutoAll |
Definition at line 62 of file qtextedit.h.
\value NoWrap \value WidgetWidth \value FixedPixelWidth \value FixedColumnWidth
Enumerator | |
---|---|
NoWrap | |
WidgetWidth | |
FixedPixelWidth | |
FixedColumnWidth |
Definition at line 54 of file qtextedit.h.
Constructs an empty QTextEdit with parent parent.
Definition at line 613 of file qtextedit.cpp.
Constructs a QTextEdit with parent parent.
The text edit will display the text text. The text is interpreted as html.
Definition at line 634 of file qtextedit.cpp.
|
virtual |
Destructor.
Definition at line 646 of file qtextedit.cpp.
|
protected |
Definition at line 623 of file qtextedit.cpp.
bool QTextEdit::acceptRichText | ( | ) | const |
Definition at line 2117 of file qtextedit.cpp.
Qt::Alignment QTextEdit::alignment | ( | ) | const |
Returns the alignment of the current paragraph.
Definition at line 772 of file qtextedit.cpp.
Returns the reference of the anchor at position pos, or an empty string if no anchor exists at that point.
Definition at line 2025 of file qtextedit.cpp.
Appends a new paragraph with text to the end of the text edit.
Definition at line 2698 of file qtextedit.cpp.
QTextEdit::AutoFormatting QTextEdit::autoFormatting | ( | ) | const |
Definition at line 2326 of file qtextedit.cpp.
|
protectedvirtual |
This function returns true
if the contents of the MIME data object, specified by source, can be decoded and inserted into the document.
It is called for example when during a drag operation the mouse enters this widget and it is necessary to determine whether it is possible to accept the drag and drop operation.
Reimplement this function to enable drag and drop support for additional MIME types.
Reimplemented in TextEdit.
Definition at line 2201 of file qtextedit.cpp.
bool QTextEdit::canPaste | ( | ) | const |
Definition at line 2455 of file qtextedit.cpp.
\reimp
Definition at line 1912 of file qtextedit.cpp.
|
slot |
Deletes all the text in the text edit.
Notes: \list
Definition at line 1063 of file qtextedit.cpp.
|
overrideprotectedvirtual |
Shows the standard context menu created with createStandardContextMenu().
If you do not want the text edit to have a context menu, you can set its \l contextMenuPolicy to Qt::NoContextMenu. If you want to customize the context menu, reimplement this function. If you want to extend the standard context menu, reimplement this function, call createStandardContextMenu() and extend the menu returned.
Information about the event is passed in the event object.
Reimplemented in LogViewer, qdesigner_internal::HtmlTextEdit, and qdesigner_internal::HtmlTextEdit.
Definition at line 1736 of file qtextedit.cpp.
|
slot |
Copies any selected text to the clipboard.
Definition at line 1024 of file qtextedit.cpp.
|
signal |
This signal is emitted when text is selected or de-selected in the text edit.
When text is selected this signal will be emitted with yes set to true. If no text has been selected or if the selected text is de-selected this signal is emitted with yes set to false.
If yes is true then copy() can be used to copy the selection to the clipboard. If yes is false then copy() does nothing.
|
protectedvirtual |
This function returns a new MIME data object to represent the contents of the text edit's current selection.
It is called when the selection needs to be encapsulated into a new QMimeData object; for example, when a drag and drop operation is started, or when data is copied to the clipboard.
If you reimplement this function, note that the ownership of the returned QMimeData object is passed to the caller. The selection can be retrieved by using the textCursor() function.
Definition at line 2186 of file qtextedit.cpp.
QMenu * QTextEdit::createStandardContextMenu | ( | ) |
\reimp
This function creates the standard context menu which is shown when the user clicks on the text edit with the right mouse button. It is called from the default contextMenuEvent() handler. The popup menu's ownership is transferred to the caller.
We recommend that you use the createStandardContextMenu(QPoint) version instead which will enable the actions that are sensitive to where the user clicked.
Definition at line 1961 of file qtextedit.cpp.
Definition at line 1977 of file qtextedit.cpp.
QTextCharFormat QTextEdit::currentCharFormat | ( | ) | const |
Returns the char format that is used when inserting new text.
Definition at line 2308 of file qtextedit.cpp.
|
signal |
This signal is emitted if the current character format has changed, for example caused by a change of the cursor position.
The new format is f.
QFont QTextEdit::currentFont | ( | ) | const |
Returns the font of the current format.
Definition at line 744 of file qtextedit.cpp.
QTextCursor QTextEdit::cursorForPosition | ( | const QPoint & | pos | ) | const |
returns a QTextCursor at position pos (in viewport coordinates).
Definition at line 1987 of file qtextedit.cpp.
|
signal |
This signal is emitted whenever the position of the cursor changed.
QRect QTextEdit::cursorRect | ( | ) | const |
returns a rectangle (in viewport coordinates) that includes the cursor of the text edit.
Definition at line 2012 of file qtextedit.cpp.
QRect QTextEdit::cursorRect | ( | const QTextCursor & | cursor | ) | const |
returns a rectangle (in viewport coordinates) that includes the cursor.
Definition at line 1997 of file qtextedit.cpp.
int QTextEdit::cursorWidth | ( | ) | const |
Definition at line 2094 of file qtextedit.cpp.
|
slot |
Copies the selected text to the clipboard and deletes it from the text edit.
If there is no selected text nothing happens.
Definition at line 1012 of file qtextedit.cpp.
QTextDocument * QTextEdit::document | ( | ) | const |
Definition at line 795 of file qtextedit.cpp.
|
inline |
Definition at line 113 of file qtextedit.h.
|
protectedvirtual |
This provides a hook for subclasses to intercept cursor changes.
Definition at line 844 of file qtextedit.cpp.
void QTextEdit::ensureCursorVisible | ( | ) |
Ensures that the cursor is visible by scrolling the text edit if necessary.
Definition at line 2712 of file qtextedit.cpp.
|
overrideprotectedvirtual |
Reimplemented in QTextBrowser.
Definition at line 1084 of file qtextedit.cpp.
QList< QTextEdit::ExtraSelection > QTextEdit::extraSelections | ( | ) | const |
Definition at line 2170 of file qtextedit.cpp.
bool QTextEdit::find | ( | const QString & | exp, |
QTextDocument::FindFlags | options = QTextDocument::FindFlags() ) |
Finds the next occurrence of the string, exp, using the given options.
Returns true
if exp was found and changes the cursor to select the match; otherwise returns false
.
Finds the next occurrence, matching the regular expression, exp, using the given options.
Returns true
if a match was found and changes the cursor to select the match; otherwise returns false
.
Definition at line 2593 of file qtextedit.cpp.
|
overrideprotectedvirtual |
\reimp
Definition at line 1876 of file qtextedit.cpp.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
QString QTextEdit::fontFamily | ( | ) | const |
Returns the font family of the current format.
Definition at line 666 of file qtextedit.cpp.
bool QTextEdit::fontItalic | ( | ) | const |
Returns true
if the font of the current format is italic; otherwise returns false.
Definition at line 701 of file qtextedit.cpp.
qreal QTextEdit::fontPointSize | ( | ) | const |
Returns the point size of the font of the current format.
Definition at line 655 of file qtextedit.cpp.
bool QTextEdit::fontUnderline | ( | ) | const |
Returns true
if the font of the current format is underlined; otherwise returns false.
Definition at line 689 of file qtextedit.cpp.
int QTextEdit::fontWeight | ( | ) | const |
Returns the font weight of the current format.
Definition at line 677 of file qtextedit.cpp.
|
overrideprotectedvirtual |
\reimp
Definition at line 1788 of file qtextedit.cpp.
|
override |
\reimp
Definition at line 1818 of file qtextedit.cpp.
QVariant QTextEdit::inputMethodQuery | ( | Qt::InputMethodQuery | query, |
QVariant | argument ) const |
Definition at line 1825 of file qtextedit.cpp.
This function inserts the contents of the MIME data object, specified by source, into the text edit at the current cursor position.
It is called whenever text is inserted as the result of a clipboard paste operation, or when the text edit accepts data from a drag and drop operation.
Reimplement this function to enable drag and drop support for additional MIME types.
Reimplemented in TextEdit.
Definition at line 2216 of file qtextedit.cpp.
Convenience slot that inserts text which is assumed to be of html formatting at the current cursor position.
It is equivalent to:
Definition at line 2366 of file qtextedit.cpp.
Convenience slot that inserts text at the current cursor position.
It is equivalent to
Definition at line 2346 of file qtextedit.cpp.
bool QTextEdit::isReadOnly | ( | ) | const |
Definition at line 2232 of file qtextedit.cpp.
|
inline |
Definition at line 116 of file qtextedit.h.
\reimp
Definition at line 1448 of file qtextedit.cpp.
int QTextEdit::lineWrapColumnOrWidth | ( | ) | const |
Definition at line 2551 of file qtextedit.cpp.
QTextEdit::LineWrapMode QTextEdit::lineWrapMode | ( | ) | const |
Definition at line 2520 of file qtextedit.cpp.
Loads the resource specified by the given type and name.
This function is an extension of QTextDocument::loadResource().
Reimplemented in AboutLabel, and QTextBrowser.
Definition at line 1486 of file qtextedit.cpp.
void QTextEdit::mergeCurrentCharFormat | ( | const QTextCharFormat & | modifier | ) |
Merges the properties specified in modifier into the current character format by calling QTextCursor::mergeCharFormat on the editor's cursor.
If the editor has a selection then the properties of modifier are directly applied to the selection.
Definition at line 2287 of file qtextedit.cpp.
|
overrideprotectedvirtual |
\reimp
Definition at line 1704 of file qtextedit.cpp.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
void QTextEdit::moveCursor | ( | QTextCursor::MoveOperation | operation, |
QTextCursor::MoveMode | mode = QTextCursor::MoveAnchor ) |
If mode is QTextCursor::KeepAnchor, the cursor selects the text it moves over. This is the same effect that the user achieves when they hold down the Shift key and move the cursor with the cursor keys.
Definition at line 2445 of file qtextedit.cpp.
bool QTextEdit::overwriteMode | ( | ) | const |
Definition at line 2046 of file qtextedit.cpp.
|
overrideprotectedvirtual |
This event handler can be reimplemented in a subclass to receive paint events passed in event.
It is usually unnecessary to reimplement this function in a subclass of QTextEdit.
Reimplemented in QTextBrowser.
Definition at line 1633 of file qtextedit.cpp.
|
slot |
Pastes the text from the clipboard into the text edit at the current cursor position.
If there is no text in the clipboard nothing happens.
To change the behavior of this function, i.e. to modify what QTextEdit can paste and how it is being pasted, reimplement the virtual canInsertFromMimeData() and insertFromMimeData() functions.
Definition at line 1044 of file qtextedit.cpp.
QString QTextEdit::placeholderText | ( | ) | const |
Definition at line 814 of file qtextedit.cpp.
void QTextEdit::print | ( | QPagedPaintDevice * | printer | ) | const |
Definition at line 2470 of file qtextedit.cpp.
|
slot |
Redoes the last operation.
If there is no operation to redo, i.e. there is no redo step in the undo/redo history, nothing happens.
Definition at line 984 of file qtextedit.cpp.
|
signal |
This signal is emitted whenever redo operations become available (available is true) or unavailable (available is false).
|
overrideprotectedvirtual |
\reimp
Definition at line 1495 of file qtextedit.cpp.
|
overrideprotectedvirtual |
\reimp
Definition at line 1807 of file qtextedit.cpp.
Scrolls the text edit so that the anchor with the given name is visible; does nothing if the name is empty, or is already visible, or isn't found.
Definition at line 2378 of file qtextedit.cpp.
|
slot |
Selects all text.
Definition at line 1076 of file qtextedit.cpp.
|
signal |
This signal is emitted whenever the selection changes.
void QTextEdit::setAcceptRichText | ( | bool | accept | ) |
Definition at line 2123 of file qtextedit.cpp.
|
slot |
Sets the alignment of the current paragraph to a.
Valid alignments are Qt::AlignLeft, Qt::AlignRight, Qt::AlignJustify and Qt::AlignCenter (which centers horizontally).
Definition at line 756 of file qtextedit.cpp.
void QTextEdit::setAutoFormatting | ( | AutoFormatting | features | ) |
Definition at line 2332 of file qtextedit.cpp.
void QTextEdit::setCurrentCharFormat | ( | const QTextCharFormat & | format | ) |
Sets the char format that is be used when inserting new text to format by calling QTextCursor::setCharFormat() on the editor's cursor.
If the editor has a selection then the char format is directly applied to the selection.
Definition at line 2299 of file qtextedit.cpp.
Sets the font of the current format to f.
Definition at line 961 of file qtextedit.cpp.
void QTextEdit::setCursorWidth | ( | int | width | ) |
Definition at line 2100 of file qtextedit.cpp.
void QTextEdit::setDocument | ( | QTextDocument * | document | ) |
Definition at line 787 of file qtextedit.cpp.
Definition at line 111 of file qtextedit.h.
void QTextEdit::setExtraSelections | ( | const QList< ExtraSelection > & | selections | ) |
\variable QTextEdit::ExtraSelection::cursor A cursor that contains a selection in a QTextDocument
\variable QTextEdit::ExtraSelection::format A format that is used to specify a foreground or background brush/color for the selection.
Definition at line 2158 of file qtextedit.cpp.
Sets the font family of the current format to fontFamily.
Definition at line 866 of file qtextedit.cpp.
|
slot |
If italic is true, sets the current format to italic; otherwise sets the current format to non-italic.
Definition at line 923 of file qtextedit.cpp.
Sets the point size of the current format to s.
Note that if s is zero or negative, the behavior of this function is not defined.
Definition at line 881 of file qtextedit.cpp.
|
slot |
If underline is true, sets the current format to underline; otherwise sets the current format to non-underline.
Definition at line 910 of file qtextedit.cpp.
|
slot |
Sets the font weight of the current format to the given weight, where the value used is in the range defined by the QFont::Weight enum.
Definition at line 897 of file qtextedit.cpp.
Definition at line 1226 of file qtextedit.cpp.
void QTextEdit::setLineWrapColumnOrWidth | ( | int | w | ) |
Definition at line 2557 of file qtextedit.cpp.
void QTextEdit::setLineWrapMode | ( | LineWrapMode | mode | ) |
Definition at line 2526 of file qtextedit.cpp.
void QTextEdit::setOverwriteMode | ( | bool | overwrite | ) |
Definition at line 2052 of file qtextedit.cpp.
Definition at line 820 of file qtextedit.cpp.
Changes the text of the text edit to the string text.
Any previous text is removed.
Notes: \list
Definition at line 1183 of file qtextedit.cpp.
void QTextEdit::setReadOnly | ( | bool | ro | ) |
Definition at line 2238 of file qtextedit.cpp.
void QTextEdit::setTabChangesFocus | ( | bool | b | ) |
Definition at line 2492 of file qtextedit.cpp.
Definition at line 2078 of file qtextedit.cpp.
Sets the text edit's text. The text can be plain text or HTML and the text edit will try to guess the right format.
Use setHtml() or setPlainText() directly to avoid text edit's guessing.
Definition at line 2675 of file qtextedit.cpp.
Sets the text background color of the current format to c.
Definition at line 949 of file qtextedit.cpp.
Sets the text color of the current format to c.
Definition at line 935 of file qtextedit.cpp.
void QTextEdit::setTextCursor | ( | const QTextCursor & | cursor | ) |
Sets the visible cursor.
Definition at line 833 of file qtextedit.cpp.
void QTextEdit::setTextInteractionFlags | ( | Qt::TextInteractionFlags | flags | ) |
Definition at line 2267 of file qtextedit.cpp.
|
inline |
Definition at line 118 of file qtextedit.h.
void QTextEdit::setWordWrapMode | ( | QTextOption::WrapMode | policy | ) |
Definition at line 2579 of file qtextedit.cpp.
|
overrideprotectedvirtual |
\reimp
Definition at line 1897 of file qtextedit.cpp.
bool QTextEdit::tabChangesFocus | ( | ) | const |
Definition at line 2486 of file qtextedit.cpp.
qreal QTextEdit::tabStopDistance | ( | ) | const |
Definition at line 2072 of file qtextedit.cpp.
QColor QTextEdit::textBackgroundColor | ( | ) | const |
Returns the text background color of the current format.
Definition at line 732 of file qtextedit.cpp.
|
signal |
This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.
QColor QTextEdit::textColor | ( | ) | const |
Returns the text color of the current format.
Definition at line 712 of file qtextedit.cpp.
QTextCursor QTextEdit::textCursor | ( | ) | const |
Returns a copy of the QTextCursor that represents the currently visible cursor.
Note that changes on the returned cursor do not affect QTextEdit's cursor; use setTextCursor() to update the visible cursor.
Definition at line 855 of file qtextedit.cpp.
Qt::TextInteractionFlags QTextEdit::textInteractionFlags | ( | ) | const |
Definition at line 2273 of file qtextedit.cpp.
|
overrideprotectedvirtual |
Definition at line 1125 of file qtextedit.cpp.
QString QTextEdit::toHtml | ( | ) | const |
Definition at line 1233 of file qtextedit.cpp.
QString QTextEdit::toPlainText | ( | ) | const |
QString QTextEdit::toPlainText() const.
Returns the text of the text edit as plain text.
Definition at line 1197 of file qtextedit.cpp.
|
slot |
Undoes the last operation.
If there is no operation to undo, i.e. there is no undo step in the undo/redo history, nothing happens.
Definition at line 978 of file qtextedit.cpp.
|
signal |
This signal is emitted whenever undo operations become available (available is true) or unavailable (available is false).
QTextOption::WrapMode QTextEdit::wordWrapMode | ( | ) | const |
the mode QTextEdit will use when wrapping text by words
By default, this property is set to QTextOption::WrapAtWordBoundaryOrAnywhere.
Definition at line 2573 of file qtextedit.cpp.
|
slot |
Zooms in on the text by making the base font size range points larger and recalculating all font sizes to be the new size.
This does not change the size of any images.
Definition at line 2403 of file qtextedit.cpp.
|
protected |
Definition at line 2423 of file qtextedit.cpp.
|
slot |
Zooms out on the text by making the base font size range points smaller and recalculating all font sizes to be the new size.
This does not change the size of any images.
Definition at line 2415 of file qtextedit.cpp.
|
friend |
Definition at line 284 of file qtextedit.h.
|
friend |
Definition at line 283 of file qtextedit.h.
|
friend |
Definition at line 285 of file qtextedit.h.
|
readwrite |
whether the text edit accepts rich text insertions by the user
When this property is set to false text edit will accept only plain text input from the user. For example through clipboard or drag and drop.
This property's default is true.
Definition at line 47 of file qtextedit.h.
|
readwrite |
the enabled set of auto formatting features
The value can be any combination of the values in the AutoFormattingFlag enum. The default is AutoNone. Choose AutoAll to enable all automatic formatting.
Currently, the only automatic formatting feature provided is AutoBulletList; future versions of Qt may offer more.
Definition at line 30 of file qtextedit.h.
|
readwrite |
This property specifies the width of the cursor in pixels. The default value is 1.
Definition at line 48 of file qtextedit.h.
|
readwrite |
the underlying document of the text editor.
Definition at line 51 of file qtextedit.h.
|
readwrite |
the title of the document parsed from the text.
By default, for a newly-created, empty document, this property contains an empty string.
Definition at line 32 of file qtextedit.h.
|
readwrite |
This property provides an HTML interface to the text of the text edit.
toHtml() returns the text of the text edit as html.
setHtml() changes the text of the text edit. Any previous text is removed and the undo/redo history is cleared. The input text is interpreted as rich text in html format. currentCharFormat() is also reset, unless textCursor() is already at the beginning of the document.
By default, for a newly-created, empty document, this property contains text to describe an HTML 4.0 document with no body text.
Definition at line 42 of file qtextedit.h.
|
readwrite |
the position (in pixels or columns depending on the wrap mode) where text will be wrapped
If the wrap mode is FixedPixelWidth, the value is the number of pixels from the left edge of the text edit at which text should be wrapped. If the wrap mode is FixedColumnWidth, the value is the column number (in character columns) from the left edge of the text edit at which text should be wrapped.
By default, this property contains a value of 0.
Definition at line 36 of file qtextedit.h.
|
readwrite |
the line wrap mode
The default mode is WidgetWidth which causes words to be wrapped at the right edge of the text edit. Wrapping occurs at whitespace, keeping whole words intact. If you want wrapping to occur within words use setWordWrapMode(). If you set a wrap mode of FixedPixelWidth or FixedColumnWidth you should also call setLineWrapColumnOrWidth() with the width you want.
Definition at line 34 of file qtextedit.h.
|
readwrite |
whether text entered by the user will overwrite existing text
As with many text editors, the text editor widget can be configured to insert or overwrite existing text with new text entered by the user.
If this property is true
, existing text is overwritten, character-for-character by new text; otherwise, text is inserted at the cursor position, displacing existing text.
By default, this property is false
(new text does not overwrite existing text).
Definition at line 45 of file qtextedit.h.
|
readwrite |
the editor placeholder text
Setting this property makes the editor display a grayed-out placeholder text as long as the document() is empty.
By default, this property contains an empty string.
Definition at line 52 of file qtextedit.h.
|
readwrite |
the text editor's contents as plain text.
Previous contents are removed and undo/redo history is reset when the property is set. currentCharFormat() is also reset, unless textCursor() is already at the beginning of the document.
If the text edit has another content type, it will not be replaced by plain text if you call toPlainText(). The only exception to this is the non-break space, {nbsp;}, that will be converted into standard space.
By default, for an editor with no contents, this property contains an empty string.
Definition at line 44 of file qtextedit.h.
|
readwrite |
whether the text edit is read-only
In a read-only text edit the user can only navigate through the text and select text; modifying the text is not possible.
This property's default is false.
Definition at line 37 of file qtextedit.h.
|
readwrite |
whether \uicontrol Tab changes focus or is accepted as input
In some occasions text edits should not allow the user to input tabulators or change indentation using the \uicontrol Tab key, as this breaks the focus chain. The default is false.
Definition at line 31 of file qtextedit.h.
|
readwrite |
the tab stop distance in pixels
By default, this property contains a value of 80 pixels.
Do not set a value less than the \l {QFontMetrics::}{horizontalAdvance()} of the QChar::VisualTabCharacter character, otherwise the tab-character will be drawn incompletely.
Definition at line 46 of file qtextedit.h.
|
readwrite |
Specifies how the widget should interact with user input.
The default value depends on whether the QTextEdit is read-only or editable, and whether it is a QTextBrowser or not.
Definition at line 49 of file qtextedit.h.
|
readwrite |
whether undo and redo are enabled.
Users are only able to undo or redo actions if this property is true, and if there is an action that can be undone (or redone).
Definition at line 33 of file qtextedit.h.