<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # QTextObjectInterface Class Reference ## [[QtGui](index.htm) module] 該QTextObjectInterface類允許自定義文本對象的圖形中[QTextDocument](qtextdocument.html)秒。[More...](#details) 通過繼承[QPyTextObject](qpytextobject.html)。 ### Methods * `__init__ (self)` * `__init__ (self, QTextObjectInterface)` * `drawObject (self, QPainter?painter, QRectF?rect, QTextDocument?doc, int?posInDocument, QTextFormat?format)` * `QSizeF intrinsicSize (self, QTextDocument?doc, int?posInDocument, QTextFormat?format)` * * * ## Detailed Description 該QTextObjectInterface類允許自定義文本對象的圖形中[QTextDocument](qtextdocument.html)秒。 文本對象描述的文本文檔中的一個或多個元素的結構,例如,從HTML導入的圖像是使用文本對象來實現。文本對象知道如何布局并繪制它的元素當一個文檔被渲染。 Qt的可自定義文本對象通過注冊一個自定義的被插入到文檔中[object type](qtextformat.html#objectType)同[QTextCharFormat](qtextcharformat.html)。一個QTextObjectInterface也必須對這種類型實施,并[registered](qabstracttextdocumentlayout.html#registerHandler)與[QAbstractTextDocumentLayout](qabstracttextdocumentlayout.html)文檔。當對象類型,而渲染遇到[QTextDocument](qtextdocument.html)時,[intrinsicSize](qtextobjectinterface.html#intrinsicSize)()和[drawObject](qtextobjectinterface.html#drawObject)()的接口的函數被調用。 下面的列表說明插入一個自定義的文本對象插入到文檔中所需的步驟: * Choose an _objectType_. The _objectType_ is an integer with a value greater or equal to [QTextFormat.UserObject](qtextformat.html#ObjectTypes-enum). * Create a [QTextCharFormat](qtextcharformat.html) object and set the object type to the chosen type using the setObjectType() function. * Implement the QTextObjectInterface class. * Call [QAbstractTextDocumentLayout.registerHandler](qabstracttextdocumentlayout.html#registerHandler)() with an instance of your QTextObjectInterface subclass to register your object type. * Insert [QChar.ObjectReplacementCharacter](qchar.html#SpecialCharacter-enum) with the aforementioned [QTextCharFormat](qtextcharformat.html) of the chosen object type into the document. As mentioned, the functions of QTextObjectInterface [intrinsicSize()](qtextobjectinterface.html#intrinsicSize) and [drawObject()](qtextobjectinterface.html#drawObject) will then be called with the [QTextFormat](qtextformat.html) as parameter whenever the replacement character is encountered. 一個類實現一個文本對象需要同時繼承[QObject](qobject.html)和QTextObjectInterface 。[QObject](qobject.html)必須是繼承了一流的。例如: ``` class SvgTextObject : public [QObject](qobject.html), public QTextObjectInterface { Q_OBJECT Q_INTERFACES(QTextObjectInterface) ``` 文本對象的數據通常存儲在[QTextCharFormat](qtextcharformat.html) using [QTextCharFormat.setProperty](qtextformat.html#setProperty)() ,然后用檢索[QTextCharFormat.property](qtextformat.html#property)( ) 。 **Warning:**復制和粘貼操作忽略自定義的文本對象。 * * * ## Method Documentation ``` QTextObjectInterface.__init__ (self) ``` ``` QTextObjectInterface.__init__ (self, QTextObjectInterface) ``` ``` QTextObjectInterface.drawObject (self, QPainter?painter, QRectF?rect, QTextDocument?doc, int?posInDocument, QTextFormat?format) ``` 這種方法是抽象的,應在任何子類中重新實現。 使用指定繪制這個文本對象_painter_。 該矩形的大小,_rect_,畫中是先前計算的大小[intrinsicSize](qtextobjectinterface.html#intrinsicSize)( ) 。矩形的位置是相對于_painter_。 您還可以得到該文件(_doc_)和位置(_posInDocument_的)的_format_該文件中。 **See also** [intrinsicSize](qtextobjectinterface.html#intrinsicSize)( ) 。 ``` QSizeF QTextObjectInterface.intrinsicSize (self, QTextDocument?doc, int?posInDocument, QTextFormat?format) ``` [ 這種方法是抽象的,應在任何子類中重新實現。 該intrinsicSize ( )函數返回所代表的文本對象的大小_format_給定的文件中(_doc_)在給定位置(_posInDocument_) 。 ](qsizef.html) [計算出的大小將用于后續調用](qsizef.html)[drawObject](qtextobjectinterface.html#drawObject)( )就本_format_。 **See also** [drawObject](qtextobjectinterface.html#drawObject)( ) 。
                  <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>

                              哎呀哎呀视频在线观看