📄 qtextedit.3qt
字号:
.PPThe new vertical alignment is \fIa\fR..PPSee also setVerticalAlignment()..SH "void QTextEdit::cursorPositionChanged ( QTextCursor * c )\fC [signal]\fR"This signal is emitted if the position of the cursor changed. \fIc\fR points to the text cursor object..PPSee also setCursorPosition()..SH "void QTextEdit::cursorPositionChanged ( int para, int pos )\fC [signal]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThis signal is emitted if the position of the cursor changed. \fIpara\fR contains the paragraph index and \fIpos\fR contains the character position within the paragraph..PPSee also setCursorPosition()..SH "void QTextEdit::cut ()\fC [virtual slot]\fR"Copies the selected text (from selection 0) to the clipboard and deletes it from the text edit..PPIf there is no selected text (in selection 0) nothing happens..PPSee also QTextEdit::copy(), paste() and pasteSubType()..SH "void QTextEdit::del ()\fC [virtual slot]\fR"If there is some selected text (in selection 0) it is deleted. If there is no selected text (in selection 0) the character to the right of the text cursor is deleted..PPSee also removeSelectedText() and cut()..SH "void QTextEdit::doKeyboardAction ( KeyboardAction action )\fC [virtual slot]\fR"Executes keyboard action \fIaction\fR. This is normally called by a key event handler..SH "QString QTextEdit::documentTitle () const"Returns the title of the document parsed from the text. See the "documentTitle" property for details..SH "void QTextEdit::ensureCursorVisible ()\fC [virtual slot]\fR"Ensures that the cursor is visible by scrolling the text edit if necessary..PPSee also setCursorPosition()..SH "QString QTextEdit::family () const"Returns the font family of the current format..PPSee also setFamily(), setCurrentFont() and setPointSize()..SH "bool QTextEdit::find ( const QString & expr, bool cs, bool wo, bool forward = TRUE, int * para = 0, int * index = 0 )\fC [virtual]\fR"Finds the next occurrence of the string, \fIexpr\fR, starting from character position \fI*\fR\fIindex\fR within paragraph \fI*\fR\fIpara\fR. Both \fIindex\fR and \fIpara\fR must be non-null int pointers..PPIf \fI*\fR\fIpara\fR and \fI*\fR\fIindex\fR are both 0 the search begins from the start of the text. If \fIcs\fR is TRUE the search is case sensitive, otherwise it is case insensitive. If \fIwo\fR is TRUE the search looks for whole word matches only; otherwise it searches for any matching text. If \fIforward\fR is TRUE (the default) the search works forward from the starting position to the end of the text, otherwise it works backwards to the beginning of the text..PPIf \fIexpr\fR is found the function returns TRUE and sets \fI*\fR\fIpara\fR to the number of the paragraph in which the first character of the match was found and sets \fI*\fR\fIindex\fR to the index position of that character within the \fI*\fR\fIpara\fR..PPIf \fIexpr\fR is not found the function returns FALSE and the contents of \fIindex\fR and \fIpara\fR are undefined..SH "bool QTextEdit::focusNextPrevChild ( bool n )\fC [virtual protected]\fR"Reimplemented to allow tabbing through links. If \fIn\fR is TRUE the tab moves the focus to the next child; if \fIn\fR is FALSE the tab moves the focus to the previous child. Returns TRUE if the focus was moved; otherwise returns FALSE..SH "QFont QTextEdit::font () const"Returns the font of the current format..PPSee also setCurrentFont(), setFamily() and setPointSize()..PPExamples:.)l action/application.cpp, application/application.cpp, mdi/application.cpp and qwerty/qwerty.cpp..SH "void QTextEdit::getCursorPosition ( int * para, int * index ) const"This function sets the \fI*\fR\fIpara\fR and \fI*\fR\fIindex\fR parameters to the current cursor position. \fIpara\fR and \fIindex\fR must be non-null int pointers..PPSee also setCursorPosition()..SH "bool QTextEdit::getFormat ( int para, int index, QFont * font, QColor * color, VerticalAlignment * verticalAlignment )\fC [virtual]\fR"This function gets the format of the character at position \fIindex\fR in paragraph \fIpara\fR. Sets \fIfont\fR to the character's font, \fIcolor\fR to the character's color and \fIverticalAlignment\fR to the character's vertical alignment..PPReturns FALSE if \fIpara\fR or \fIindex\fR is out of range otherwise returns TRUE..SH "bool QTextEdit::getParagraphFormat ( int para, QFont * font, QColor * color, VerticalAlignment * verticalAlignment, int * alignment, QStyleSheetItem::DisplayMode * displayMode, QStyleSheetItem::ListStyle * listStyle, int * listDepth )\fC [virtual]\fR"This function gets the format of the paragraph \fIpara\fR. Sets \fIfont\fR to the paragraphs's font, \fIcolor\fR to the paragraph's color, \fIverticalAlignment\fR to the paragraph's vertical alignment, \fIalignment\fR to the paragraph's alignment, \fIdisplayMode\fR to the paragraph's display mode, \fIlistStyle\fR to the paragraph's list style (if the display mode is QStyleSheetItem::DisplayListItem) and \fIlistDepth\fR to the depth of the list (if the display mode is QStyleSheetItem::DisplayListItem)..PPReturns FALSE if \fIpara\fR is out of range otherwise returns TRUE..SH "void QTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const"If there is a selection, \fI*\fR\fIparaFrom\fR is set to the number of the paragraph in which the selection begins and \fI*\fR\fIparaTo\fR is set to the number of the paragraph in which the selection ends. (They could be the same.) \fI*\fR\fIindexFrom\fR is set to the index at which the selection begins within \fI*\fR\fIparaFrom\fR, and \fI*\fR\fIindexTo\fR is set to the index at which the selection ends within \fI*\fR\fIparaTo\fR..PPIf there is no selection, \fI*\fR\fIparaFrom\fR, \fI*\fR\fIindexFrom\fR, \fI*\fR\fIparaTo\fR and \fI*\fR\fIindexTo\fR are all set to -1..PP\fIparaFrom\fR, \fIindexFrom\fR, \fIparaTo\fR and \fIindexTo\fR must be non-null int pointers..PPThe \fIselNum\fR is the number of the selection (multiple selections are supported). It defaults to 0 (the default selection)..PPSee also setSelection() and selectedText..SH "bool QTextEdit::hasSelectedText () const"Returns TRUE if some text is selected in selection 0; otherwise returns FALSE. See the "hasSelectedText" property for details..SH "int QTextEdit::heightForWidth ( int w ) const\fC [virtual]\fR"Returns how many pixels high the text edit needs to be to display all the text if the text edit is \fIw\fR pixels wide..PPReimplemented from QWidget..SH "void QTextEdit::indent ()\fC [virtual slot]\fR"Re-indents the current paragraph..SH "void QTextEdit::insert ( const QString & text, bool indent = FALSE, bool checkNewLine = TRUE, bool removeSelected = TRUE )\fC [virtual slot]\fR"Inserts \fItext\fR at the current cursor position. If \fIindent\fR is TRUE, the paragraph is re-indented. If \fIcheckNewLine\fR is TRUE, newline characters in \fItext\fR result in hard line breaks (i.e. new paragraphs). If \fIcheckNewLine\fR is FALSE the behaviour of the editor is undefined if the \fItext\fR contains newlines. If \fIremoveSelected\fR is TRUE, any selected text (in selection 0) is removed before the text is inserted..PPSee also paste() and pasteSubType()..SH "void QTextEdit::insertAt ( const QString & text, int para, int index )\fC [virtual slot]\fR"Inserts \fItext\fR in the paragraph \fIpara\fR and position \fIindex\fR.SH "void QTextEdit::insertParagraph ( const QString & text, int para )\fC [virtual slot]\fR"Inserts \fItext\fR as the paragraph at position \fIpara\fR. If \fIpara\fR is -1, the text is appended..SH "bool QTextEdit::isModified () const"Returns TRUE if the document has been modified by the user; otherwise returns FALSE. See the "modified" property for details..SH "bool QTextEdit::isOverwriteMode () const"Returns the text edit's overwrite mode. See the "overwriteMode" property for details..SH "bool QTextEdit::isReadOnly () const"Returns TRUE if the text edit is read-only; otherwise returns FALSE. See the "readOnly" property for details..SH "bool QTextEdit::isRedoAvailable () const"Returns whether redo is available.SH "bool QTextEdit::isUndoAvailable () const"Returns whether undo is available.SH "bool QTextEdit::isUndoRedoEnabled () const"Returns TRUE if undo/redo is enabled; otherwise returns FALSE. See the "undoRedoEnabled" property for details..SH "bool QTextEdit::italic () const"Returns TRUE if the current format is italic; otherwise returns FALSE..PPSee also setItalic()..SH "void QTextEdit::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR"Processes the key event, \fIe\fR. By default key events are used to provide keyboard navigation and text editing..PPReimplemented from QWidget..PPReimplemented in QTextBrowser..SH "int QTextEdit::length () const"Returns the number of characters in the text. See the "length" property for details..SH "int QTextEdit::lineOfChar ( int para, int index )"Returns the line number of the line in paragraph \fIpara\fR in which the character at position \fIindex\fR appears. The \fIindex\fR position is relative to the beginning of the paragraph. If there is no such paragraph or no such character at the \fIindex\fR position (e.g. the index is out of range) -1 is returned..SH "int QTextEdit::lines () const"Returns the number of lines in the text edit..PP\fBWarning:\fR This function may be slow. Lines change all the time during word wrapping, so this function has to iterate over all the paragraphs and get the number of lines from each one individually..PPExamples:.)l action/application.cpp and application/application.cpp..SH "int QTextEdit::linesOfParagraph ( int para ) const"Returns the number of lines in paragraph \fIpara\fR..SH "bool QTextEdit::linkUnderline () const"Returns TRUE if hypertext links will be underlined; otherwise returns FALSE. See the "linkUnderline" property for details..SH "QMimeSourceFactory * QTextEdit::mimeSourceFactory () const"Returns the QMimeSourceFactory which is currently used by this text edit..PPSee also setMimeSourceFactory()..PPExamples:.)l helpviewer/helpwindow.cpp and qdir/qdir.cpp..SH "void QTextEdit::modificationChanged ( bool m )\fC [signal]\fR"This signal is emitted when the modification of the document changed. If \fIm\fR is TRUE, the document was modified, otherwise the modification state has been reset to unmodified..PPSee also modified..SH "void QTextEdit::moveCursor ( CursorAction action, bool select )\fC [virtual slot]\fR"Moves the text cursor according to \fIaction\fR. This is normally used by some key event handler. \fIselect\fR specifies whether the text between the current cursor position and the new position should be selected..SH "QBrush QTextEdit::paper () const"Returns the background (paper) brush. See the "paper" property for details..SH "int QTextEdit::paragraphAt ( const QPoint & pos ) const"Returns the paragraph which is at position \fIpos\fR (in contents coordinates), or -1 if there is no paragraph at \fIpos\fR..SH "QColor QTextEdit::paragraphBackgroundColor ( int para ) const"Returns the background color of the paragraph \fIpara\fR or an invalid color if \fIpara\fR is out of range or the paragraph has no background set.SH "int QTextEdit::paragraphLength ( int para ) const"Returns the length of the paragraph \fIpara\fR (number of characters).SH "QRect QTextEdit::paragraphRect ( int para ) const"Returns the rectangle of the paragraph \fIpara\fR in contents coordinates, or an invalid rectangle if \fIpara\fR is out of range..SH "int QTextEdit::paragraphs () const"Returns the number of paragraphs in the text..SH "void QTextEdit::paste ()\fC [virtual slot]\fR"Pastes the text from the clipboard into the text edit at the current cursor position. Only plain text is pasted..PPIf there is no text in the clipboard nothing happens..PPSee also pasteSubType(), cut() and QTextEdit::copy()..SH "void QTextEdit::pasteSubType ( const QCString & subtype )\fC [virtual slot]\fR"Pastes the text with format \fIsubtype\fR from the clipboard into the text edit at the current cursor position. The \fIsubtype\fR can be" plain" or "html"..PPIf there is no text with format \fIsubtype\fR in the clipboard nothing happens..PPSee also paste(), cut() and QTextEdit::copy()..SH "void QTextEdit::placeCursor ( const QPoint & pos, QTextCursor * c = 0 )\fC [virtual slot]\fR"Places the cursor \fIc\fR at the character which is closest to position \fIpos\fR (in contents coordinates). If \fIc\fR is 0, the default text cursor is used..PPSee also setCursorPosition()..SH "int QTextEdit::pointSize () const"Returns the point size of the font of the current format..PPSee also setFamily(), setCurrentFont() and setPointSize()..SH "void QTextEdit::redo ()\fC [virtual slot]\fR"Redoes the last operation..PPIf there is no operation to redo, e.g. there is no redo step in the undo/redo history, nothing happens..PPSee also redoAvailable(), undo() and undoDepth..SH "void QTextEdit::redoAvailable ( bool yes )\fC [signal]\fR"This signal is emitted when the availability of redo changes. If \fIyes\fR is TRUE, then redo() will work until redoAvailable( FALSE ) is next emitted..PPSee also redo() and undoDepth..SH "void QTextEdit::removeParagraph ( int para )\fC [virtual slot]\fR"Removes the paragraph \fIpara\fR.SH "void QTextEdit::removeSelectedText ( int selNum = 0 )\fC [virtual slot]\fR"Deletes the selected text (i.e. the default selection's text) of the selection \fIselNum\fR (by default, 0). If there is no selected text nothing happens..PPSee also selectedText and removeSelection()..SH "void QTextEdit::removeSelection ( int selNum = 0 )\fC [virtual slot]\fR"Removes the selection \fIselNum\fR (by default 0). This does not remove the selected text..PPSee also removeSelectedText()..SH "void QTextEdit::repaintChanged ()\fC [protected]\fR"Repaints any paragraphs that have changed..PPAlthough used extensively internally you shouldn't need to call this yourself..SH "void QTextEdit::returnPressed ()\fC [signal]\fR"This signal is emitted if the user pressed the Return or the Enter key..SH "void QTextEdit::scrollToAnchor ( const QString & name )\fC [virtual slot]\fR"Scrolls the text edit to make the text at the anchor called \fIname\fR visible, if it can be found in the document. If the anchor isn't found no scrolling will occur. An anchor is defined using the HTML anchor tag, e.g. \fC<a name="target">\fR..SH "void QTextEdit::scrollToBottom ()\fC [virtual slot]\fR"Scrolls to the bottom of the document and does formatting if required.SH "void QTextEdit::selectAll ( bool select = TRUE )\fC [virtual slot]\fR"If \fIselect\fR is TRUE (the default), all the text is selected as selection 0. If \fIselect\fR is FALSE any selected text is unselected, i.e., the default selection (selection 0) is cleared..PPSee also selectedText..SH "QString QTextEdit::selectedText () const"Returns the selected text (from selection 0) or an empty string if there is no currently selected text (in selection 0). See the "selectedText" property for details..SH "void QTextEdit::selectionChanged ()\fC [signal]\fR"This signal is emitted whenever the selection changes..PPSee also setSelection() and copyAvailable()..SH "void QTextEdit::setAlignment ( int a )\fC [virtual slot]\fR"Sets the alignment of the current paragraph to \fIa\fR. Valid alignments are Qt::AlignLeft, Qt::AlignRight, Qt::AlignJustify and Qt::AlignCenter (which centers horizontally)..PPSee also setParagType()..PPReimplemented in QMultiLineEdit..SH "void QTextEdit::setBold ( bool b )\fC [virtual slot]\fR"If \fIb\fR is TRUE sets the current format to bold; otherwise sets the current format to non-bold..PPSee also bold()..SH "void QTextEdit::setColor ( const QColor & c )\fC [virtual slot]\fR"Sets the color of the current format, i.e. of the text, to \fIc\fR..PPSee also color() and paper..PPExample: action/actiongroup/editor.cpp..SH "void QTextEdit::setCurrentFont ( const QFont & f )\fC [virtual slot]\fR"Sets the font of the current format to \fIf\fR..PPSee also font(), setPointSize() and setFamily()..SH "void QTextEdit::setCursorPosition ( int para, int index )\fC [virtual slot]\fR"Sets the cursor to position \fIindex\fR in paragraph \fIpara\fR..PPSee also getCursorPosition()..SH "void QTextEdit::setFamily ( const QString & fontFamily )\fC [virtual slot]\fR"Sets the font family of the current format to \fIfontFamily\fR..PPSee also family() and setCurrentFont()..SH "void QTextEdit::setItalic ( bool b )\fC [virtual slot]\fR"If \fIb\fR is TRUE sets the current format to italic; otherwise sets the current format to non-italic..PPSee also italic()..SH "void QTextEdit::setLinkUnderline ( bool )\fC [virtual slot]\fR"Sets whether hypertext links will be underlined. See the "linkUnderline" property for details..SH "void QTextEdit::setMimeSourceFactory ( QMimeSourceFactory * factory )\fC [virtual slot]\fR"Sets the text edit's mimesource factory to \fIfactory\fR. See QMimeSourceFactory for further details..PPSee also mimeSourceFactory()..SH "void QTextEdit::setModified ( bool m )\fC [virtual slot]\fR"Sets whether the document has been modified by the user to \fIm\fR. See the "modified" property for details..SH "void QTextEdit::setOverwriteMode ( bool b )\fC [virtual slot]\fR"Sets the text edit's overwrite mode to \fIb\fR. See the "overwriteMode" property for details..SH "void QTextEdit::setPaper ( const QBrush & pap )\fC [virtual slot]\fR"Sets the background (paper) brush to \fIpap\fR. See the "paper" property for details..SH "void QTextEdit::setParagType ( QStyleSheetItem::DisplayMode dm, QStyleSheetItem::ListStyle listStyle )\fC [virtual slot]\fR"Sets the paragraph style of the current paragraph to \fIdm\fR. If \fIdm\fR is QStyleSheetItem::DisplayListItem, the type of the list item is set to \fIlistStyle\fR..PPSee also setAlignment()..SH "void QTextEdit::setParagraphBackgroundColor ( int para, const QColor & bg )\fC [virtual slot]\fR"Sets the background color of the paragraph \fIpara\fR to \fIbg\fR.SH "void QTextEdit::setPointSize ( int s )\fC [virtual slot]\fR"Sets the point size of the current format to \fIs\fR..PPNote that if \fIs\fR is zero or negative, the behaviour of this function is not defined..PPSee also pointSize(), setCurrentFont() and setFamily().
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -