QAbstractTextDocumentLayout::PaintContext Struct
struct QAbstractTextDocumentLayout::PaintContextQAbstractTextDocumentLayout::PaintContext 类是一个便利类,用于定义绘制文档布局时使用的参数。更多内容...
公共变量
| QRectF | clip |
| int | cursorPosition |
| QPalette | palette |
| QList<QAbstractTextDocumentLayout::Selection> | selections |
详细说明
当使用QAbstractTextDocumentLayout::draw() 函数为 QTextDocument 渲染自定义布局时,会使用绘制上下文。它由一个矩形(cursor position 、default text color 、clip )和一组selections 对象指定。
另请参阅 QAbstractTextDocumentLayout 。
成员变量文档
QRectF PaintContext::clip
该变量包含一个布局提示,用于指定段落、框架或文本周围需要绘制的区域。
该矩形之外的所有内容均无需绘制。
指定剪切矩形可以显著加快大型文档的绘制速度。请注意,剪切矩形采用的是文档坐标系(而非视口坐标系)。它不能替代绘图器上设置的剪切区域,而仅仅是一个提示。
默认值是一个空矩形,表示需要绘制所有内容。
int PaintContext::cursorPosition
该变量存储文档中应绘制光标线的位置。
默认值为 -1。
QPalette PaintContext::palette
当未指定颜色时,该变量保存用于文本的默认颜色。
其默认值为应用程序的默认调色板。
QList<QAbstractTextDocumentLayout::Selection> PaintContext::selections
该变量存储了一组选中项,当将此绘制上下文传递给QAbstractTextDocumentLayout 的draw()函数时,这些选中项将被渲染。
默认值是一个空列表,表示没有选择项。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.