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

📄 qtextedit.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
📖 第 1 页 / 共 5 页
字号:
.BI "virtual void \fBindent\fR ()".br.ti -1c.BI "virtual void \fBsetItalic\fR ( bool b )".br.ti -1c.BI "virtual void \fBsetBold\fR ( bool b )".br.ti -1c.BI "virtual void \fBsetUnderline\fR ( bool b )".br.ti -1c.BI "virtual void \fBsetFamily\fR ( const QString & fontFamily )".br.ti -1c.BI "virtual void \fBsetPointSize\fR ( int s )".br.ti -1c.BI "virtual void \fBsetColor\fR ( const QColor & c )".br.ti -1c.BI "virtual void \fBsetVerticalAlignment\fR ( VerticalAlignment a )".br.ti -1c.BI "virtual void \fBsetAlignment\fR ( int a )".br.ti -1c.BI "virtual void \fBsetParagType\fR ( QStyleSheetItem::DisplayMode dm, QStyleSheetItem::ListStyle listStyle )".br.ti -1c.BI "virtual void \fBsetCursorPosition\fR ( int para, int index )".br.ti -1c.BI "virtual void \fBsetSelection\fR ( int paraFrom, int indexFrom, int paraTo, int indexTo, int selNum = 0 )".br.ti -1c.BI "virtual void \fBsetSelectionAttributes\fR ( int selNum, const QColor & back, bool invertText )".br.ti -1c.BI "virtual void \fBsetModified\fR ( bool m )".br.ti -1c.BI "virtual void \fBsetUndoDepth\fR ( int d )".br.ti -1c.BI "virtual void \fBensureCursorVisible\fR ()".br.ti -1c.BI "virtual void \fBplaceCursor\fR ( const QPoint & pos, QTextCursor * c = 0 )".br.ti -1c.BI "virtual void \fBmoveCursor\fR ( CursorAction action, bool select )".br.ti -1c.BI "virtual void \fBdoKeyboardAction\fR ( KeyboardAction action )".br.ti -1c.BI "virtual void \fBremoveSelectedText\fR ( int selNum = 0 )".br.ti -1c.BI "virtual void \fBremoveSelection\fR ( int selNum = 0 )".br.ti -1c.BI "virtual void \fBsetCurrentFont\fR ( const QFont & f )".br.ti -1c.BI "virtual void \fBsetOverwriteMode\fR ( bool b )".br.ti -1c.BI "virtual void \fBscrollToBottom\fR ()".br.ti -1c.BI "virtual void \fBinsert\fR ( const QString & text, bool indent = FALSE, bool checkNewLine = TRUE, bool removeSelected = TRUE )".br.ti -1c.BI "virtual void \fBinsertAt\fR ( const QString & text, int para, int index )".br.ti -1c.BI "virtual void \fBremoveParagraph\fR ( int para )".br.ti -1c.BI "virtual void \fBinsertParagraph\fR ( const QString & text, int para )".br.ti -1c.BI "virtual void \fBsetParagraphBackgroundColor\fR ( int para, const QColor & bg )".br.ti -1c.BI "virtual void \fBclearParagraphBackground\fR ( int para )".br.ti -1c.BI "virtual void \fBsetUndoRedoEnabled\fR ( bool b )".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBtextChanged\fR ()".br.ti -1c.BI "void \fBselectionChanged\fR ()".br.ti -1c.BI "void \fBcopyAvailable\fR ( bool yes )".br.ti -1c.BI "void \fBundoAvailable\fR ( bool yes )".br.ti -1c.BI "void \fBredoAvailable\fR ( bool yes )".br.ti -1c.BI "void \fBcurrentFontChanged\fR ( const QFont & f )".br.ti -1c.BI "void \fBcurrentColorChanged\fR ( const QColor & c )".br.ti -1c.BI "void \fBcurrentAlignmentChanged\fR ( int a )".br.ti -1c.BI "void \fBcurrentVerticalAlignmentChanged\fR ( VerticalAlignment a )".br.ti -1c.BI "void \fBcursorPositionChanged\fR ( QTextCursor * c )".br.ti -1c.BI "void \fBcursorPositionChanged\fR ( int para, int pos )".br.ti -1c.BI "void \fBreturnPressed\fR ()".br.ti -1c.BI "void \fBmodificationChanged\fR ( bool m )".br.in -1c.SS "Properties".in +1c.ti -1c.BI "QString \fBdocumentTitle\fR - the title of the document parsed from the text  \fI(read " "only" ")\fR".br.ti -1c.BI "bool \fBhasSelectedText\fR - whether some text is selected in selection 0  \fI(read " "only" ")\fR".br.ti -1c.BI "int \fBlength\fR - the number of characters in the text  \fI(read " "only" ")\fR".br.ti -1c.BI "bool \fBlinkUnderline\fR - whether hypertext links will be underlined".br.ti -1c.BI "bool \fBmodified\fR - whether the document has been modified by the user".br.ti -1c.BI "bool \fBoverwriteMode\fR - the text edit's overwrite mode".br.ti -1c.BI "QBrush \fBpaper\fR - the background (paper) brush".br.ti -1c.BI "bool \fBreadOnly\fR - whether the text edit is read-only".br.ti -1c.BI "QString \fBselectedText\fR - the selected text (from selection " "0" ") or an empty string if there is no currently selected text (in selection " "0" ")  \fI(read " "only" ")\fR".br.ti -1c.BI "QString \fBtext\fR - the text edit's text".br.ti -1c.BI "TextFormat \fBtextFormat\fR - the text format: rich " "text" ", plain text or auto text".br.ti -1c.BI "int \fBundoDepth\fR - the depth of the undo history".br.ti -1c.BI "bool \fBundoRedoEnabled\fR - whether undo/redo is enabled".br.ti -1c.BI "WordWrap \fBwordWrap\fR - the word wrap mode".br.ti -1c.BI "int \fBwrapColumnOrWidth\fR - the position (in pixels or columns depending on the wrap " "mode" ") where text will be wrapped".br.ti -1c.BI "WrapPolicy \fBwrapPolicy\fR - the word wrap " "policy" ", at whitespace or anywhere".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "void \fBrepaintChanged\fR ()".br.ti -1c.BI "void \fBupdateStyles\fR ()".br.ti -1c.BI "virtual void \fBkeyPressEvent\fR ( QKeyEvent * e )".br.ti -1c.BI "virtual bool \fBfocusNextPrevChild\fR ( bool n )".br.ti -1c.BI "QTextCursor * \fBtextCursor\fR () const".br.ti -1c.BI "virtual QPopupMenu * \fBcreatePopupMenu\fR ( const QPoint & pos )".br.ti -1c.BI "virtual QPopupMenu * \fBcreatePopupMenu\fR ()".br.in -1c.SH DESCRIPTIONThe QTextEdit widget provides a sophisticated single-page rich text editor..PPQTextEdit is an advanced WYSIWYG editor supporting rich text formatting. It is optimized to handle large documents and to respond quickly to user input..PPInternally QTextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. The words in the paragraph are aligned in accordance with the paragraph's alignment(). Paragraphs are separated by hard line breaks. Each character within a paragraph has its own attributes, for example, font and color..PPQTextEdit can display images (using QMimeSourceFactory), lists and tables. If the text is too large to view within the text edit's viewport, scrollbars will appear. The text edit can load both plain text and HTML files (a subset of HTML 3.2 and 4). The rendering style and the set of valid tags are defined by a styleSheet(). Change the style sheet with setStyleSheet(); see QStyleSheet for details. The images identified by image tags are displayed if they can be interpreted using the text edit's QMimeSourceFactory; see setMimeSourceFactory()..PPIf you want a text browser with more navigation use QTextBrowser. If you just need to display a small piece of rich text use QLabel or QSimpleRichText..PPIf you create a new QTextEdit, and want to allow the user to edit rich text, call setTextFormat(Qt::RichText) to ensure that the text is treated as rich text. (Rich text uses HTML tags to set text formatting attributes. See QStyleSheet for information on the HTML tags that are supported.). If you don't call setTextFormat() explicitly the text edit will guess from the text itself whether it is rich text or plain text..PPThe text edit documentation uses the following concepts:.TP\fIcurrent format\fR -- this is the format at the current cursor position, \fIand\fR it is the format of the selected text if any..TP\fIcurrent paragraph\fR -- the paragraph which contains the cursor..PPThe text is set or replaced using setText() which deletes any existing text and replaces it with the text passed in the setText() call. Text can be inserted with insert(), paste() and pasteSubType(). Text can also be cut(). The entire text is deleted with clear() and the selected text is deleted with removeSelectedText(). Selected (marked) text can also be deleted with del() (which will delete the character to the right of the cursor if no text is selected)..PPThe current format's attributes are set with setItalic(), setBold(), setUnderline(), setFamily() (font family), setPointSize(), setColor() and setCurrentFont(). The current paragraph's style is set with setParagType() and its alignment is set with setAlignment()..PPUse setSelection() to select text. The setSelectionAttributes() function is used to indicate how selected text should be displayed. Use hasSelectedText() to find out if any text is selected. The currently selected text's position is available using getSelection() and the selected text itself is returned by selectedText(). The selection can be copied to the clipboard with copy(), or cut to the clipboard with cut(). It can be deleted with removeSelectedText(). The entire text can be selected (or unselected) using selectAll(). QTextEdit supports multiple selections. Most of the selection functions operate on the default selection, selection 0..PPSet and get the position of the cursor with setCursorPosition() and getCursorPosition() respectively. When the cursor is moved, the signals currentFontChanged(), currentColorChanged() and currentAlignmentChanged() are emitted to reflect the font, color and alignment at the new cursor position..PPIf the text changes, the textChanged() signal is emitted, and if the user inserts a new line by pressing Return or Enter, returnPressed() is emitted. The isModified() function will return TRUE if the text has been modified..PPQTextEdit provides command-based undo and redo. To set the depth of the command history use setUndoDepth() which defaults to 100 steps. To undo or redo the last operation call undo() or redo(). The signals undoAvailable() and redoAvailable() indicate whether the undo and redo operations can be executed..PPThe indent() function is used to reindent a paragraph. It is useful for code editors, for example in \fIQt Designer\fR's code editor \fICtrl+I\fR invokes the indent() function..PPLoading and saving text is achieved using setText() and text(), for example:.PP.nf.br    QFile file( fileName ); // Read the text from a file.br    if ( file.open( IO_ReadOnly ) ) {.br        QTextStream ts( &file );.br        textEdit->setText( ts.read() );.br    }.br.fi.PP.nf.br    QFile file( fileName ); // Write the text to a file.br    if ( file.open( IO_WriteOnly ) ) {.br        QTextStream ts( &file );.br        ts << textEdit->text();.br

⌨️ 快捷键说明

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