⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtextedit.3qt

📁 qt专门用于嵌入式的图形开发GUI
💻 3QT
📖 第 1 页 / 共 5 页
字号:
\fCQTextEdit::Anywhere\fR - Break anywhere, including within words..TP\fCQTextEdit::AtWordBoundary\fR - Break lines at word boundaries, e.g. spaces or newlines.TP\fCQTextEdit::AtWordOrDocumentBoundary\fR - Break lines at whitespace, e.g. spaces or newlines if possible. Break it anywhere otherwise..PPSee also wrapPolicy..SH MEMBER FUNCTION DOCUMENTATION.SH "QTextEdit::QTextEdit ( const QString & text, const QString & context = QString::null, QWidget * parent = 0, const char * name = 0 )"Constructs a QTextEdit called \fIname\fR, with parent \fIparent\fR. The text edit will display the text \fItext\fR using context \fIcontext\fR..PPThe \fIcontext\fR is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images. It is passed to the mimeSourceFactory() when quering data..PPFor example if the text contains an image tag, \fC<img src="image.png">\fR, and the context is "path/to/look/in", the QMimeSourceFactory will try to load the image from" path/to/look/in/image.png". If the tag was \fC<img src="/image.png">\fR, the context will not be used (because QMimeSourceFactory recognizes that we have used an absolute path) and will try to load "/image.png". The context is applied in exactly the same way to \fIhrefs\fR, for example, \fC<a href="target.html">Target</a>\fR, would resolve to" path/to/look/in/target.html"..SH "QTextEdit::QTextEdit ( QWidget * parent = 0, const char * name = 0 )"Constructs an empty QTextEdit called \fIname\fR, with parent \fIparent\fR..SH "int QTextEdit::alignment () const"Returns the alignment of the current paragraph..PPSee also setAlignment()..SH "QString QTextEdit::anchorAt ( const QPoint & pos, AnchorAttribute attr )"If there is an anchor at position \fIpos\fR (in contents coordinates), the text for attribute \fIattr\fR is returned, otherwise QString::null is returned..SH "QString QTextEdit::anchorAt ( const QPoint & pos )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPIf there is an anchor at position \fIpos\fR (in contents coordinates), its \fChref\fR is returned, otherwise QString::null is returned..SH "void QTextEdit::append ( const QString & text )\fC [virtual slot]\fR"Appends a new paragraph with \fItext\fR to the end of the text edit. Note that the undo/redo history is cleared by this function, and no undo history is kept for appends which makes them faster than insert()s. If you want to append text which is added to the undo/redo history as well, use insertParagraph()..PPExamples:.)l network/clientserver/client/client.cpp, network/clientserver/server/server.cpp, network/httpd/httpd.cpp, and process/process.cpp..SH "uint QTextEdit::autoFormatting () const"Returns the enabled set of auto formatting features. See the "autoFormatting" property for details..SH "bool QTextEdit::bold () const"Returns TRUE if the current format is bold; otherwise returns FALSE..PPSee also setBold()..SH "int QTextEdit::charAt ( const QPoint & pos, int * para ) const"Returns the index of the character (relative to its paragraph) at position \fIpos\fR (in contents coordinates). If \fIpara\fR is not 0, \fI*para\fR is set to the character's paragraph..SH "void QTextEdit::clear ()\fC [virtual slot]\fR"Deletes all the text in the text edit..PPSee also cut(), removeSelectedText(), and text..SH "void QTextEdit::clearParagraphBackground ( int para )\fC [virtual slot]\fR"Clears the background color of the paragraph \fIpara\fR, so that the default color is used again..SH "void QTextEdit::clicked ( int para, int pos )\fC [signal]\fR"This signal is emitted when the mouse is clicked on the paragraph \fIpara\fR at character position \fIpos\fR..PPSee also doubleClicked()..SH "QColor QTextEdit::color () const"Returns the color of the current format..PPSee also setColor() and paper..SH "QString QTextEdit::context () const"Returns the context of the text edit. The context is a path which the text edit's QMimeSourceFactory uses to resolve the locations of files and images..PPSee also text..PPExamples:.)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp..SH "void QTextEdit::copy ()\fC [virtual slot]\fR"Copies any selected text (from selection 0) to the clipboard..PPSee also hasSelectedText and copyAvailable()..SH "void QTextEdit::copyAvailable ( bool yes )\fC [signal]\fR"This signal is emitted when text is selected or de-selected in the text edit..PPWhen text is selected this signal will be emitted with \fIyes\fR set to TRUE. If no text has been selected or if the selected text is de-selected this signal is emitted with \fIyes\fR set to FALSE..PPIf \fIyes\fR is TRUE then copy() can be used to copy the selection to the clipboard. If \fIyes\fR is FALSE then copy() does nothing..PPSee also selectionChanged()..SH "QPopupMenu * QTextEdit::createPopupMenu ( const QPoint & pos )\fC [virtual protected]\fR"This function is called to create a right mouse button popup menu at the document position \fIpos\fR. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller..PP\fBWarning:\fR The QPopupMenu ID values 0-7 are reserved, and they map to the standard operations. When inserting items into your custom popup menu, be sure to specify ID values larger than 7..SH "QPopupMenu * QTextEdit::createPopupMenu ()\fC [virtual protected]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PP\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPThis function is called to create a right mouse button popup menu. If you want to create a custom popup menu, reimplement this function and return the created popup menu. Ownership of the popup menu is transferred to the caller..PPThis function is only called if createPopupMenu( const QPoint & ) returns 0..SH "void QTextEdit::currentAlignmentChanged ( int a )\fC [signal]\fR"This signal is emitted if the alignment of the current paragraph has changed..PPThe new alignment is \fIa\fR..PPSee also setAlignment()..SH "void QTextEdit::currentColorChanged ( const QColor & c )\fC [signal]\fR"This signal is emitted if the color of the current format has changed..PPThe new color is \fIc\fR..PPSee also setColor()..SH "QFont QTextEdit::currentFont () const"Returns the font of the current format..PPSee also setCurrentFont(), setFamily(), and setPointSize()..SH "void QTextEdit::currentFontChanged ( const QFont & f )\fC [signal]\fR"This signal is emitted if the font of the current format has changed..PPThe new font is \fIf\fR..PPSee also setCurrentFont()..SH "void QTextEdit::currentVerticalAlignmentChanged ( VerticalAlignment a )\fC [signal]\fR"This signal is emitted if the vertical alignment of the current format has changed..PPThe new vertical alignment is \fIa\fR..PPSee also setVerticalAlignment()..SH "void QTextEdit::cursorPositionChanged ( int para, int pos )\fC [signal]\fR"This signal is emitted if the position of the cursor has 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::doubleClicked ( int para, int pos )\fC [signal]\fR"This signal is emitted when the mouse is double-clicked on the paragraph \fIpara\fR at character position \fIpos\fR..PPSee also clicked()..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. Returns TRUE if \fIexpr\fR was found; otherwise returns FALSE..PPIf \fIpara\fR and \fIindex\fR are both 0 the search begins from the current cursor position. If \fIpara\fR and \fIindex\fR are both not 0, the search begins from the \fI*index\fR character position in the \fI*para\fR paragraph..PPIf \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. If \fIindex\fR and \fIpara\fR are not 0, the number of the paragraph in which the first character of the match was found is put into \fI*para\fR, and the index position of that character within the paragraph is put into \fI*index\fR..PPIf \fIexpr\fR is not found the function returns FALSE. If \fIindex\fR and \fIpara\fR are not 0 and \fIexpr\fR is not found, \fI*index\fR and \fI*para\fR are undefined..PPPlease note that this function will make the next occurrence of the string (if found) the current selection, and will thus modify the cursor position..PPUsing the \fIpara\fR and \fIindex\fR parameters will not work correctly in case the document contains tables..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"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPReturns QScrollView::font().PP\fBWarning:\fR In previous versions this function returned the font of the current format. This lead to confusion. Please use currentFont() instead..PPExample: qwerty/qwerty.cpp..SH "void QTextEdit::getCursorPosition ( int * para, int * index ) const"This function sets the \fI*para\fR and \fI*index\fR parameters to the current cursor position. \fIpara\fR and \fIindex\fR must not be 0..PPSee also setCursorPosition()..SH "void QTextEdit::getSelection ( int * paraFrom, int * indexFrom, int * paraTo, int * indexTo, int selNum = 0 ) const"If there is a selection, \fI*paraFrom\fR is set to the number of the paragraph in which the selection begins and \fI*paraTo\fR is set to the number of the paragraph in which the selection ends. (They could be the same.) \fI*indexFrom\fR is set to the index at which the selection begins within \fI*paraFrom\fR, and \fI*indexTo\fR is set to the index at which the selection ends within \fI*paraTo\fR..PPIf there is no selection, \fI*paraFrom\fR, \fI*indexFrom\fR, \fI*paraTo\fR and \fI*indexTo\fR are all set to -1..PPIf \fIparaFrom\fR, \fIindexFrom\fR, \fIparaTo\fR or \fIindexTo\fR is 0 this function does nothing..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::insert ( const QString & text, uint insertionFlags = CheckNewLines | RemoveSelected )\fC [slot]\fR"Inserts \fItext\fR at the current cursor position..PPThe \fIinsertionFlags\fR define how the text is inserted. If RedoIndentation is set, the paragraph is re-indented. If CheckNewLines is set, newline characters in \fItext\fR result in hard line breaks (i.e. new paragraphs). If \fCcheckNewLine\fR is not set, the behaviour of the editor is undefined if the \fItext\fR contains newlines. (It is not possible to change QTextEdit's newline handling behavior, but you can use QString::replace() to preprocess text before inserting it.) If RemoveSelected is set, any selected text (in selection 0) is removed before the text is inserted..PPThe default flags are CheckNewLines | RemoveSelected..PPIf the widget is in LogText mode this function will do nothing..PPSee also paste() and pasteSubType()..SH "void QTextEdit::insert ( const QString & text, bool indent, bool checkNewLine = TRUE, bool removeSelected = TRUE )\fC [virtual slot]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..SH "void QTextEdit::insertAt ( const QString & text, int para, int index )\fC [virtual slot]\fR"Inserts \fItext\fR in the paragraph \fIpara\fR at position \fIindex\fR..SH "void QTextEdit::insertParagraph ( const QString & text, int para )\fC [virtual slot]\fR"Inserts \fItext\fR as a new paragraph at position \fIpara\fR. If \fIpara\fR is -1, the text is appended. Use append() if the append operation is performance critical..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 TRUE if redo is available; otherwise returns FALSE..SH "bool QTextEdit::isUndoAvailable () const"Returns TRUE if undo is available; otherwise returns FALSE..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; this could be 0..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..SH "int QTextEdit::linesOfParagraph ( int para ) const"Returns the number of lines in paragraph \fIpara\fR, or -1 if there is no paragraph with index \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 "int QTextEdit::maxLogLines ()\fC [slot]\fR"Returns the maximum number of lines QTextEdit can hold in LogText mode. By default the number of lines is unlimited, which is signified by a value of -1..SH "QMimeSourceFactory * QTextEdit::mimeSourceFactory () const"Returns the QMimeSourceFactory which is being used by this text edit..PPSee also setMimeSourceFactory()..PPExamples:.)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, and qdir/qdir.cpp..SH "void QTextEdit::modificationChanged ( bool m )\fC [signal]\fR"This signal is emitted when the modification status of the document has 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).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -