|
QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
|
表示文本的类 更多...
#include <qwt_text.h>
类 | |
| class | LayoutCache |
| class | PrivateData |
Public 类型 | |
| enum | TextFormat { AutoText = 0 , PlainText , RichText , MathMLText , TeXText , OtherFormat = 100 } |
| 文本格式 更多... | |
| enum | PaintAttribute { PaintUsingTextFont = 0x01 , PaintUsingTextColor = 0x02 , PaintBackground = 0x04 } |
| 绘制属性 更多... | |
| enum | LayoutAttribute { MinimumLayout = 0x01 } |
| 布局属性 布局属性影响文本布局的某些方面。 更多... | |
Public 成员函数 | |
| QwtText () | |
| 默认构造函数 | |
| QwtText (const QString &, TextFormat textFormat=AutoText) | |
| 构造函数 | |
| QwtText (const QwtText &) | |
| 拷贝构造函数 | |
| ~QwtText () | |
| 析构函数 | |
| QwtText & | operator= (const QwtText &) |
| 赋值运算符 | |
| bool | operator== (const QwtText &) const |
| 相等运算符 | |
| bool | operator!= (const QwtText &) const |
| 不等运算符 | |
| void | setText (const QString &, QwtText::TextFormat textFormat=AutoText) |
| 分配新的文本内容 | |
| QString | text () const |
| 获取文本作为 QString | |
| bool | isNull () const |
| 检查文本是否为空 | |
| bool | isEmpty () const |
| 检查文本是否为空字符串 | |
| void | setFont (const QFont &) |
| 设置字体 | |
| QFont | font () const |
| 获取字体 | |
| QFont | usedFont (const QFont &) const |
| 返回文本的字体,如果有则返回,否则返回 defaultFont | |
| TextFormat | format () const |
| 返回文本的格式 | |
| void | setRenderFlags (int) |
| 更改渲染标志 | |
| int | renderFlags () const |
| 获取渲染标志 | |
| void | setColor (const QColor &) |
| 设置用于绘制文本的画笔颜色 | |
| QColor | color () const |
| 获取用于绘制文本的画笔颜色 | |
| QColor | usedColor (const QColor &) const |
| 返回文本的颜色,如果有则返回,否则返回 defaultColor | |
| void | setBorderRadius (double) |
| 设置边框框架角的半径 | |
| double | borderRadius () const |
| 获取边框框架角的半径 | |
| void | setBorderPen (const QPen &) |
| 设置背景画笔(边框画笔) | |
| QPen | borderPen () const |
| 获取背景画笔(边框画笔) | |
| void | setBackgroundBrush (const QBrush &) |
| 设置背景画刷 | |
| QBrush | backgroundBrush () const |
| 获取背景画刷 | |
| void | setPaintAttribute (PaintAttribute, bool on=true) |
| 更改绘制属性 | |
| bool | testPaintAttribute (PaintAttribute) const |
| 测试绘制属性 | |
| void | setLayoutAttribute (LayoutAttribute, bool on=true) |
| 更改布局属性 | |
| bool | testLayoutAttribute (LayoutAttribute) const |
| 测试布局属性 | |
| double | heightForWidth (double width) const |
| 计算给定宽度的高度 | |
| double | heightForWidth (double width, const QFont &) const |
| 计算给定宽度的高度 | |
| QSizeF | textSize () const |
| 返回渲染文本所需的尺寸 | |
| QSizeF | textSize (const QFont &) const |
| 返回渲染文本所需的尺寸 | |
| void | draw (QPainter *painter, const QRectF &rect) const |
| 在矩形区域内绘制文本 | |
静态 Public 成员函数 | |
| static const QwtTextEngine * | textEngine (const QString &text, QwtText::TextFormat=AutoText) |
| 查找文本格式对应的文本引擎 | |
| static const QwtTextEngine * | textEngine (QwtText::TextFormat) |
| 查找文本格式对应的文本引擎 | |
| static void | setTextEngine (QwtText::TextFormat, QwtTextEngine *) |
| 为文本格式分配/替换文本引擎 | |
表示文本的类
| enum QwtText::TextFormat |
文本格式
| 枚举值 | |
|---|---|
| AutoText | 使用 QwtTextEngine::mightRender() 对所有可用的文本引擎按递增顺序 > PlainText 确定文本格式。 如果没有文本引擎可以渲染文本,则像 QwtText::PlainText 一样渲染。 |
| PlainText | 使用 QwtPlainTextEngine 按原样绘制文本。 |
| RichText | 使用 Scribe 框架(Qt 富文本)渲染文本。 |
| MathMLText | 使用 MathML (http://en.wikipedia.org/wiki/MathML) 渲染引擎显示文本。 在 Qwt 的早期版本中包含这样一个引擎 - 从 Qwt 6.2 开始可以在这里找到: https://github.com/uwerat/qwt-mml-dev 要启用 MathML 支持,需要将以下代码添加到应用程序中: static void setTextEngine(QwtText::TextFormat, QwtTextEngine *) 为文本格式分配/替换文本引擎 Definition qwt_text.cpp:1002 |
| TeXText | 使用 TeX (http://en.wikipedia.org/wiki/TeX) 渲染引擎显示文本(尚未实现)。 |
| OtherFormat | 可以使用 setTextEngine 扩展文本格式的数量。 格式 >= QwtText::OtherFormat 不被 Qwt 使用。 |
| QwtText::QwtText | ( | ) |
默认构造函数
| QwtText::QwtText | ( | const QString & | text, |
| QwtText::TextFormat | textFormat = AutoText |
||
| ) |
构造函数
| QwtText::QwtText | ( | const QwtText & | other | ) |
拷贝构造函数
| QwtText::~QwtText | ( | ) |
析构函数
| QBrush QwtText::backgroundBrush | ( | ) | const |
获取背景画刷
| QPen QwtText::borderPen | ( | ) | const |
获取背景画笔(边框画笔)
| double QwtText::borderRadius | ( | ) | const |
获取边框框架角的半径
| QColor QwtText::color | ( | ) | const |
获取用于绘制文本的画笔颜色
| void QwtText::draw | ( | QPainter * | painter, |
| const QRectF & | rect | ||
| ) | const |
在矩形区域内绘制文本
| QFont QwtText::font | ( | ) | const |
获取字体
| QwtText::TextFormat QwtText::format | ( | ) | const |
返回文本的格式
| double QwtText::heightForWidth | ( | double | width | ) | const |
计算给定宽度的高度
| double QwtText::heightForWidth | ( | double | width, |
| const QFont & | defaultFont | ||
| ) | const |
计算给定宽度的高度
| bool QwtText::isEmpty | ( | ) | const |
检查文本是否为空字符串
| bool QwtText::isNull | ( | ) | const |
检查文本是否为空
| bool QwtText::operator!= | ( | const QwtText & | other | ) | const |
不等运算符
| bool QwtText::operator== | ( | const QwtText & | other | ) | const |
相等运算符
| int QwtText::renderFlags | ( | ) | const |
获取渲染标志
| void QwtText::setBackgroundBrush | ( | const QBrush & | brush | ) |
设置背景画刷
| void QwtText::setBorderPen | ( | const QPen & | pen | ) |
设置背景画笔(边框画笔)
| void QwtText::setBorderRadius | ( | double | radius | ) |
设置边框框架角的半径
| void QwtText::setColor | ( | const QColor & | color | ) |
设置用于绘制文本的画笔颜色
| void QwtText::setFont | ( | const QFont & | font | ) |
设置字体
| void QwtText::setLayoutAttribute | ( | LayoutAttribute | attribute, |
| bool | on = true |
||
| ) |
更改布局属性
| void QwtText::setPaintAttribute | ( | PaintAttribute | attribute, |
| bool | on = true |
||
| ) |
更改绘制属性
| void QwtText::setRenderFlags | ( | int | renderFlags | ) |
更改渲染标志
| void QwtText::setText | ( | const QString & | text, |
| QwtText::TextFormat | textFormat = AutoText |
||
| ) |
分配新的文本内容
|
static |
为文本格式分配/替换文本引擎
| bool QwtText::testLayoutAttribute | ( | LayoutAttribute | attribute | ) | const |
测试布局属性
| bool QwtText::testPaintAttribute | ( | PaintAttribute | attribute | ) | const |
测试绘制属性
| QString QwtText::text | ( | ) | const |
获取文本作为 QString
|
static |
查找文本格式对应的文本引擎
|
static |
查找文本格式对应的文本引擎
| QSizeF QwtText::textSize | ( | ) | const |
返回渲染文本所需的尺寸
| QSizeF QwtText::textSize | ( | const QFont & | defaultFont | ) | const |
返回渲染文本所需的尺寸
| QColor QwtText::usedColor | ( | const QColor & | defaultColor | ) | const |
返回文本的颜色,如果有则返回,否则返回 defaultColor
| QFont QwtText::usedFont | ( | const QFont & | defaultFont | ) | const |
返回文本的字体,如果有则返回,否则返回 defaultFont