<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之旅 廣告
                # QTextLayout Class Reference ## [[QtGui](index.htm) module] 該QTextLayout類用于布局并呈現文本。[More...](#details) ### Types * `enum CursorMode { SkipCharacters, SkipWords }` * `class **[FormatRange](index.htm)**` ### Methods * `__init__ (self)` * `__init__ (self, QString?text)` * `__init__ (self, QString?text, QFont?font, QPaintDevice?paintDevice?=?None)` * `__init__ (self, QTextBlock?b)` * `list-of-QTextLayout.FormatRange additionalFormats (self)` * `beginLayout (self)` * `QRectF boundingRect (self)` * `bool cacheEnabled (self)` * `clearAdditionalFormats (self)` * `clearLayout (self)` * `QTextLine createLine (self)` * `Qt.CursorMoveStyle cursorMoveStyle (self)` * `draw (self, QPainter?p, QPointF?pos, list-of-QTextLayout.FormatRange?selections?=?list-of-QTextLayout.FormatRange, QRectF?clip?=?QRectF())` * `drawCursor (self, QPainter?p, QPointF?pos, int?cursorPosition)` * `drawCursor (self, QPainter?p, QPointF?pos, int?cursorPosition, int?width)` * `endLayout (self)` * `QFont font (self)` * `list-of-QGlyphRun glyphRuns (self)` * `bool isValidCursorPosition (self, int?pos)` * `int leftCursorPosition (self, int?oldPos)` * `QTextLine lineAt (self, int?i)` * `int lineCount (self)` * `QTextLine lineForTextPosition (self, int?pos)` * `float maximumWidth (self)` * `float minimumWidth (self)` * `int nextCursorPosition (self, int?oldPos, CursorMode?mode?=?QTextLayout.SkipCharacters)` * `QPointF position (self)` * `int preeditAreaPosition (self)` * `QString preeditAreaText (self)` * `int previousCursorPosition (self, int?oldPos, CursorMode?mode?=?QTextLayout.SkipCharacters)` * `int rightCursorPosition (self, int?oldPos)` * `setAdditionalFormats (self, list-of-QTextLayout.FormatRange?overrides)` * `setCacheEnabled (self, bool?enable)` * `setCursorMoveStyle (self, Qt.CursorMoveStyle?style)` * `setFont (self, QFont?f)` * `setPosition (self, QPointF?p)` * `setPreeditArea (self, int?position, QString?text)` * `setText (self, QString?string)` * `setTextOption (self, QTextOption?option)` * `QString text (self)` * `QTextOption textOption (self)` * * * ## Detailed Description 該QTextLayout類用于布局并呈現文本。 它提供了從現代文字排版引擎預期的許多功能,包括Unicode標準的渲染,斷行和處理游標定位。它也可以產生并呈現獨立于設備的布局,東西是所見即所得的應用非常重要。 這個類有一個相當低級別的API ,除非你打算實現自己的文本呈現為一些專門的小工具,你可能不會需要直接使用它。 QTextLayout可以同時用于普通和豐富的文本。 QTextLayout可以被用來創建一個序列[QTextLine](qtextline.html)用實例給出的寬度,并且可以在屏幕上獨立地放置它們。一旦布局完成,這些線可以得出一個油漆設備上。 進行布局的文本可以在構造函數中提供或設置[setText](qtextlayout.html#setText)( ) 。 布局可以被看作是一個序列[QTextLine](qtextline.html)對象;使用[createLine](qtextlayout.html#createLine)( )來創建一個[QTextLine](qtextline.html)例如,與[lineAt](qtextlayout.html#lineAt)()或[lineForTextPosition](qtextlayout.html#lineForTextPosition)( )來檢索創建的行。 下面是一個代碼片段,演示了布局階段: ``` int leading = fontMetrics.leading(); [qreal](index.htm#qreal-typedef) height = 0; textLayout.beginLayout(); while (1) { [QTextLine](qtextline.html) line = textLayout.createLine(); if (!line.isValid()) break; line.setLineWidth(lineWidth); height += leading; line.setPosition([QPointF](qpointf.html)(0, height)); height += line.height(); } textLayout.endLayout(); ``` 文字可以再通過調用布局的呈現[draw](qtextlayout.html#draw)( )函數: ``` [QPainter](qpainter.html) painter(this); textLayout.draw(&painter, [QPoint](qpoint.html)(0, 0)); ``` 文本中的一個給定的位置,你可以找到一個有效的光標位置與[isValidCursorPosition](qtextlayout.html#isValidCursorPosition)( )[nextCursorPosition](qtextlayout.html#nextCursorPosition)()和[previousCursorPosition](qtextlayout.html#previousCursorPosition)( ) 。 該QTextLayout本身可被定位以[setPosition](qtextlayout.html#setPosition)() ,它有一個[boundingRect](qtextlayout.html#boundingRect)() ,和一個[minimumWidth](qtextlayout.html#minimumWidth)()和一個[maximumWidth](qtextlayout.html#maximumWidth)( ) 。 * * * ## Type Documentation ``` QTextLayout.CursorMode ``` | Constant | Value | | --- | --- | | `QTextLayout.SkipCharacters` | `0` | | `QTextLayout.SkipWords` | `1` | * * * ## Method Documentation ``` QTextLayout.__init__ (self) ``` 構造一個空的文本布局。 **See also** [setText](qtextlayout.html#setText)( ) 。 ``` QTextLayout.__init__ (self, QString?text) ``` 構造一個文本布局奠定了給定的_text_。 ``` QTextLayout.__init__ (self, QString?text, QFont?font, QPaintDevice?paintDevice?=?None) ``` 構造一個文本布局奠定了給定的_text_用指定的_font_。 所有的度量和布局計算將在繪制設備的條款進行,_paintdevice_。如果_paintdevice_為0計算將在屏幕上的指標來完成。 ``` QTextLayout.__init__ (self, QTextBlock?b) ``` ``` list-of-QTextLayout.FormatRange QTextLayout.additionalFormats (self) ``` 返回由文本布局支持其他格式的列表。 **See also** [setAdditionalFormats](qtextlayout.html#setAdditionalFormats)()和[clearAdditionalFormats](qtextlayout.html#clearAdditionalFormats)( ) 。 ``` QTextLayout.beginLayout (self) ``` 開始布局過程。 **See also** [endLayout](qtextlayout.html#endLayout)( ) 。 ``` QRectF QTextLayout.boundingRect (self) ``` [ 最小的矩形包含在布局的所有行。 ``` bool QTextLayout.cacheEnabled (self) ``` 返回True如果完整的布局信息被緩存,否則返回False 。 ](qrectf.html) [**See also**](qrectf.html) [setCacheEnabled](qtextlayout.html#setCacheEnabled)( ) 。 ``` QTextLayout.clearAdditionalFormats (self) ``` 清除由文本布局支持其他格式的列表。 **See also** [additionalFormats](qtextlayout.html#additionalFormats)()和[setAdditionalFormats](qtextlayout.html#setAdditionalFormats)( ) 。 ``` QTextLayout.clearLayout (self) ``` 清除布局的線路信息。已調用該函數后,[lineCount](qtextlayout.html#lineCount)( )返回0 。 此功能被引入Qt的4.4 。 ``` QTextLine QTextLayout.createLine (self) ``` [ 返回一個新的文本行進行布局,如果有文本被插入到布局,否則返回一個無效的文本行。 ](qtextline.html) [文本布局創建布局的最后一行之后開始,或如果布局是空的開始一個新行的對象。布局維護內部光標,每行充滿了文本從光標所在位置開始的時候](qtextline.html)[QTextLine.setLineWidth](qtextline.html#setLineWidth)( )函數被調用。 一旦[QTextLine.setLineWidth](qtextline.html#setLineWidth)()被調用時,一個新的行可以被創建和填充文本。重復這個過程會布置文本包含在整個區塊[QTextLayout](qtextlayout.html)。如果沒有文本左被插入到布局,[QTextLine](qtextline.html)返回的將是無效的(參考isValid ( )將返回False ) 。 ``` Qt.CursorMoveStyle QTextLayout.cursorMoveStyle (self) ``` [](qt.html#CursorMoveStyle-enum) [這樣做的光標運動風格](qt.html#CursorMoveStyle-enum)[QTextLayout](qtextlayout.html)。默認值是[Qt.LogicalMoveStyle](qt.html#CursorMoveStyle-enum)。 此功能被引入Qt的4.8 。 **See also** [setCursorMoveStyle](qtextlayout.html#setCursorMoveStyle)( ) 。 ``` QTextLayout.draw (self, QPainter?p, QPointF?pos, list-of-QTextLayout.FormatRange?selections?=?list-of-QTextLayout.FormatRange, QRectF?clip?=?QRectF()) ``` 繪制整個布局上的畫家_p_在所指定的位置_pos_。所呈現的布局包括給定的_selections_并通過指定的矩形內裁剪_clip_。 ``` QTextLayout.drawCursor (self, QPainter?p, QPointF?pos, int?cursorPosition) ``` 繪制文本光標與當前的畫筆和指定_width_在給定的_position_使用_painter_規定。在文本中的相應位置被指定_cursorPosition_。 ``` QTextLayout.drawCursor (self, QPainter?p, QPointF?pos, int?cursorPosition, int?width) ``` 這是一個重載函數。 繪制文本光標與當前的畫筆在給定的_position_使用_painter_規定。在文本中的相應位置被指定_cursorPosition_。 ``` QTextLayout.endLayout (self) ``` 結束的布局過程。 **See also** [beginLayout](qtextlayout.html#beginLayout)( ) 。 ``` QFont QTextLayout.font (self) ``` [ 返回當前字體是用于布局,或一個默認的字體,如果沒有被設置。 ](qfont.html) [**See also**](qfont.html) [setFont](qtextlayout.html#setFont)( ) 。 ``` list-of-QGlyphRun QTextLayout.glyphRuns (self) ``` 返回所有字形的字形索引和位置在這[QTextLayout](qtextlayout.html)。這是一個昂貴的功能,并且不應該被稱為在一個時間敏感的上下文。 此功能被引入Qt的4.8 。 **See also** [draw](qtextlayout.html#draw)()和[QPainter.drawGlyphRun](qpainter.html#drawGlyphRun)( ) 。 ``` bool QTextLayout.isValidCursorPosition (self, int?pos) ``` /返回True如果位置_pos_是一個有效的光標位置。 在Unicode上下文中的文字部分職位是無效的光標位置,因為該位置是一個Unicode代理或字形集群內。 一字形群集是兩個或兩個以上構成屏幕上的一個不可分割的實體Unicode字符序列。例如拉丁字符`A ( 0X41 ) ,以及結合diaresis ( 0x308 ) '可以在Unicode中由兩個字符, 'A來表示' 。文本光標只能有效地定位之前或之后,這兩個人物,他們之間從來沒有因為這沒有任何意義。在印度語每一個音節構成字形集群。 ``` int QTextLayout.leftCursorPosition (self, int?oldPos) ``` 返回光標位置的左邊_oldPos_,在它旁邊。該位置是依賴于字符的視覺位置,后雙向重新排序。 此功能被引入Qt的4.8 。 **See also** [rightCursorPosition](qtextlayout.html#rightCursorPosition)()和[previousCursorPosition](qtextlayout.html#previousCursorPosition)( ) 。 ``` QTextLine QTextLayout.lineAt (self, int?i) ``` [ 返回_i_個線在這個文本布局的文本。 ](qtextline.html) [**See also**](qtextline.html) [lineCount](qtextlayout.html#lineCount)()和[lineForTextPosition](qtextlayout.html#lineForTextPosition)( ) 。 ``` int QTextLayout.lineCount (self) ``` 返回總行在這個文本布局的數量。 **See also** [lineAt](qtextlayout.html#lineAt)( ) 。 ``` QTextLine QTextLayout.lineForTextPosition (self, int?pos) ``` [ 返回包含由指定的光標位置的行_pos_。 ](qtextline.html) [**See also**](qtextline.html) [isValidCursorPosition](qtextlayout.html#isValidCursorPosition)()和[lineAt](qtextlayout.html#lineAt)( ) 。 ``` float QTextLayout.maximumWidth (self) ``` 最大寬度的布局可能會擴大到,這基本上是整個文本的寬度。 **Warning:**這個函數只返回一個有效的值的布局已經完成之后。 **See also** [minimumWidth](qtextlayout.html#minimumWidth)( ) 。 ``` float QTextLayout.minimumWidth (self) ``` 最小寬度的布局需要。這是布局的最小的非易碎的子串的寬度。 **Warning:**這個函數只返回一個有效的值的布局已經完成之后。 **See also** [maximumWidth](qtextlayout.html#maximumWidth)( ) 。 ``` int QTextLayout.nextCursorPosition (self, int?oldPos, CursorMode?mode?=?QTextLayout.SkipCharacters) ``` 后返回下一個有效的光標位置_oldPos_尊重給定的游標_mode_。的回報價值_oldPos_如果_oldPos_不是一個有效的光標位置。 **See also** [isValidCursorPosition](qtextlayout.html#isValidCursorPosition)()和[previousCursorPosition](qtextlayout.html#previousCursorPosition)( ) 。 ``` QPointF QTextLayout.position (self) ``` [ 布局的全球地位。這是獨立于布局過程中的邊界矩形和。 這個函數中引入了Qt 4.2中。 ](qpointf.html) [**See also**](qpointf.html) [setPosition](qtextlayout.html#setPosition)( ) 。 ``` int QTextLayout.preeditAreaPosition (self) ``` 返回編輯發生之前,將待處理的文本布局的區域的位置。 **See also** [preeditAreaText](qtextlayout.html#preeditAreaText)( ) 。 ``` QString QTextLayout.preeditAreaText (self) ``` 返回插入在布局編輯發生前的文本。 **See also** [preeditAreaPosition](qtextlayout.html#preeditAreaPosition)( ) 。 ``` int QTextLayout.previousCursorPosition (self, int?oldPos, CursorMode?mode?=?QTextLayout.SkipCharacters) ``` 返回前的第一個有效的光標位置_oldPos_尊重給定的游標_mode_。的回報價值_oldPos_如果_oldPos_不是一個有效的光標位置。 **See also** [isValidCursorPosition](qtextlayout.html#isValidCursorPosition)()和[nextCursorPosition](qtextlayout.html#nextCursorPosition)( ) 。 ``` int QTextLayout.rightCursorPosition (self, int?oldPos) ``` 返回光標位置的右側_oldPos_,在它旁邊。該位置是依賴于字符的視覺位置,后雙向重新排序。 此功能被引入Qt的4.8 。 **See also** [leftCursorPosition](qtextlayout.html#leftCursorPosition)()和[nextCursorPosition](qtextlayout.html#nextCursorPosition)( ) 。 ``` QTextLayout.setAdditionalFormats (self, list-of-QTextLayout.FormatRange?overrides) ``` 設置由文本布局,以支持更多的格式_formatList_。 **See also** [additionalFormats](qtextlayout.html#additionalFormats)()和[clearAdditionalFormats](qtextlayout.html#clearAdditionalFormats)( ) 。 ``` QTextLayout.setCacheEnabled (self, bool?enable) ``` 啟用的完整布局信息,如果緩存_enable_為True,否則將禁用布局緩存。平時[QTextLayout](qtextlayout.html)調用后拋出的大部分布點信息了[endLayout](qtextlayout.html#endLayout)()來減少內存消耗。但是,如果你要繪制奠定了文字后直接啟用緩存可能會加快顯著繪圖。 **See also** [cacheEnabled](qtextlayout.html#cacheEnabled)( ) 。 ``` QTextLayout.setCursorMoveStyle (self, Qt.CursorMoveStyle?style) ``` 設置光標的運動風格。如果[QTextLayout](qtextlayout.html)由文件的支持,你可以忽略這一點,在使用該選項[QTextDocument](qtextdocument.html),這個選項對于像小部件[QLineEdit](qlineedit.html)或自定義部件沒有[QTextDocument](qtextdocument.html)。默認值是[Qt.LogicalMoveStyle](qt.html#CursorMoveStyle-enum)。 此功能被引入Qt的4.8 。 **See also** [cursorMoveStyle](qtextlayout.html#cursorMoveStyle)( ) 。 ``` QTextLayout.setFont (self, QFont?f) ``` 設置布局的字體給定的_font_。布局是無效的,必須重新布局。 **See also** [font](qtextlayout.html#font)( ) 。 ``` QTextLayout.setPosition (self, QPointF?p) ``` 將文本布局指向_p_。 **See also** [position](qtextlayout.html#position)( ) 。 ``` QTextLayout.setPreeditArea (self, int?position, QString?text) ``` 設置_position_和_text_編輯發生之前被處理在布局區域。 **See also** [preeditAreaPosition](qtextlayout.html#preeditAreaPosition)()和[preeditAreaText](qtextlayout.html#preeditAreaText)( ) 。 ``` QTextLayout.setText (self, QString?string) ``` 設置布局的文本給定的_string_。布局是無效的,必須重新布局。 當使用這種注意[QTextLayout](qtextlayout.html)作為一個部分[QTextDocument](qtextdocument.html)這種方法不會有任何影響。 **See also** [text](qtextlayout.html#text)( ) 。 ``` QTextLayout.setTextOption (self, QTextOption?option) ``` 設置文本選項的結構,控制布局過程中給定的_option_。 **See also** [textOption](qtextlayout.html#textOption)( ) 。 ``` QString QTextLayout.text (self) ``` 返回布局的文本。 **See also** [setText](qtextlayout.html#setText)( ) 。 ``` QTextOption QTextLayout.textOption (self) ``` [ 返回用于控制布局過程中的當前文本選項。 ](qtextoption.html) [**See also**](qtextoption.html) [setTextOption](qtextlayout.html#setTextOption)( ) 。
                  <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>

                              哎呀哎呀视频在线观看