<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # QGraphicsTextItem Class Reference ## [[QtGui](index.htm) module] 該QGraphicsTextItem類提供了一個文本項,您可以添加到[QGraphicsScene](qgraphicsscene.html)顯示格式化文本。[More...](#details) 繼承[QGraphicsObject](qgraphicsobject.html)。 ### Methods * `__init__ (self, QGraphicsItem?parent?=?None, QGraphicsScene?scene?=?None)` * `__init__ (self, QString?text, QGraphicsItem?parent?=?None, QGraphicsScene?scene?=?None)` * `adjustSize (self)` * `QRectF boundingRect (self)` * `bool contains (self, QPointF?point)` * `contextMenuEvent (self, QGraphicsSceneContextMenuEvent?event)` * `QColor defaultTextColor (self)` * `QTextDocument document (self)` * `dragEnterEvent (self, QGraphicsSceneDragDropEvent?event)` * `dragLeaveEvent (self, QGraphicsSceneDragDropEvent?event)` * `dragMoveEvent (self, QGraphicsSceneDragDropEvent?event)` * `dropEvent (self, QGraphicsSceneDragDropEvent?event)` * `focusInEvent (self, QFocusEvent?event)` * `focusOutEvent (self, QFocusEvent?event)` * `QFont font (self)` * `hoverEnterEvent (self, QGraphicsSceneHoverEvent?event)` * `hoverLeaveEvent (self, QGraphicsSceneHoverEvent?event)` * `hoverMoveEvent (self, QGraphicsSceneHoverEvent?event)` * `inputMethodEvent (self, QInputMethodEvent?event)` * `QVariant inputMethodQuery (self, Qt.InputMethodQuery?query)` * `bool isObscuredBy (self, QGraphicsItem?item)` * `keyPressEvent (self, QKeyEvent?event)` * `keyReleaseEvent (self, QKeyEvent?event)` * `mouseDoubleClickEvent (self, QGraphicsSceneMouseEvent?event)` * `mouseMoveEvent (self, QGraphicsSceneMouseEvent?event)` * `mousePressEvent (self, QGraphicsSceneMouseEvent?event)` * `mouseReleaseEvent (self, QGraphicsSceneMouseEvent?event)` * `QPainterPath opaqueArea (self)` * `bool openExternalLinks (self)` * `paint (self, QPainter?painter, QStyleOptionGraphicsItem?option, QWidget?widget)` * `bool sceneEvent (self, QEvent?event)` * `setDefaultTextColor (self, QColor?c)` * `setDocument (self, QTextDocument?document)` * `setFont (self, QFont?font)` * `setHtml (self, QString?html)` * `setOpenExternalLinks (self, bool?open)` * `setPlainText (self, QString?text)` * `setTabChangesFocus (self, bool?b)` * `setTextCursor (self, QTextCursor?cursor)` * `setTextInteractionFlags (self, Qt.TextInteractionFlags?flags)` * `setTextWidth (self, float?width)` * `QPainterPath shape (self)` * `bool tabChangesFocus (self)` * `QTextCursor textCursor (self)` * `Qt.TextInteractionFlags textInteractionFlags (self)` * `float textWidth (self)` * `QString toHtml (self)` * `QString toPlainText (self)` * `int type (self)` ### Qt Signals * `void linkActivated (const QString&)` * `void linkHovered (const QString&)` * * * ## Detailed Description 該QGraphicsTextItem類提供了一個文本項,您可以添加到[QGraphicsScene](qgraphicsscene.html)顯示格式化文本。 如果只需要顯示在一個項目純文本,可以考慮使用[QGraphicsSimpleTextItem](qgraphicssimpletextitem.html)代替。 要設置項的文本,一個傳遞[QString](qstring.html)到QGraphicsTextItem的構造函數,或調用[setHtml](qgraphicstextitem.html#setHtml)()/[setPlainText](qgraphicstextitem.html#setPlainText)( ) 。 QGraphicsTextItem使用文本的格式大小和相關的字體提供合理的實施[boundingRect](qgraphicstextitem.html#boundingRect)( )[shape](qgraphicstextitem.html#shape)()和[contains](qgraphicstextitem.html#contains)( ) 。你可以通過調用設置字體[setFont](qgraphicstextitem.html#setFont)( ) 。 它有可能使該項目可編輯通過設置[Qt.TextEditorInteraction](qt.html#TextInteractionFlag-enum)使用標志[setTextInteractionFlags](qgraphicstextitem.html#setTextInteractionFlags)( ) 。 該項目的首選文本的寬度可以使用設置[setTextWidth](qgraphicstextitem.html#setTextWidth)( ),并使用獲得的[textWidth](qgraphicstextitem.html#textWidth)( ) 。 **Note:**為了使在中心的HTML文本,該項目的文本寬度必須設置。 ![](https://img.kancloud.cn/b1/20/b120e62bdc7f00b7ea719f03a9e3cdf4_200x200.png) **Note:**QGraphicsTextItem接受[hover events](qgraphicsitem.html#acceptHoverEvents)在默認情況下。您可以更改此[setAcceptHoverEvents()](qgraphicsitem.html#setAcceptHoverEvents)。 * * * ## Method Documentation ``` QGraphicsTextItem.__init__ (self, QGraphicsItem?parent?=?None, QGraphicsScene?scene?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 該_scene_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QGraphicsTextItem](qgraphicstextitem.html)。_parent_被傳遞給[QGraphicsItem](qgraphicsitem.html)的構造。 **See also** [QGraphicsScene.addItem](qgraphicsscene.html#addItem)( ) 。 ``` QGraphicsTextItem.__init__ (self, QString?text, QGraphicsItem?parent?=?None, QGraphicsScene?scene?=?None) ``` 該_parent_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 該_scene_的說法,如果不是沒有,原因_self_通過Qt的,而不是PyQt的擁有。 構造一個[QGraphicsTextItem](qgraphicstextitem.html),使用_text_作為默認的純文本。_parent_被傳遞給[QGraphicsItem](qgraphicsitem.html)的構造。 **See also** [QGraphicsScene.addItem](qgraphicsscene.html#addItem)( ) 。 ``` QGraphicsTextItem.adjustSize (self) ``` 調整文本項到一個合理的規模。 ``` QRectF QGraphicsTextItem.boundingRect (self) ``` [](qrectf.html) [從重新實現](qrectf.html)[QGraphicsItem.boundingRect](qgraphicsitem.html#boundingRect)( ) 。 ``` bool QGraphicsTextItem.contains (self, QPointF?point) ``` 從重新實現[QGraphicsItem.contains](qgraphicsitem.html#contains)( ) 。 ``` QGraphicsTextItem.contextMenuEvent (self, QGraphicsSceneContextMenuEvent?event) ``` 從重新實現[QGraphicsItem.contextMenuEvent](qgraphicsitem.html#contextMenuEvent)( ) 。 ``` QColor QGraphicsTextItem.defaultTextColor (self) ``` [ 返回用于為無格式文本的默認文本顏色。 ](qcolor.html) [**See also**](qcolor.html) [setDefaultTextColor](qgraphicstextitem.html#setDefaultTextColor)( ) 。 ``` QTextDocument QGraphicsTextItem.document (self) ``` [ 返回該項目的文本文檔。 ](qtextdocument.html) [**See also**](qtextdocument.html) [setDocument](qgraphicstextitem.html#setDocument)( ) 。 ``` QGraphicsTextItem.dragEnterEvent (self, QGraphicsSceneDragDropEvent?event) ``` 從重新實現[QGraphicsItem.dragEnterEvent](qgraphicsitem.html#dragEnterEvent)( ) 。 ``` QGraphicsTextItem.dragLeaveEvent (self, QGraphicsSceneDragDropEvent?event) ``` 從重新實現[QGraphicsItem.dragLeaveEvent](qgraphicsitem.html#dragLeaveEvent)( ) 。 ``` QGraphicsTextItem.dragMoveEvent (self, QGraphicsSceneDragDropEvent?event) ``` 從重新實現[QGraphicsItem.dragMoveEvent](qgraphicsitem.html#dragMoveEvent)( ) 。 ``` QGraphicsTextItem.dropEvent (self, QGraphicsSceneDragDropEvent?event) ``` 從重新實現[QGraphicsItem.dropEvent](qgraphicsitem.html#dropEvent)( ) 。 ``` QGraphicsTextItem.focusInEvent (self, QFocusEvent?event) ``` 從重新實現[QGraphicsItem.focusInEvent](qgraphicsitem.html#focusInEvent)( ) 。 ``` QGraphicsTextItem.focusOutEvent (self, QFocusEvent?event) ``` 從重新實現[QGraphicsItem.focusOutEvent](qgraphicsitem.html#focusOutEvent)( ) 。 ``` QFont QGraphicsTextItem.font (self) ``` [ 返回項的字體,這是用來呈現的文本。 ](qfont.html) [**See also**](qfont.html) [setFont](qgraphicstextitem.html#setFont)( ) 。 ``` QGraphicsTextItem.hoverEnterEvent (self, QGraphicsSceneHoverEvent?event) ``` 從重新實現[QGraphicsItem.hoverEnterEvent](qgraphicsitem.html#hoverEnterEvent)( ) 。 ``` QGraphicsTextItem.hoverLeaveEvent (self, QGraphicsSceneHoverEvent?event) ``` 從重新實現[QGraphicsItem.hoverLeaveEvent](qgraphicsitem.html#hoverLeaveEvent)( ) 。 ``` QGraphicsTextItem.hoverMoveEvent (self, QGraphicsSceneHoverEvent?event) ``` 從重新實現[QGraphicsItem.hoverMoveEvent](qgraphicsitem.html#hoverMoveEvent)( ) 。 ``` QGraphicsTextItem.inputMethodEvent (self, QInputMethodEvent?event) ``` 從重新實現[QGraphicsItem.inputMethodEvent](qgraphicsitem.html#inputMethodEvent)( ) 。 ``` QVariant QGraphicsTextItem.inputMethodQuery (self, Qt.InputMethodQuery?query) ``` 從重新實現[QGraphicsItem.inputMethodQuery](qgraphicsitem.html#inputMethodQuery)( ) 。 ``` bool QGraphicsTextItem.isObscuredBy (self, QGraphicsItem?item) ``` 從重新實現[QGraphicsItem.isObscuredBy](qgraphicsitem.html#isObscuredBy)( ) 。 ``` QGraphicsTextItem.keyPressEvent (self, QKeyEvent?event) ``` 從重新實現[QGraphicsItem.keyPressEvent](qgraphicsitem.html#keyPressEvent)( ) 。 ``` QGraphicsTextItem.keyReleaseEvent (self, QKeyEvent?event) ``` 從重新實現[QGraphicsItem.keyReleaseEvent](qgraphicsitem.html#keyReleaseEvent)( ) 。 ``` QGraphicsTextItem.mouseDoubleClickEvent (self, QGraphicsSceneMouseEvent?event) ``` 從重新實現[QGraphicsItem.mouseDoubleClickEvent](qgraphicsitem.html#mouseDoubleClickEvent)( ) 。 ``` QGraphicsTextItem.mouseMoveEvent (self, QGraphicsSceneMouseEvent?event) ``` 從重新實現[QGraphicsItem.mouseMoveEvent](qgraphicsitem.html#mouseMoveEvent)( ) 。 ``` QGraphicsTextItem.mousePressEvent (self, QGraphicsSceneMouseEvent?event) ``` 從重新實現[QGraphicsItem.mousePressEvent](qgraphicsitem.html#mousePressEvent)( ) 。 ``` QGraphicsTextItem.mouseReleaseEvent (self, QGraphicsSceneMouseEvent?event) ``` 從重新實現[QGraphicsItem.mouseReleaseEvent](qgraphicsitem.html#mouseReleaseEvent)( ) 。 ``` QPainterPath QGraphicsTextItem.opaqueArea (self) ``` [](qpainterpath.html) [從重新實現](qpainterpath.html)[QGraphicsItem.opaqueArea](qgraphicsitem.html#opaqueArea)( ) 。 ``` bool QGraphicsTextItem.openExternalLinks (self) ``` ``` QGraphicsTextItem.paint (self, QPainter?painter, QStyleOptionGraphicsItem?option, QWidget?widget) ``` 從重新實現[QGraphicsItem.paint](qgraphicsitem.html#paint)( ) 。 ``` bool QGraphicsTextItem.sceneEvent (self, QEvent?event) ``` 從重新實現[QGraphicsItem.sceneEvent](qgraphicsitem.html#sceneEvent)( ) 。 ``` QGraphicsTextItem.setDefaultTextColor (self, QColor?c) ``` 設置為無格式文本的顏色_col_。 **See also** [defaultTextColor](qgraphicstextitem.html#defaultTextColor)( ) 。 ``` QGraphicsTextItem.setDocument (self, QTextDocument?document) ``` 設置文本文件_document_該項目。 **See also** [document](qgraphicstextitem.html#document)( ) 。 ``` QGraphicsTextItem.setFont (self, QFont?font) ``` 設置用于文本渲染項目的字體_font_。 **See also** [font](qgraphicstextitem.html#font)( ) 。 ``` QGraphicsTextItem.setHtml (self, QString?html) ``` 設置項的文本_text_,假設該文本是HTML格式的。如果該項目具有鍵盤輸入焦點,此功能也將調用[ensureVisible](qgraphicsitem.html#ensureVisible)()來確保文本是在所有視口中可見。 **See also** [toHtml](qgraphicstextitem.html#toHtml)( )[hasFocus](qgraphicsitem.html#hasFocus)()和[QGraphicsSimpleTextItem](qgraphicssimpletextitem.html)。 ``` QGraphicsTextItem.setOpenExternalLinks (self, bool?open) ``` ``` QGraphicsTextItem.setPlainText (self, QString?text) ``` 設置項的文本_text_。如果該項目具有鍵盤輸入焦點,此功能也將調用[ensureVisible](qgraphicsitem.html#ensureVisible)()來確保文本是在所有視口中可見。 **See also** [toHtml](qgraphicstextitem.html#toHtml)()和[hasFocus](qgraphicsitem.html#hasFocus)( ) 。 ``` QGraphicsTextItem.setTabChangesFocus (self, bool?b) ``` If _b_是真的,**Tab**鍵將導致小部件來改變焦點,否則, tab鍵將插入一個標籤到文檔中。 在某些情況下文本編輯不應該允許用戶輸入制表或改變使用的縮進**Tab**關鍵,因為這打破了焦點鏈。默認值為False 。 此功能被引入Qt的4.5 。 **See also** [tabChangesFocus](qgraphicstextitem.html#tabChangesFocus)( )[ItemIsFocusable](qgraphicsitem.html#GraphicsItemFlag-enum)和[textInteractionFlags](qgraphicstextitem.html#textInteractionFlags)( ) 。 ``` QGraphicsTextItem.setTextCursor (self, QTextCursor?cursor) ``` ``` QGraphicsTextItem.setTextInteractionFlags (self, Qt.TextInteractionFlags?flags) ``` 設置標志_flags_指定如何將文本項目應響應用戶的輸入。 默認為[QGraphicsTextItem](qgraphicstextitem.html) is [Qt.NoTextInteraction](qt.html#TextInteractionFlag-enum)。此功能也影響到[ItemIsFocusable](qgraphicsitem.html#GraphicsItemFlag-enum) [QGraphicsItem](qgraphicsitem.html)標志通過設置它,如果_flags_是從不同的[Qt.NoTextInteraction](qt.html#TextInteractionFlag-enum)并且清除它,否則。 默認情況下,文本是只讀的。改造項目到編輯器中,設置[Qt.TextEditable](qt.html#TextInteractionFlag-enum)標志。 **See also** [textInteractionFlags](qgraphicstextitem.html#textInteractionFlags)( ) 。 ``` QGraphicsTextItem.setTextWidth (self, float?width) ``` 設置項目的文本的首選寬度。如果實際文本比指定的寬度更寬那么它將被分成多行。 If _width_被設置為-1,則文本不會斷成多行,除非它是通過顯式換行符或一個新的段落執行。 默認值是-1 。 需要注意的是[QGraphicsTextItem](qgraphicstextitem.html)養了[QTextDocument](qtextdocument.html)在內部,它是用來計算文本寬度。 **See also** [textWidth](qgraphicstextitem.html#textWidth)()和[QTextDocument.setTextWidth](qtextdocument.html#textWidth-prop)( ) 。 ``` QPainterPath QGraphicsTextItem.shape (self) ``` [](qpainterpath.html) [從重新實現](qpainterpath.html)[QGraphicsItem.shape](qgraphicsitem.html#shape)( ) 。 ``` bool QGraphicsTextItem.tabChangesFocus (self) ``` 返回True如果**Tab**鍵將導致小部件來改變焦點,否則返回False 。 默認情況下,這種行為被禁止,這個函數將返回False 。 此功能被引入Qt的4.5 。 **See also** [setTabChangesFocus](qgraphicstextitem.html#setTabChangesFocus)( ) 。 ``` QTextCursor QGraphicsTextItem.textCursor (self) ``` [](qtextcursor.html) ``` Qt.TextInteractionFlags QGraphicsTextItem.textInteractionFlags (self) ``` [ 返回當前文本的互動標志。 ](index.htm) [**See also**](index.htm) [setTextInteractionFlags](qgraphicstextitem.html#setTextInteractionFlags)( ) 。 ``` float QGraphicsTextItem.textWidth (self) ``` 返回文本的寬度。 寬度的計算方法與[QTextDocument](qtextdocument.html)那[QGraphicsTextItem](qgraphicstextitem.html)內部保存。 **See also** [setTextWidth](qgraphicstextitem.html#setTextWidth)()和[QTextDocument.textWidth](qtextdocument.html#textWidth-prop)( ) 。 ``` QString QGraphicsTextItem.toHtml (self) ``` 返回項的文本轉換為HTML ,或空[QString](qstring.html)如果沒有文本已定。 **See also** [setHtml](qgraphicstextitem.html#setHtml)( ) 。 ``` QString QGraphicsTextItem.toPlainText (self) ``` 返回項的文本轉換為純文本或空[QString](qstring.html)如果沒有文本已定。 **See also** [setPlainText](qgraphicstextitem.html#setPlainText)( ) 。 ``` int QGraphicsTextItem.type (self) ``` 從重新實現[QGraphicsItem.type](qgraphicsitem.html#type)( ) 。 * * * ## Qt Signal Documentation ``` void linkActivated (const QString&) ``` 這是該信號的默認超載。 當用戶點擊一個文本項,它使一個鏈接這個信號被發射[Qt.LinksAccessibleByMouse](qt.html#TextInteractionFlag-enum) or [Qt.LinksAccessibleByKeyboard](qt.html#TextInteractionFlag-enum)。_link_是被點擊的鏈接。 **See also** [setTextInteractionFlags](qgraphicstextitem.html#setTextInteractionFlags)( ) 。 ``` void linkHovered (const QString&) ``` 這是該信號的默認超載。 當用戶將鼠標懸停在一個文本項,使一個鏈接這個信號被發射[Qt.LinksAccessibleByMouse](qt.html#TextInteractionFlag-enum)。_link_是被懸停在鏈接。 **See also** [setTextInteractionFlags](qgraphicstextitem.html#setTextInteractionFlags)( ) 。
                  <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>

                              哎呀哎呀视频在线观看