<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # QTextEdit Class Reference ## [[QtGui](index.htm) module] 該的QTextEdit類提供用于編輯和顯示兩個平原和豐富的文本控件。[More...](#details) 繼承[QAbstractScrollArea](qabstractscrollarea.html)。 通過繼承[QTextBrowser](qtextbrowser.html)。 ### Types * `class **[AutoFormatting](index.htm)**` * `enum AutoFormattingFlag { AutoNone, AutoBulletList, AutoAll }` * `class **[ExtraSelection](index.htm)**` * `enum LineWrapMode { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }` ### Methods * `__init__ (self, QWidget?parent?=?None)` * `__init__ (self, QString?text, QWidget?parent?=?None)` * `bool acceptRichText (self)` * `Qt.Alignment alignment (self)` * `QString anchorAt (self, QPoint?pos)` * `append (self, QString?text)` * `AutoFormatting autoFormatting (self)` * `bool canInsertFromMimeData (self, QMimeData?source)` * `bool canPaste (self)` * `changeEvent (self, QEvent?e)` * `clear (self)` * `contextMenuEvent (self, QContextMenuEvent?e)` * `copy (self)` * `QMimeData createMimeDataFromSelection (self)` * `QMenu createStandardContextMenu (self)` * `QMenu createStandardContextMenu (self, QPoint?position)` * `QTextCharFormat currentCharFormat (self)` * `QFont currentFont (self)` * `QTextCursor cursorForPosition (self, QPoint?pos)` * `QRect cursorRect (self, QTextCursor?cursor)` * `QRect cursorRect (self)` * `int cursorWidth (self)` * `cut (self)` * `QTextDocument document (self)` * `QString documentTitle (self)` * `dragEnterEvent (self, QDragEnterEvent?e)` * `dragLeaveEvent (self, QDragLeaveEvent?e)` * `dragMoveEvent (self, QDragMoveEvent?e)` * `dropEvent (self, QDropEvent?e)` * `ensureCursorVisible (self)` * `bool event (self, QEvent?e)` * `list-of-QTextEdit.ExtraSelection extraSelections (self)` * `bool find (self, QString?exp, QTextDocument.FindFlags?options?=?0)` * `focusInEvent (self, QFocusEvent?e)` * `bool focusNextPrevChild (self, bool?next)` * `focusOutEvent (self, QFocusEvent?e)` * `QString fontFamily (self)` * `bool fontItalic (self)` * `float fontPointSize (self)` * `bool fontUnderline (self)` * `int fontWeight (self)` * `inputMethodEvent (self, QInputMethodEvent)` * `QVariant inputMethodQuery (self, Qt.InputMethodQuery?property)` * `insertFromMimeData (self, QMimeData?source)` * `insertHtml (self, QString?text)` * `insertPlainText (self, QString?text)` * `bool isReadOnly (self)` * `bool isUndoRedoEnabled (self)` * `keyPressEvent (self, QKeyEvent?e)` * `keyReleaseEvent (self, QKeyEvent?e)` * `int lineWrapColumnOrWidth (self)` * `LineWrapMode lineWrapMode (self)` * `QVariant loadResource (self, int?type, QUrl?name)` * `mergeCurrentCharFormat (self, QTextCharFormat?modifier)` * `mouseDoubleClickEvent (self, QMouseEvent?e)` * `mouseMoveEvent (self, QMouseEvent?e)` * `mousePressEvent (self, QMouseEvent?e)` * `mouseReleaseEvent (self, QMouseEvent?e)` * `moveCursor (self, QTextCursor.MoveOperation?operation, QTextCursor.MoveMode?mode?=?QTextCursor.MoveAnchor)` * `bool overwriteMode (self)` * `paintEvent (self, QPaintEvent?e)` * `paste (self)` * `print (self, QPrinter?printer)` * `print_ (self, QPrinter?printer)` * `redo (self)` * `resizeEvent (self, QResizeEvent)` * `scrollContentsBy (self, int?dx, int?dy)` * `scrollToAnchor (self, QString?name)` * `selectAll (self)` * `setAcceptRichText (self, bool?accept)` * `setAlignment (self, Qt.Alignment?a)` * `setAutoFormatting (self, AutoFormatting?features)` * `setCurrentCharFormat (self, QTextCharFormat?format)` * `setCurrentFont (self, QFont?f)` * `setCursorWidth (self, int?width)` * `setDocument (self, QTextDocument?document)` * `setDocumentTitle (self, QString?title)` * `setExtraSelections (self, list-of-QTextEdit.ExtraSelection?selections)` * `setFontFamily (self, QString?fontFamily)` * `setFontItalic (self, bool?b)` * `setFontPointSize (self, float?s)` * `setFontUnderline (self, bool?b)` * `setFontWeight (self, int?w)` * `setHtml (self, QString?text)` * `setLineWrapColumnOrWidth (self, int?w)` * `setLineWrapMode (self, LineWrapMode?mode)` * `setOverwriteMode (self, bool?overwrite)` * `setPlainText (self, QString?text)` * `setReadOnly (self, bool?ro)` * `setTabChangesFocus (self, bool?b)` * `setTabStopWidth (self, int?width)` * `setText (self, QString?text)` * `setTextBackgroundColor (self, QColor?c)` * `setTextColor (self, QColor?c)` * `setTextCursor (self, QTextCursor?cursor)` * `setTextInteractionFlags (self, Qt.TextInteractionFlags?flags)` * `setUndoRedoEnabled (self, bool?enable)` * `setWordWrapMode (self, QTextOption.WrapMode?policy)` * `showEvent (self, QShowEvent)` * `bool tabChangesFocus (self)` * `int tabStopWidth (self)` * `QColor textBackgroundColor (self)` * `QColor textColor (self)` * `QTextCursor textCursor (self)` * `Qt.TextInteractionFlags textInteractionFlags (self)` * `timerEvent (self, QTimerEvent?e)` * `QString toHtml (self)` * `QString toPlainText (self)` * `undo (self)` * `wheelEvent (self, QWheelEvent?e)` * `QTextOption.WrapMode wordWrapMode (self)` * `zoomIn (self, int?range?=?1)` * `zoomOut (self, int?range?=?1)` ### Qt Signals * `void copyAvailable (bool)` * `void currentCharFormatChanged (const QTextCharFormat&)` * `void cursorPositionChanged ()` * `void redoAvailable (bool)` * `void selectionChanged ()` * `void textChanged ()` * `void undoAvailable (bool)` * * * ## Detailed Description 該的QTextEdit類提供用于編輯和顯示兩個平原和豐富的文本控件。 ### Introduction and Concepts 的QTextEdit是一種先進的所見即所得的瀏覽器/編輯器,支持豐富的文本格式使用HTML風格的標籤。這是優化處理大型文件,并快速響應用戶輸入。 QTextEdit一起工作的段落和字符。一個段落是一個格式化字符串,它是自動換行以適應窗口部件的寬度。通過閱讀純文本時,默認情況下,有一個換行符表示一個段落。文檔包含零個或多個段落。段落中的單詞排列按照段落的對齊方式。段落是由硬換行符分隔。一個段內的每個字符具有其自己的屬性,例如,字體和顏色。 的QTextEdit可以顯示圖像,列表和表格。如果文本太大無法查看文本編輯的視口內,滾動條就會出現。文本編輯可以加載純文本和HTML文件( HTML 3.2的子集和4 ) 。 如果你只是需要顯示一小塊富文本使用[QLabel](qlabel.html)。 在Qt的富文本支持旨在提供一種快速,便攜,高效的方式來合理的在線幫助工具添加到應用程序,并提供豐富的文本編輯器的基礎。如果您發現該HTML支持不足,為您的需求,您可以考慮使用[QtWebKit](index.htm),它提供了一個全功能的Web瀏覽器控件。 鼠標光標的上一個的QTextEdit的形狀是[Qt.IBeamCursor](qt.html#CursorShape-enum)在默認情況下。它可以通過改變該[viewport](qabstractscrollarea.html#viewport)( )的游標屬性。 ### Using QTextEdit as a Display Widget 的QTextEdit可以顯示一個大的HTML子集,包括表格和圖像。 全文載或更換使用[setHtml](qtextedit.html#html-prop)(),它會刪除任何現有文本,并與所傳遞的文本替換它[setHtml](qtextedit.html#html-prop)( )調用。如果你打電話[setHtml](qtextedit.html#html-prop)( )與傳統的HTML ,然后調用[toHtml](qtextedit.html#html-prop)( ) ,返回的文本可能有不同的標記,但會呈現相同的。整個文本可以被刪除[clear](qtextedit.html#clear)( ) 。 文本本身可以使用插入的[QTextCursor](qtextcursor.html)類或者使用的方便功能[insertHtml](qtextedit.html#insertHtml)( )[insertPlainText](qtextedit.html#insertPlainText)( )[append](qtextedit.html#append)()或[paste](qtextedit.html#paste)( ) 。[QTextCursor](qtextcursor.html)也能像插入表格或列表的復雜對象插入到文檔中,它處理創建的選擇和應用更改選定的文本。 默認情況下,文本編輯換行的空白,以適應文本編輯窗口部件。該[setLineWrapMode](qtextedit.html#lineWrapMode-prop)( )函數是用來指定你想要的那種換行的,或[NoWrap](qtextedit.html#LineWrapMode-enum)如果你不希望任何包裝。通話[setLineWrapMode](qtextedit.html#lineWrapMode-prop)( )來設置一個固定像素寬度[FixedPixelWidth](qtextedit.html#LineWrapMode-enum),或字符列(例如80列)[FixedColumnWidth](qtextedit.html#LineWrapMode-enum)與指定的像素或列[setLineWrapColumnOrWidth](qtextedit.html#lineWrapColumnOrWidth-prop)( ) 。如果您使用自動換行到Widget的寬度[WidgetWidth](qtextedit.html#LineWrapMode-enum),您可以指定是否要與打破空白或任何地方[setWordWrapMode](qtextedit.html#wordWrapMode-prop)( ) 。 該[find](qtextedit.html#find)( )函數可以用來查找和選擇文本中給定的字符串。 如果你想限制在一個的QTextEdit段的總數,例如它往往是在日志查看器有用,那么你可以使用[QTextDocument](qtextdocument.html)的maximumBlockCount屬性的。 #### Read-only Key Bindings 當QTextEdit一起使用只讀的鍵綁定僅限于導航和文字可能只用鼠標進行選擇: | Keypresses | Action | | --- | --- | | Up | Moves one line up. | | Down | Moves one line down. | | Left | Moves one character to the left. | | Right | Moves one character to the right. | | PageUp | Moves one (viewport) page up. | | PageDown | Moves one (viewport) page down. | | Home | Moves to the beginning of the text. | | End | Moves to the end of the text. | | Alt+Wheel | Scrolls the page horizontally (the Wheel is the mouse wheel). | | Ctrl+Wheel | Zooms the text. | | Ctrl+A | Selects all text. | 文本編輯可能能夠提供一些元信息。例如,本[documentTitle](qtextedit.html#documentTitle-prop)( )函數將來自內部的HTML返回文本`&lt;title&gt;`標籤。 ### Using QTextEdit as an Editor 所有有關使用的QTextEdit作為一個顯示插件的信息也適用于這里。 目前char格式的屬性設置[setFontItalic](qtextedit.html#setFontItalic)( )[setFontWeight](qtextedit.html#setFontWeight)( )[setFontUnderline](qtextedit.html#setFontUnderline)( )[setFontFamily](qtextedit.html#setFontFamily)( )[setFontPointSize](qtextedit.html#setFontPointSize)( )[setTextColor](qtextedit.html#setTextColor)()和[setCurrentFont](qtextedit.html#setCurrentFont)( ) 。當前段落的對齊方式設置與[setAlignment](qtextedit.html#setAlignment)( ) 。 選擇文本是由處理[QTextCursor](qtextcursor.html)類,它用于創建選擇,檢索的文本內容或刪除選項提供的功能。你可以檢索與用戶可見的光標使用相對應的對象[textCursor](qtextedit.html#textCursor)()方法。如果你想設置一個選擇使用QTextEdit只需要建立一個上一個[QTextCursor](qtextcursor.html)對象,然后使該游標使用游標可見[setTextCursor](qtextedit.html#setTextCursor)( ) 。選擇可以復制到剪貼板[copy](qtextedit.html#copy)( ) ,或剪切到剪貼板[cut](qtextedit.html#cut)( ) 。整個文本可以使用選擇[selectAll](qtextedit.html#selectAll)( ) 。 當光標被移動和底層的格式屬性的變化,[currentCharFormatChanged](qtextedit.html#currentCharFormatChanged)()信號被發射,以反映新的光標位置處的新的屬性。 的QTextEdit持有[QTextDocument](qtextdocument.html)這可以使用被檢索對象的[document](qtextedit.html#document)()方法。您也可以使用設置自己的文檔對象[setDocument](qtextedit.html#setDocument)( ) 。[QTextDocument](qtextdocument.html)發出[textChanged](qtextedit.html#textChanged)( )信號,如果文本的變化,它也提供了一個[isModified](index.htm#isModified)( )函數,如果文本已經被修改,因為它是在加載或自上次調用SetModified之用False作為參數,該參數將返回True 。此外,它還提供了撤銷和重做的方法。 #### Drag and Drop 的QTextEdit還支持自定義拖放行為。默認情況下,會的QTextEdit當用戶刪除這些MIME類型的數據到一個文檔中插入純文本, HTML和RTF 。重新實現[canInsertFromMimeData](qtextedit.html#canInsertFromMimeData)()和[insertFromMimeData](qtextedit.html#insertFromMimeData)()來添加額外的MIME類型的支持。 例如,為了允許用戶拖放圖像投影到的QTextEdit ,你可以在以下面的方式實現這些功能: ``` bool TextEdit.canInsertFromMimeData( const [QMimeData](qmimedata.html) *source ) const { if (source->hasImage()) return true; else return QTextEdit.canInsertFromMimeData(source); } ``` 我們通過返回True添加圖像的MIME類型的支持。對于所有其他的MIME類型,我們使用默認的實現。 ``` void TextEdit.insertFromMimeData( const [QMimeData](qmimedata.html) *source ) { if (source->hasImage()) { [QImage](qimage.html) image = qvariant_cast<[QImage](qimage.html)>(source->imageData()); [QTextCursor](qtextcursor.html) cursor = this->textCursor(); [QTextDocument](qtextdocument.html) *document = this->document(); document->addResource([QTextDocument](qtextdocument.html).ImageResource, [QUrl](qurl.html)("image"), image); cursor.insertImage("image"); } } ``` 我們解壓縮圖像從[QVariant](qvariant.html)由MIME源舉行,并將其插入到文檔中作為一個資源。 #### Editing Key Bindings 這是實施進行編輯鍵綁定列表: | Keypresses | Action | | --- | --- | | Backspace | Deletes the character to the left of the cursor. | | Delete | Deletes the character to the right of the cursor. | | Ctrl+C | Copy the selected text to the clipboard. | | Ctrl+Insert | Copy the selected text to the clipboard. | | Ctrl+K | Deletes to the end of the line. | | Ctrl+V | Pastes the clipboard text into text edit. | | Shift+Insert | Pastes the clipboard text into text edit. | | Ctrl+X | Deletes the selected text and copies it to the clipboard. | | Shift+Delete | Deletes the selected text and copies it to the clipboard. | | Ctrl+Z | Undoes the last operation. | | Ctrl+Y | Redoes the last operation. | | Left | Moves the cursor one character to the left. | | Ctrl+Left | Moves the cursor one word to the left. | | Right | Moves the cursor one character to the right. | | Ctrl+Right | Moves the cursor one word to the right. | | Up | Moves the cursor one line up. | | Down | Moves the cursor one line down. | | PageUp | Moves the cursor one page up. | | PageDown | Moves the cursor one page down. | | Home | Moves the cursor to the beginning of the line. | | Ctrl+Home | Moves the cursor to the beginning of the text. | | End | Moves the cursor to the end of the line. | | Ctrl+End | Moves the cursor to the end of the text. | | Alt+Wheel | Scrolls the page horizontally (the Wheel is the mouse wheel). | 選擇(標記)的文本按住Shift鍵的同時按下按鍵的運動之一,例如,_Shift+Right_將選擇的字符的權利,_Shift+Ctrl+Right_將選擇字的右邊,等。 * * * ## Type Documentation ``` QTextEdit.AutoFormattingFlag ``` | Constant | Value | Description | | --- | --- | --- | | `QTextEdit.AutoNone` | `0` | 不要做任何自動格式化。 | | `QTextEdit.AutoBulletList` | `0x00000001` | 自動創建項目符號列表(例如,當用戶輸入一個星號( “*” )在最左邊的列,或壓在現有列表項中輸入。 | | `QTextEdit.AutoAll` | `0xffffffff` | 適用于所有的自動格式化。目前只有自動符號列表的支持。 | 該自動格式化類型是一個typedef為[QFlags](index.htm)\u003cAutoFormattingFlag\u003e 。它存儲AutoFormattingFlag值的或組合。 ``` QTextEdit.LineWrapMode ``` | Constant | Value | | --- | --- | | `QTextEdit.NoWrap` | `0` | | `QTextEdit.WidgetWidth` | `1` | | `QTextEdit.FixedPixelWidth` | `2` | | `QTextEdit.FixedColumnWidth` | `3` | * * * ## Method Documentation ``` QTextEdit.__init__ (self, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個空[QTextEdit](qtextedit.html)與父_parent_。 ``` QTextEdit.__init__ (self, QString?text, QWidget?parent?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QTextEdit](qtextedit.html)與父_parent_。文本編輯將顯示的文本_text_。該文本被解釋為HTML 。 ``` bool QTextEdit.acceptRichText (self) ``` ``` Qt.Alignment QTextEdit.alignment (self) ``` [ 返回當前段落的對齊方式。 ](index.htm) [**See also**](index.htm) [setAlignment](qtextedit.html#setAlignment)( ) 。 ``` QString QTextEdit.anchorAt (self, QPoint?pos) ``` 返回錨的位置處的參考_pos_,或者如果沒有錨存在于該點一個空字符串。 ``` QTextEdit.append (self, QString?text) ``` 追加一個新的段落_text_到文本編輯的末尾。 **Note:**追加了新的段落將具有相同的字符格式和塊格式作為當前段中,光標的位置確定。 **See also** [currentCharFormat](qtextedit.html#currentCharFormat)()和[QTextCursor.blockFormat](qtextcursor.html#blockFormat)( ) 。 ``` AutoFormatting QTextEdit.autoFormatting (self) ``` [ ``` bool QTextEdit.canInsertFromMimeData (self, QMimeData?source) ``` 這個函數返回True,如果MIME數據對象,由指定的內容_source_,可以被解碼并插入到文檔中。它被稱為例如,當拖動操作期間鼠標進入這個小部件,并確定是否可以接受該拖放操作是必要的。 重新實現這項功能,讓拖放額外的MIME類型的支持。 ``` bool QTextEdit.canPaste (self) ``` 返回是否文本可以從剪貼板粘貼到文本編輯。 這個函數中引入了Qt 4.2中。 ``` QTextEdit.changeEvent (self, QEvent?e) ``` ](index.htm) [從重新實現](index.htm)[QWidget.changeEvent](qwidget.html#changeEvent)( ) 。 ``` QTextEdit.clear (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void clear()`。 刪除文本編輯中的所有文本。 請注意,撤消/重做歷史是由這個函數清除。 **See also** [cut](qtextedit.html#cut)( )[setPlainText](qtextedit.html#plainText-prop)()和[setHtml](qtextedit.html#html-prop)( ) 。 ``` QTextEdit.contextMenuEvent (self, QContextMenuEvent?e) ``` 從重新實現[QWidget.contextMenuEvent](qwidget.html#contextMenuEvent)( ) 。 顯示與標準上下文菜單創建[createStandardContextMenu](qtextedit.html#createStandardContextMenu)( ) 。 如果您不希望文本編輯有個上下文菜單,可以設置其[contextMenuPolicy](qwidget.html#contextMenuPolicy-prop)至[Qt.NoContextMenu](qt.html#ContextMenuPolicy-enum)。如果你想自定義右鍵菜單,重新實現這個函數。如果你想擴展標準上下文菜單,重新實現這個函數,調用[createStandardContextMenu](qtextedit.html#createStandardContextMenu)()和extend菜單返回。 有關事件的信息傳遞中_event_對象。 ``` void MyTextEdit.contextMenuEvent([QContextMenuEvent](qcontextmenuevent.html) *event) { [QMenu](qmenu.html) *menu = createStandardContextMenu(); menu->addAction(tr("My Menu Item")); //... menu->exec(event->globalPos()); delete menu; } ``` ``` QTextEdit.copy (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void copy()`。 副本中的任何選定的文本復制到剪貼板。 **See also** [copyAvailable](qtextedit.html#copyAvailable)( ) 。 ``` QMimeData QTextEdit.createMimeDataFromSelection (self) ``` [](qmimedata.html) [這個函數返回一個新的MIME數據對象來表示文本編輯的當前選擇的內容。當選擇需要被封裝到一個新的被稱為](qmimedata.html)[QMimeData](qmimedata.html)對象,例如,當啟動一個拖放操作,或當數據被copyied到剪貼板。 如果重新實現此功能,請注意,返回的所有權[QMimeData](qmimedata.html)對象被傳遞給調用者。的選擇可以通過使用檢索到的[textCursor](qtextedit.html#textCursor)()函數。 ``` QMenu QTextEdit.createStandardContextMenu (self) ``` [](qmenu.html) [這個函數創建當用戶點擊文本編輯用鼠標右鍵其顯示在標準上下文菜單。它是從默認稱為](qmenu.html)[contextMenuEvent](qtextedit.html#contextMenuEvent)()處理。在彈出菜單的所有權被傳遞給調用者。 我們建議您使用createStandardContextMenu ([QPoint](qpoint.html))版本而不是這將使那些到用戶點擊敏感的動作。 ``` QMenu QTextEdit.createStandardContextMenu (self, QPoint?position) ``` [](qmenu.html) [這個函數創建當用戶點擊文本編輯用鼠標右鍵其顯示在標準上下文菜單。它是從默認稱為](qmenu.html)[contextMenuEvent](qtextedit.html#contextMenuEvent)( )處理程序,它需要的_position_哪里的鼠標點擊是。這可以使那些到用戶點擊的位置敏感的動作。在彈出菜單的所有權被傳遞給調用者。 此功能被引入Qt的4.4 。 ``` QTextCharFormat QTextEdit.currentCharFormat (self) ``` [ 返回被插入新文本時所使用的字符格式。 ](qtextcharformat.html) [**See also**](qtextcharformat.html) [setCurrentCharFormat](qtextedit.html#setCurrentCharFormat)( ) 。 ``` QFont QTextEdit.currentFont (self) ``` [ 返回當前格式的字體。 ](qfont.html) [**See also**](qfont.html) [setCurrentFont](qtextedit.html#setCurrentFont)( )[setFontFamily](qtextedit.html#setFontFamily)()和[setFontPointSize](qtextedit.html#setFontPointSize)( ) 。 ``` QTextCursor QTextEdit.cursorForPosition (self, QPoint?pos) ``` [](qtextcursor.html) [返回](qtextcursor.html)[QTextCursor](qtextcursor.html)在位置_pos_(在視口坐標) 。 ``` QRect QTextEdit.cursorRect (self, QTextCursor?cursor) ``` [ 返回一個矩形(在視區坐標) ,其中包括_cursor_。 ](qrect.html) ``` QRect QTextEdit.cursorRect (self) ``` [ 返回一個矩形(在視口中坐標) ,其中包括文本編輯的光標。 ``` int QTextEdit.cursorWidth (self) ``` ``` QTextEdit.cut (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void cut()`。 將所選文本復制到剪貼板,并從文本編輯刪除它。 如果沒有選中的文本沒有任何反應。 ](qrect.html) [**See also**](qrect.html) [copy](qtextedit.html#copy)()和[paste](qtextedit.html#paste)( ) 。 ``` QTextDocument QTextEdit.document (self) ``` [ 返回一個指針,指向底層的文件。 ](qtextdocument.html) [**See also**](qtextdocument.html) [setDocument](qtextedit.html#setDocument)( ) 。 ``` QString QTextEdit.documentTitle (self) ``` ``` QTextEdit.dragEnterEvent (self, QDragEnterEvent?e) ``` 從重新實現[QWidget.dragEnterEvent](qwidget.html#dragEnterEvent)( ) 。 ``` QTextEdit.dragLeaveEvent (self, QDragLeaveEvent?e) ``` 從重新實現[QWidget.dragLeaveEvent](qwidget.html#dragLeaveEvent)( ) 。 ``` QTextEdit.dragMoveEvent (self, QDragMoveEvent?e) ``` 從重新實現[QWidget.dragMoveEvent](qwidget.html#dragMoveEvent)( ) 。 ``` QTextEdit.dropEvent (self, QDropEvent?e) ``` 從重新實現[QWidget.dropEvent](qwidget.html#dropEvent)( ) 。 ``` QTextEdit.ensureCursorVisible (self) ``` 確保光標是在必要時滾動文本編輯可見。 ``` bool QTextEdit.event (self, QEvent?e) ``` ``` list-of-QTextEdit.ExtraSelection QTextEdit.extraSelections (self) ``` 返回以前設置額外的選擇。 這個函數中引入了Qt 4.2中。 **See also** [setExtraSelections](qtextedit.html#setExtraSelections)( ) 。 ``` bool QTextEdit.find (self, QString?exp, QTextDocument.FindFlags?options?=?0) ``` 查找字符串的下一個出現,_exp_,使用給定的_options_。返回True如果_exp_被發現并改變光標選擇匹配,否則返回False 。 ``` QTextEdit.focusInEvent (self, QFocusEvent?e) ``` 從重新實現[QWidget.focusInEvent](qwidget.html#focusInEvent)( ) 。 ``` bool QTextEdit.focusNextPrevChild (self, bool?next) ``` 從重新實現[QWidget.focusNextPrevChild](qwidget.html#focusNextPrevChild)( ) 。 ``` QTextEdit.focusOutEvent (self, QFocusEvent?e) ``` 從重新實現[QWidget.focusOutEvent](qwidget.html#focusOutEvent)( ) 。 ``` QString QTextEdit.fontFamily (self) ``` 返回當前格式的字體系列。 **See also** [setFontFamily](qtextedit.html#setFontFamily)( )[setCurrentFont](qtextedit.html#setCurrentFont)()和[setFontPointSize](qtextedit.html#setFontPointSize)( ) 。 ``` bool QTextEdit.fontItalic (self) ``` 返回True如果當前格式的字體是斜體,否則返回False 。 **See also** [setFontItalic](qtextedit.html#setFontItalic)( ) 。 ``` float QTextEdit.fontPointSize (self) ``` 返回當前格式的字體的磅值。 **See also** [setFontFamily](qtextedit.html#setFontFamily)( )[setCurrentFont](qtextedit.html#setCurrentFont)()和[setFontPointSize](qtextedit.html#setFontPointSize)( ) 。 ``` bool QTextEdit.fontUnderline (self) ``` 返回True如果當前格式的字體底線,否則返回False 。 **See also** [setFontUnderline](qtextedit.html#setFontUnderline)( ) 。 ``` int QTextEdit.fontWeight (self) ``` 返回當前格式的字體粗細。 **See also** [setFontWeight](qtextedit.html#setFontWeight)( )[setCurrentFont](qtextedit.html#setCurrentFont)( )[setFontPointSize](qtextedit.html#setFontPointSize)()和[QFont.Weight](qfont.html#Weight-enum)。 ``` QTextEdit.inputMethodEvent (self, QInputMethodEvent) ``` 從重新實現[QWidget.inputMethodEvent](qwidget.html#inputMethodEvent)( ) 。 ``` QVariant QTextEdit.inputMethodQuery (self, Qt.InputMethodQuery?property) ``` 從重新實現[QWidget.inputMethodQuery](qwidget.html#inputMethodQuery)( ) 。 ``` QTextEdit.insertFromMimeData (self, QMimeData?source) ``` 該功能可以插入的MIME數據對象的內容,由指定的_source_,到在當前光標位置的文本編輯。它被調用時插入文本作為一個剪貼板粘貼操作的結果,或者當文本編輯接受來自拖拽數據和拖放操作。 重新實現這項功能,讓拖放額外的MIME類型的支持。 ``` QTextEdit.insertHtml (self, QString?text) ``` 這種方法也是一個Qt槽與C + +的簽名`void insertHtml(const QString&)`。 便利的插槽,插入_text_這被認為是HTML格式在當前光標位置。 它等價于: ``` edit->textCursor().insertHtml(fragment); ``` **Note:**使用此功能時使用樣式表,樣式表只適用于文檔中的當前塊。為了對整個文檔應用樣式表,使用[QTextDocument.setDefaultStyleSheet](qtextdocument.html#defaultStyleSheet-prop)( )來代替。 ``` QTextEdit.insertPlainText (self, QString?text) ``` 這種方法也是一個Qt槽與C + +的簽名`void insertPlainText(const QString&)`。 便利的插槽,插入_text_在當前光標位置。 它相當于 ``` edit->textCursor().insertText(text); ``` ``` bool QTextEdit.isReadOnly (self) ``` ``` bool QTextEdit.isUndoRedoEnabled (self) ``` ``` QTextEdit.keyPressEvent (self, QKeyEvent?e) ``` 從重新實現[QWidget.keyPressEvent](qwidget.html#keyPressEvent)( ) 。 ``` QTextEdit.keyReleaseEvent (self, QKeyEvent?e) ``` 從重新實現[QWidget.keyReleaseEvent](qwidget.html#keyReleaseEvent)( ) 。 ``` int QTextEdit.lineWrapColumnOrWidth (self) ``` ``` LineWrapMode QTextEdit.lineWrapMode (self) ``` [ ``` QVariant QTextEdit.loadResource (self, int?type, QUrl?name) ``` 加載給定指定的資源_type_和_name_。 ](qtextedit.html#LineWrapMode-enum) [這個函數是一個擴展](qtextedit.html#LineWrapMode-enum)[QTextDocument.loadResource](qtextdocument.html#loadResource)( ) 。 **See also** [QTextDocument.loadResource](qtextdocument.html#loadResource)( ) 。 ``` QTextEdit.mergeCurrentCharFormat (self, QTextCharFormat?modifier) ``` 在合并中指定的屬性_modifier_成通過在編輯器的光標調用QTextCursor.mergeCharFormat當前字符格式。如果編輯器有一個選擇了屬性_modifier_直接施加到選擇。 **See also** [QTextCursor.mergeCharFormat](qtextcursor.html#mergeCharFormat)( ) 。 ``` QTextEdit.mouseDoubleClickEvent (self, QMouseEvent?e) ``` 從重新實現[QWidget.mouseDoubleClickEvent](qwidget.html#mouseDoubleClickEvent)( ) 。 ``` QTextEdit.mouseMoveEvent (self, QMouseEvent?e) ``` 從重新實現[QWidget.mouseMoveEvent](qwidget.html#mouseMoveEvent)( ) 。 ``` QTextEdit.mousePressEvent (self, QMouseEvent?e) ``` 從重新實現[QWidget.mousePressEvent](qwidget.html#mousePressEvent)( ) 。 ``` QTextEdit.mouseReleaseEvent (self, QMouseEvent?e) ``` 從重新實現[QWidget.mouseReleaseEvent](qwidget.html#mouseReleaseEvent)( ) 。 ``` QTextEdit.moveCursor (self, QTextCursor.MoveOperation?operation, QTextCursor.MoveMode?mode?=?QTextCursor.MoveAnchor) ``` 通過執行給定的移動光標_operation_。 If _mode_ is [QTextCursor.KeepAnchor](qtextcursor.html#MoveMode-enum),光標選擇它移動到文本上。這是當他們按住Shift鍵并移動光標,光標鍵,用戶達到相同的效果。 這個函數中引入了Qt 4.2中。 **See also** [QTextCursor.movePosition](qtextcursor.html#movePosition)( ) 。 ``` bool QTextEdit.overwriteMode (self) ``` ``` QTextEdit.paintEvent (self, QPaintEvent?e) ``` 從重新實現[QWidget.paintEvent](qwidget.html#paintEvent)( ) 。 此事件處理程序可以在子類來接收傳入paint事件重新實現_event_。它通常是不必要的重寫本函數中的一個子類[QTextEdit](qtextedit.html)。 **Warning:**相關文本文檔不能從這個函數的重新實現中修改。 ``` QTextEdit.paste (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void paste()`。 從剪貼板粘貼文本到文本編輯的當前光標位置。 如果在剪貼板中沒有文本沒有任何反應。 要更改此函數的行為,即要修改什么[QTextEdit](qtextedit.html)可以粘貼以及它是如何被粘貼,重新實現虛[canInsertFromMimeData](qtextedit.html#canInsertFromMimeData)()和[insertFromMimeData](qtextedit.html#insertFromMimeData)()函數。 **See also** [cut](qtextedit.html#cut)()和[copy](qtextedit.html#copy)( ) 。 ``` QTextEdit.print (self, QPrinter?printer) ``` 方便的功能,文本編輯的文檔打印到指定的_printer_。這等同于調用print方法上的文件直接,除了這個功能也支持[QPrinter.Selection](qprinter.html#PrintRange-enum)作為打印范圍。 此功能被引入Qt的4.3 。 **See also** [QTextDocument.print](qtextdocument.html#print)( ) 。 ``` QTextEdit.print_ (self, QPrinter?printer) ``` 方便的功能,文本編輯的文檔打印到指定的_printer_。這等同于調用print方法上的文件直接,除了這個功能也支持[QPrinter.Selection](qprinter.html#PrintRange-enum)作為打印范圍。 此功能被引入Qt的4.3 。 **See also** [QTextDocument.print](qtextdocument.html#print)( ) 。 ``` QTextEdit.redo (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void redo()`。 重做上次操作。 如果沒有操作可以恢復,也就是說,在撤消/重做歷史沒有恢復步驟,沒有任何反應。 這個函數中引入了Qt 4.2中。 **See also** [undo](qtextedit.html#undo)( ) 。 ``` QTextEdit.resizeEvent (self, QResizeEvent) ``` 從重新實現[QWidget.resizeEvent](qwidget.html#resizeEvent)( ) 。 ``` QTextEdit.scrollContentsBy (self, int?dx, int?dy) ``` 從重新實現[QAbstractScrollArea.scrollContentsBy](qabstractscrollarea.html#scrollContentsBy)( ) 。 ``` QTextEdit.scrollToAnchor (self, QString?name) ``` 這種方法也是一個Qt槽與C + +的簽名`void scrollToAnchor(const QString&)`。 滾動文本編輯,以便與錨定_name_可見,什么也不做,如果_name_是空的,或者已經是可見的,或者是沒有找到。 ``` QTextEdit.selectAll (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void selectAll()`。 選擇所有文本。 **See also** [copy](qtextedit.html#copy)( )[cut](qtextedit.html#cut)()和[textCursor](qtextedit.html#textCursor)( ) 。 ``` QTextEdit.setAcceptRichText (self, bool?accept) ``` ``` QTextEdit.setAlignment (self, Qt.Alignment?a) ``` 這種方法也是一個Qt槽與C + +的簽名`void setAlignment(Qt::Alignment)`。 設置當前段落的對齊方式_a_。有效的路線是[Qt.AlignLeft](qt.html#AlignmentFlag-enum),[Qt.AlignRight](qt.html#AlignmentFlag-enum),[Qt.AlignJustify](qt.html#AlignmentFlag-enum)和[Qt.AlignCenter](qt.html#AlignmentFlag-enum)(其中中心水平方向)。 **See also** [alignment](qtextedit.html#alignment)( ) 。 ``` QTextEdit.setAutoFormatting (self, AutoFormatting?features) ``` ``` QTextEdit.setCurrentCharFormat (self, QTextCharFormat?format) ``` 設置要插入新的文本時可以使用的字符格式_format_通過調用[QTextCursor.setCharFormat](qtextcursor.html#setCharFormat)( )在編輯器的光標。如果編輯器有一個選擇,則該字符格式被直接施加到選擇。 **See also** [currentCharFormat](qtextedit.html#currentCharFormat)( ) 。 ``` QTextEdit.setCurrentFont (self, QFont?f) ``` 這種方法也是一個Qt槽與C + +的簽名`void setCurrentFont(const QFont&)`。 設置當前格式的字體_f_。 **See also** [currentFont](qtextedit.html#currentFont)( )[setFontPointSize](qtextedit.html#setFontPointSize)()和[setFontFamily](qtextedit.html#setFontFamily)( ) 。 ``` QTextEdit.setCursorWidth (self, int?width) ``` ``` QTextEdit.setDocument (self, QTextDocument?document) ``` 品牌_document_在文本編輯器中的新文件。 **Note:**編輯器_does not take ownership of the document_除非它是文檔的父對象。所提供的文檔的父對象仍然是對象的所有者。 該編輯器不會刪除當前文件,哪怕是編輯器的一個孩子。 **See also** [document](qtextedit.html#document)( ) 。 ``` QTextEdit.setDocumentTitle (self, QString?title) ``` ``` QTextEdit.setExtraSelections (self, list-of-QTextEdit.ExtraSelection?selections) ``` 此功能允許暫時標記文檔中的某些區域用給定的顏色,指定為_selections_。這可以是有用的,例如在一個節目的編輯器來標記文本的一整行與給定的背景顏色來表示一個斷點的存在。 這個函數中引入了Qt 4.2中。 **See also** [QTextEdit.ExtraSelection](index.htm)和[extraSelections](qtextedit.html#extraSelections)( ) 。 ``` QTextEdit.setFontFamily (self, QString?fontFamily) ``` 這種方法也是一個Qt槽與C + +的簽名`void setFontFamily(const QString&)`。 設置當前格式的字體家族_fontFamily_。 **See also** [fontFamily](qtextedit.html#fontFamily)()和[setCurrentFont](qtextedit.html#setCurrentFont)( ) 。 ``` QTextEdit.setFontItalic (self, bool?b) ``` 這種方法也是一個Qt槽與C + +的簽名`void setFontItalic(bool)`。 If _italic_誠然,設置當前格式為斜體,否則設置當前格式為非斜體。 **See also** [fontItalic](qtextedit.html#fontItalic)( ) 。 ``` QTextEdit.setFontPointSize (self, float?s) ``` 這種方法也是一個Qt槽與C + +的簽名`void setFontPointSize(qreal)`。 設置當前格式的點大小為_s_。 注意,如果_s_是零或負數,此函數的行為沒有定義。 **See also** [fontPointSize](qtextedit.html#fontPointSize)( )[setCurrentFont](qtextedit.html#setCurrentFont)()和[setFontFamily](qtextedit.html#setFontFamily)( ) 。 ``` QTextEdit.setFontUnderline (self, bool?b) ``` 這種方法也是一個Qt槽與C + +的簽名`void setFontUnderline(bool)`。 If _underline_誠然,設置當前格式強調,否則設置當前格式是沒有下劃線。 **See also** [fontUnderline](qtextedit.html#fontUnderline)( ) 。 ``` QTextEdit.setFontWeight (self, int?w) ``` 這種方法也是一個Qt槽與C + +的簽名`void setFontWeight(int)`。 設置當前格式的字體粗細來定_weight_其中使用的值是在由規定的范圍[QFont.Weight](qfont.html#Weight-enum)枚舉。 **See also** [fontWeight](qtextedit.html#fontWeight)( )[setCurrentFont](qtextedit.html#setCurrentFont)()和[setFontFamily](qtextedit.html#setFontFamily)( ) 。 ``` QTextEdit.setHtml (self, QString?text) ``` 這種方法也是一個Qt槽與C + +的簽名`void setHtml(const QString&)`。 ``` QTextEdit.setLineWrapColumnOrWidth (self, int?w) ``` ``` QTextEdit.setLineWrapMode (self, LineWrapMode?mode) ``` ``` QTextEdit.setOverwriteMode (self, bool?overwrite) ``` ``` QTextEdit.setPlainText (self, QString?text) ``` 這種方法也是一個Qt槽與C + +的簽名`void setPlainText(const QString&)`。 ``` QTextEdit.setReadOnly (self, bool?ro) ``` ``` QTextEdit.setTabChangesFocus (self, bool?b) ``` ``` QTextEdit.setTabStopWidth (self, int?width) ``` ``` QTextEdit.setText (self, QString?text) ``` 這種方法也是一個Qt槽與C + +的簽名`void setText(const QString&)`。 設置文本編輯的_text_。該文本可以是純文本或HTML和文本編輯會嘗試猜測正確的格式。 使用[setHtml](qtextedit.html#html-prop)()或[setPlainText](qtextedit.html#plainText-prop)( )直接以避免文本編輯的猜測。 這個函數中引入了Qt 4.2中。 **See also** [text](index.htm#text)( )[toPlainText](qtextedit.html#plainText-prop)()和[toHtml](qtextedit.html#html-prop)( ) 。 ``` QTextEdit.setTextBackgroundColor (self, QColor?c) ``` 這種方法也是一個Qt槽與C + +的簽名`void setTextBackgroundColor(const QColor&)`。 設置當前格式的文本背景顏色_c_。 此功能被引入Qt的4.4 。 **See also** [textBackgroundColor](qtextedit.html#textBackgroundColor)( ) 。 ``` QTextEdit.setTextColor (self, QColor?c) ``` 這種方法也是一個Qt槽與C + +的簽名`void setTextColor(const QColor&)`。 設置當前格式的文本顏色_c_。 **See also** [textColor](qtextedit.html#textColor)( ) 。 ``` QTextEdit.setTextCursor (self, QTextCursor?cursor) ``` 設置可見_cursor_。 **See also** [textCursor](qtextedit.html#textCursor)( ) 。 ``` QTextEdit.setTextInteractionFlags (self, Qt.TextInteractionFlags?flags) ``` ``` QTextEdit.setUndoRedoEnabled (self, bool?enable) ``` ``` QTextEdit.setWordWrapMode (self, QTextOption.WrapMode?policy) ``` ``` QTextEdit.showEvent (self, QShowEvent) ``` 從重新實現[QWidget.showEvent](qwidget.html#showEvent)( ) 。 ``` bool QTextEdit.tabChangesFocus (self) ``` ``` int QTextEdit.tabStopWidth (self) ``` ``` QColor QTextEdit.textBackgroundColor (self) ``` [ 返回當前格式的文本背景顏色。 此功能被引入Qt的4.4 。 ](qcolor.html) [**See also**](qcolor.html) [setTextBackgroundColor](qtextedit.html#setTextBackgroundColor)( ) 。 ``` QColor QTextEdit.textColor (self) ``` [ 返回當前格式的文本顏色。 ](qcolor.html) [**See also**](qcolor.html) [setTextColor](qtextedit.html#setTextColor)( ) 。 ``` QTextCursor QTextEdit.textCursor (self) ``` [](qtextcursor.html) [返回的副本](qtextcursor.html)[QTextCursor](qtextcursor.html)表示當前可見的光標。請注意,在返回的指針變化不影響[QTextEdit](qtextedit.html)的游標;使用[setTextCursor](qtextedit.html#setTextCursor)( )來更新可見的光標。 **See also** [setTextCursor](qtextedit.html#setTextCursor)( ) 。 ``` Qt.TextInteractionFlags QTextEdit.textInteractionFlags (self) ``` [ ``` QTextEdit.timerEvent (self, QTimerEvent?e) ``` ``` QString QTextEdit.toHtml (self) ``` ``` QString QTextEdit.toPlainText (self) ``` ``` QTextEdit.undo (self) ``` 這種方法也是一個Qt槽與C + +的簽名`void undo()`。 撤消上一個操作。 如果沒有操作可以撤銷,也就是說,在撤消/恢復歷史中沒有撤銷一步,沒有任何反應。 這個函數中引入了Qt 4.2中。 ](index.htm) [**See also**](index.htm) [redo](qtextedit.html#redo)( ) 。 ``` QTextEdit.wheelEvent (self, QWheelEvent?e) ``` 從重新實現[QWidget.wheelEvent](qwidget.html#wheelEvent)( ) 。 ``` QTextOption.WrapMode QTextEdit.wordWrapMode (self) ``` [ ``` QTextEdit.zoomIn (self, int?range?=?1) ``` 這種方法也是一個Qt槽與C + +的簽名`void zoomIn(int = 1)`。 放大了的文本通過把基本字體大小_range_大點并且重新計算所有字體大小是新的大小。這不會改變任何圖片的大小。 ](qtextoption.html#WrapMode-enum) [**See also**](qtextoption.html#WrapMode-enum) [zoomOut](qtextedit.html#zoomOut)( ) 。 ``` QTextEdit.zoomOut (self, int?range?=?1) ``` 這種方法也是一個Qt槽與C + +的簽名`void zoomOut(int = 1)`。 這是一個重載函數。 縮小上通過把基本字體大小的文本_range_小點并且重新計算所有字體大小是新的大小。這不會改變任何圖片的大小。 **See also** [zoomIn](qtextedit.html#zoomIn)( ) 。 * * * ## Qt Signal Documentation ``` void copyAvailable (bool) ``` 這是該信號的默認超載。 當選擇文本或文本編輯取消選擇,這個信號被發射。 當選擇文本這個信號將被發射_yes_設置為True 。如果沒有文本被選中,或者如果選定的文本被取消選擇這個信號被發射與_yes_設置為False 。 If _yes_是真的,那么[copy](qtextedit.html#copy)( )可以用來選擇復制到剪貼板。如果_yes_為False,則[copy](qtextedit.html#copy)( )什么也不做。 **See also** [selectionChanged](qtextedit.html#selectionChanged)( ) 。 ``` void currentCharFormatChanged (const QTextCharFormat&) ``` 這是該信號的默認超載。 這個信號被發射,如果當前字符格式發生了變化,例如所造成的光標位置的改變。 新格式_f_。 **See also** [setCurrentCharFormat](qtextedit.html#setCurrentCharFormat)( ) 。 ``` void cursorPositionChanged () ``` 這是該信號的默認超載。 這個信號被發射時的光標的位置改變。 ``` void redoAvailable (bool) ``` 這是該信號的默認超載。 這個信號被發射時重做操作變得可用(_available_為True)或不可用(_available_是假的) 。 ``` void selectionChanged () ``` 這是該信號的默認超載。 這個信號被發射時的選擇改變。 **See also** [copyAvailable](qtextedit.html#copyAvailable)( ) 。 ``` void textChanged () ``` 這是該信號的默認超載。 這個信號被發射時該文檔的內容更改,例如,當文本被插入或刪除,或格式化時被應用。 ``` void undoAvailable (bool) ``` 這是該信號的默認超載。 這個信號被發射時撤銷操作變得可用(_available_為True)或不可用(_available_是假的) 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看