QTextFormat Class
QTextFormat 类为QTextDocument...提供格式化信息。
头文件: | #include <QTextFormat> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
继承者: | QTextBlockFormat,QTextCharFormat,QTextFrameFormat, 以及QTextListFormat |
- 所有成员(包括继承成员)的列表
- QTextFormat 属于富文本处理 API和隐式共享类。
注意:该类中的所有函数都是可重入的。
公共类型
enum | FormatType { InvalidFormat, BlockFormat, CharFormat, ListFormat, FrameFormat, UserFormat } |
enum | ObjectTypes { NoObject, ImageObject, TableObject, TableCellObject, UserObject } |
enum | PageBreakFlag { PageBreak_Auto, PageBreak_AlwaysBefore, PageBreak_AlwaysAfter } |
flags | PageBreakFlags |
enum | Property { ObjectIndex, CssFloat, LayoutDirection, OutlinePen, ForegroundBrush, …, UserProperty } |
公共函数
QTextFormat() | |
QTextFormat(int type) | |
QTextFormat(const QTextFormat &other) | |
~QTextFormat() | |
QBrush | background() const |
bool | boolProperty(int propertyId) const |
QBrush | brushProperty(int propertyId) const |
void | clearBackground() |
void | clearForeground() |
void | clearProperty(int propertyId) |
QColor | colorProperty(int propertyId) const |
qreal | doubleProperty(int propertyId) const |
QBrush | foreground() const |
bool | hasProperty(int propertyId) const |
int | intProperty(int propertyId) const |
bool | isBlockFormat() const |
bool | isCharFormat() const |
bool | isEmpty() const |
bool | isFrameFormat() const |
bool | isImageFormat() const |
bool | isListFormat() const |
bool | isTableCellFormat() const |
bool | isTableFormat() const |
bool | isValid() const |
Qt::LayoutDirection | layoutDirection() const |
QTextLength | lengthProperty(int propertyId) const |
QList<QTextLength> | lengthVectorProperty(int propertyId) const |
void | merge(const QTextFormat &other) |
int | objectIndex() const |
int | objectType() const |
QPen | penProperty(int propertyId) const |
QMap<int, QVariant> | properties() const |
QVariant | property(int propertyId) const |
int | propertyCount() const |
void | setBackground(const QBrush &brush) |
void | setForeground(const QBrush &brush) |
void | setLayoutDirection(Qt::LayoutDirection direction) |
void | setObjectIndex(int index) |
void | setObjectType(int type) |
void | setProperty(int propertyId, const QList<QTextLength> &value) |
void | setProperty(int propertyId, const QVariant &value) |
QString | stringProperty(int propertyId) const |
void | swap(QTextFormat &other) |
QTextBlockFormat | toBlockFormat() const |
QTextCharFormat | toCharFormat() const |
QTextFrameFormat | toFrameFormat() const |
QTextImageFormat | toImageFormat() const |
QTextListFormat | toListFormat() const |
QTextTableCellFormat | toTableCellFormat() const |
QTextTableFormat | toTableFormat() const |
int | type() const |
QVariant | operator QVariant() const |
bool | operator!=(const QTextFormat &other) const |
QTextFormat & | operator=(const QTextFormat &other) |
bool | operator==(const QTextFormat &other) const |
详细说明
QTextFormat 是一个通用类,用于描述QTextDocument 中各部分的格式。派生类QTextCharFormat,QTextBlockFormat,QTextListFormat, 和QTextTableFormat 通常更有用,它们描述了应用于文档特定部分的格式。
格式有一个FormatType
,它指定了格式化文本项的种类,如文本块、列表、表格等。格式还有各种属性(有些是特定格式类型的特有属性),这些属性由属性枚举描述。每个属性都有一个对应的属性。
格式类型由type() 给出,格式可以通过isCharFormat(),isBlockFormat(),isListFormat(),isTableFormat(),isFrameFormat() 和isImageFormat() 进行测试。如果类型已确定,则可使用toCharFormat(),toBlockFormat(),toListFormat(),toTableFormat(),toFrameFormat(), 和toImageFormat() 进行检索。
格式的属性可以用setProperty() 函数设置,也可以用boolProperty() 、intProperty() 、doubleProperty() 和stringProperty() 检索。使用 allPropertyIds() 可以检索格式中使用的所有属性 ID。可以使用merge() 将一种格式合并到另一种格式中。
格式的对象索引可以用setObjectIndex() 设置,也可以用objectIndex() 检索。这些方法可用于将格式与QTextObject 关联起来。它可用于在文档中表示列表、框架和表格。
另请参阅 富文本处理。
成员类型文档
enum QTextFormat::FormatType
该枚举描述QTextFormat 对象正在格式化的文本项目。
常量 | 值 | 说明 |
---|---|---|
QTextFormat::InvalidFormat | -1 | 默认构造函数创建的无效格式 |
QTextFormat::BlockFormat | 1 | 对象格式为文本块 |
QTextFormat::CharFormat | 2 | 对象格式为单个字符 |
QTextFormat::ListFormat | 3 | 对象格式为列表 |
QTextFormat::FrameFormat | 5 | 对象格式为帧 |
QTextFormat::UserFormat | 100 |
另请参阅 QTextCharFormat,QTextBlockFormat,QTextListFormat,QTextTableFormat 和type() 。
enum QTextFormat::ObjectTypes
该枚举描述了该格式与哪种QTextObject 关联。
常量 | 值 | 描述 |
---|---|---|
QTextFormat::NoObject | 0 | |
QTextFormat::ImageObject | 1 | |
QTextFormat::TableObject | 2 | |
QTextFormat::TableCellObject | 3 | |
QTextFormat::UserObject | 0x1000 | 第一个可用于特定应用目的的对象。 |
另请参阅 QTextObject,QTextTable, 和QTextObject::format() 。
枚举 QTextFormat::PageBreakFlag
flags QTextFormat::PageBreakFlags
该枚举描述了打印时如何进行分页。它映射到相应的 css 属性。
常量 | 值 | 说明 |
---|---|---|
QTextFormat::PageBreak_Auto | 0 | 自动分页取决于当前页面的可用空间 |
QTextFormat::PageBreak_AlwaysBefore | 0x001 | 页面总是在段落/表格之前分页 |
QTextFormat::PageBreak_AlwaysAfter | 0x010 | 新页面总是在段落/表格之后开始 |
PageBreakFlags 类型是QFlags<PageBreakFlag> 的类型定义。它存储 PageBreakFlag 值的 OR 组合。
另请参阅 QTextBlockFormat::pageBreakPolicy(),QTextFrameFormat::pageBreakPolicy() 和PageBreakPolicy 。
enum QTextFormat::Property
该枚举描述了格式可能具有的不同属性。
常量 | 值 | 说明 |
---|---|---|
QTextFormat::ObjectIndex | 0x0 | 格式化对象的索引。请参见objectIndex()。 |
段落和字符属性
常数 | 值 | 说明 |
---|---|---|
QTextFormat::CssFloat | 0x0800 | 框架相对于周围文本的位置 |
QTextFormat::LayoutDirection | 0x0801 | 文档中文本的布局方向 (Qt::LayoutDirection)。 |
QTextFormat::OutlinePen | 0x810 | |
QTextFormat::ForegroundBrush | 0x821 | |
QTextFormat::BackgroundBrush | 0x820 | |
QTextFormat::BackgroundImageUrl | 0x823 |
段落属性
常量 | 值 | 说明 |
---|---|---|
QTextFormat::BlockAlignment | 0x1010 | |
QTextFormat::BlockTopMargin | 0x1030 | |
QTextFormat::BlockBottomMargin | 0x1031 | |
QTextFormat::BlockLeftMargin | 0x1032 | |
QTextFormat::BlockRightMargin | 0x1033 | |
QTextFormat::TextIndent | 0x1034 | |
QTextFormat::TabPositions | 0x1035 | 指定制表符位置。制表符位置是QTextOption::Tab 的结构,存储在QList 中(内部存储在QList<QVariant> 中)。 |
QTextFormat::BlockIndent | 0x1040 | |
QTextFormat::LineHeight | 0x1048 | |
QTextFormat::LineHeightType | 0x1049 | |
QTextFormat::BlockNonBreakableLines | 0x1050 | |
QTextFormat::BlockTrailingHorizontalRulerWidth | 0x1060 | 水平标尺元素的宽度。 |
QTextFormat::HeadingLevel | 0x1070 | 标题的级别,例如 1 对应 HTML H1 标记;否则为 0。该枚举值已在 Qt 5.12 中添加。 |
QTextFormat::BlockCodeFence | 0x1091 | Markdown 代码块周围的 "栅栏 "中使用的字符。如果代码块是缩进而非栅栏,则该代码块不应具有此属性。Qt 5.14 中添加了此枚举值。 |
QTextFormat::BlockQuoteLevel | 0x1080 | 该代码块上嵌套引号的深度:1 表示该代码块是顶级块引号。不是分块引号的块不应具有此属性。此枚举值已在 Qt 5.14 中添加。 |
QTextFormat::BlockCodeLanguage | 0x1090 | 预格式块或代码块中的编程语言。不包含代码的块不应具有此属性。该枚举值已在 Qt 5.14 中添加。 |
QTextFormat::BlockMarker | 0x10A0 | 块旁边显示的type of adornment 。此枚举值已在 Qt 5.14 中添加。 |
字符属性
常量 | 值 | 说明 |
---|---|---|
QTextFormat::FontFamily | 0x2000 | e{此属性已被弃用}。请使用 QTextFormat::FontFamilies 代替。 |
QTextFormat::FontFamilies | 0x1FE7 | |
QTextFormat::FontStyleName | 0x1FE8 | |
QTextFormat::FontPointSize | 0x2001 | |
QTextFormat::FontPixelSize | 0x2009 | |
QTextFormat::FontSizeAdjustment | 0x2002 | 指定已使用 FontPointSize 或 FontPixelSize 设置的字体大小的变化。 |
QTextFormat::FontFixedPitch | 0x2008 | |
QTextFormat::FontWeight | 0x2003 | |
QTextFormat::FontItalic | 0x2004 | |
QTextFormat::FontUnderline | 0x2005 | 该属性已被弃用。请使用 QTextFormat::TextUnderlineStyle 代替。 |
QTextFormat::FontOverline | 0x2006 | |
QTextFormat::FontStrikeOut | 0x2007 | |
QTextFormat::FontCapitalization | FirstFontProperty | 指定应用于文本的大写类型。 |
QTextFormat::FontLetterSpacingType | 0x1FE9 | 指定 FontLetterSpacing 属性的含义。默认值为QFont::PercentageSpacing 。 |
QTextFormat::FontLetterSpacing | 0x1FE1 | 更改字体中单个字母之间的默认间距。根据 FontLetterSpacingType,该值可指定为百分比或绝对值。默认值为 100%。 |
QTextFormat::FontWordSpacing | 0x1FE2 | 更改单词之间的默认间距。正值增加相应像素的字间距,负值减小字间距。 |
QTextFormat::FontStretch | 0x1FEA | 对应于QFont::Stretch 属性 |
QTextFormat::FontStyleHint | 0x1FE3 | 对应于QFont::StyleHint 属性 |
QTextFormat::FontStyleStrategy | 0x1FE4 | 对应于QFont::StyleStrategy 属性 |
QTextFormat::FontKerning | 0x1FE5 | 指定字体是否已打开字距调整。 |
QTextFormat::FontHintingPreference | 0x1FE6 | 根据QFont::HintingPreference 枚举的值控制提示的使用。 |
QTextFormat::TextUnderlineColor | 0x2020 | 指定绘制下划线、上划线和删除线的颜色。 |
QTextFormat::TextVerticalAlignment | 0x2021 | 根据QTextCharFormat::VerticalAlignment 枚举的值指定文本垂直对齐方式。 |
QTextFormat::TextOutline | 0x2022 | 指定用于绘制文本轮廓的QPen 。 |
QTextFormat::TextUnderlineStyle | 0x2023 | 根据QTextCharFormat::UnderlineStyle 枚举的值指定文本下划线的样式。 |
QTextFormat::TextToolTip | 0x2024 | 为文本片段指定要显示的工具提示(可选)。 |
QTextFormat::TextSuperScriptBaseline | 0x2025 | 指定上标文本的基线(高度的百分比)。 |
QTextFormat::TextSubScriptBaseline | 0x2026 | 指定下标文本的基线(高度的百分比)。 |
QTextFormat::TextBaselineOffset | 0x2027 | 指定文本的基线(高度的百分比)。正值按相应的百分比向上移动文本,负值则向下移动文本。 |
QTextFormat::IsAnchor | 0x2030 | |
QTextFormat::AnchorHref | 0x2031 | |
QTextFormat::AnchorName | 0x2032 | |
QTextFormat::ObjectType | 0x2f00 |
列表属性
常数 | 值 | 说明 |
---|---|---|
QTextFormat::ListStyle | 0x3000 | 指定列表中项目的样式,由QTextListFormat::Style 枚举的值描述。 |
QTextFormat::ListIndent | 0x3001 | 指定列表的缩进量。 |
QTextFormat::ListNumberPrefix | 0x3002 | 定义数字列表中项目编号的前置文本。 |
QTextFormat::ListNumberSuffix | 0x3003 | 定义附加到数字列表中项号的文本。 |
QTextFormat::ListStart (since Qt 6.6) | 0x3004 | 定义列表的第一个值。 |
表格和框架属性
常数 | 值 | 说明 |
---|---|---|
QTextFormat::FrameBorder | 0x4000 | |
QTextFormat::FrameBorderBrush | 0x4009 | |
QTextFormat::FrameBorderStyle | 0x4010 | 请参阅BorderStyle 枚举。 |
QTextFormat::FrameBottomMargin | 0x4006 | |
QTextFormat::FrameHeight | 0x4004 | |
QTextFormat::FrameLeftMargin | 0x4007 | |
QTextFormat::FrameMargin | 0x4001 | |
QTextFormat::FramePadding | 0x4002 | |
QTextFormat::FrameRightMargin | 0x4008 | |
QTextFormat::FrameTopMargin | 0x4005 | |
QTextFormat::FrameWidth | 0x4003 | |
QTextFormat::TableCellSpacing | 0x4102 | |
QTextFormat::TableCellPadding | 0x4103 | |
QTextFormat::TableColumns | 0x4100 | |
QTextFormat::TableColumnWidthConstraints | 0x4101 | |
QTextFormat::TableHeaderRowCount | 0x4104 | |
QTextFormat::TableBorderCollapse | 0x4105 | 指定QTextTableFormat::borderCollapse 属性。 |
表格单元格属性
常数 | 值 |
---|---|
QTextFormat::TableCellRowSpan | 0x4810 |
QTextFormat::TableCellColumnSpan | 0x4811 |
QTextFormat::TableCellLeftPadding | 0x4814 |
QTextFormat::TableCellRightPadding | 0x4815 |
QTextFormat::TableCellTopPadding | 0x4812 |
QTextFormat::TableCellBottomPadding | 0x4813 |
启用QTextTableFormat::borderCollapse 时使用的表格单元格属性
常量 | 值 |
---|---|
QTextFormat::TableCellTopBorder | 0x4816 |
QTextFormat::TableCellBottomBorder | 0x4817 |
QTextFormat::TableCellLeftBorder | 0x4818 |
QTextFormat::TableCellRightBorder | 0x4819 |
QTextFormat::TableCellTopBorderStyle | 0x481a |
QTextFormat::TableCellBottomBorderStyle | 0x481b |
QTextFormat::TableCellLeftBorderStyle | 0x481c |
QTextFormat::TableCellRightBorderStyle | 0x481d |
QTextFormat::TableCellTopBorderBrush | 0x481e |
QTextFormat::TableCellBottomBorderBrush | 0x481f |
QTextFormat::TableCellLeftBorderBrush | 0x4820 |
QTextFormat::TableCellRightBorderBrush | 0x4821 |
图像属性
常量 | 值 | 描述 |
---|---|---|
QTextFormat::ImageName | 0x5000 | 图片的文件名或来源。 |
QTextFormat::ImageTitle | 0x5001 | HTML 图像标记的标题属性,或 Markdown 图像链接中 URL 后的引号字符串。此枚举值已在 Qt 5.14 中添加。 |
QTextFormat::ImageAltText | 0x5002 | HTML 图像标记的 alt 属性,或 Markdown 图像链接中的图像描述。此枚举值已在 Qt 5.14 中添加。 |
QTextFormat::ImageWidth | 0x5010 | |
QTextFormat::ImageHeight | 0x5011 | |
QTextFormat::ImageQuality | 0x5014 | |
QTextFormat::ImageMaxWidth | 0x5015 | 此枚举值已在 Qt 6.8 中添加。 |
选择属性
常量 | 值 | 说明 |
---|---|---|
QTextFormat::FullWidthSelection | 0x06000 | 当在选区的 characterFormat 上设置时,将显示选中文本的整个宽度。 |
分页符属性
常数 | 值 | 说明 |
---|---|---|
QTextFormat::PageBreakPolicy | 0x7000 | 指定分页方式。请参阅PageBreakFlag 枚举。 |
QTextFormat::UserProperty | 0x100000 |
另请参阅 property() 和setProperty()。
成员函数文档
QTextFormat::QTextFormat()
创建一种新的文本格式,其InvalidFormat
。
另请参阅 FormatType 。
[explicit]
QTextFormat::QTextFormat(int type)
以给定的type 格式创建新文本格式。
另请参阅 FormatType 。
QTextFormat::QTextFormat(const QTextFormat &other)
创建与other 文本格式属性相同的新文本格式。
[noexcept]
QTextFormat::~QTextFormat()
销毁此文本格式。
QBrush QTextFormat::background() const
返回用于绘制文档背景的笔刷。
另请参阅 setBackground()、clearBackground() 和foreground()。
bool QTextFormat::boolProperty(int propertyId) const
返回propertyId 指定的属性值。如果属性不是 QTextFormat::Bool 类型,则返回 false。
另请参阅 setProperty(),intProperty(),doubleProperty(),stringProperty(),colorProperty(),lengthProperty(),lengthVectorProperty(), 和Property 。
QBrush QTextFormat::brushProperty(int propertyId) const
返回propertyId 所给属性的值;如果该属性不是QMetaType::QBrush 类型,则返回Qt::NoBrush 。
另请参阅 setProperty(),boolProperty(),intProperty(),doubleProperty(),stringProperty(),lengthProperty(),lengthVectorProperty() 和Property 。
void QTextFormat::clearBackground()
清除用于绘制文档背景的笔刷。将使用默认笔刷。
另请参阅 background()、setBackground() 和clearForeground()。
void QTextFormat::clearForeground()
清除用于绘制文档前景的笔刷。将使用默认笔刷。
另请参阅 foreground()、setForeground() 和clearBackground()。
void QTextFormat::clearProperty(int propertyId)
清除由propertyId
另请参见 Property 。
QColor QTextFormat::colorProperty(int propertyId) const
返回propertyId 所给属性的值;如果属性不是QMetaType::QColor 类型,则返回无效颜色。
另请参阅 setProperty(),boolProperty(),intProperty(),doubleProperty(),stringProperty(),lengthProperty(),lengthVectorProperty(), 和Property 。
qreal QTextFormat::doubleProperty(int propertyId) const
返回propertyId 指定的属性值。如果属性不是QMetaType::Double 或QMetaType::Float 类型,则返回 0。
另请参阅 setProperty(),boolProperty(),intProperty(),stringProperty(),colorProperty(),lengthProperty(),lengthVectorProperty(), 和Property 。
QBrush QTextFormat::foreground() const
返回用于渲染前景细节(如文本、框架轮廓和表格边框)的笔刷。
另请参阅 setForeground()、clearForeground() 和background()。
bool QTextFormat::hasProperty(int propertyId) const
如果文本格式的属性为propertyId ,则返回true
;否则返回false
。
另请参阅 properties() 和Property 。
int QTextFormat::intProperty(int propertyId) const
返回propertyId 指定的属性值。如果属性不是 QTextFormat::Integer 类型,则返回 0。
另请参阅 setProperty(),boolProperty(),doubleProperty(),stringProperty(),colorProperty(),lengthProperty(),lengthVectorProperty(), 和Property 。
bool QTextFormat::isBlockFormat() const
如果该文本格式是BlockFormat
,则返回true
;否则返回false
。
bool QTextFormat::isCharFormat() const
如果该文本格式是CharFormat
,则返回true
;否则返回false
。
bool QTextFormat::isEmpty() const
如果格式不存储任何属性,则返回 true;否则返回 false。
另请参阅 propertyCount() 和properties()。
bool QTextFormat::isFrameFormat() const
如果该文本格式是FrameFormat
,则返回true
;否则返回false
。
bool QTextFormat::isImageFormat() const
如果该文本格式是图像格式,则返回true
;否则返回false
。
bool QTextFormat::isListFormat() const
如果该文本格式是ListFormat
,则返回true
;否则返回false
。
bool QTextFormat::isTableCellFormat() const
如果该文本格式是TableCellFormat
,则返回true
;否则返回false
。
bool QTextFormat::isTableFormat() const
如果该文本格式是TableFormat
,则返回true
;否则返回false
。
bool QTextFormat::isValid() const
如果格式有效(即不是InvalidFormat ),则返回true
;否则返回false
。
Qt::LayoutDirection QTextFormat::layoutDirection() const
返回文档的布局方向。
另请参阅 setLayoutDirection()。
QTextLength QTextFormat::lengthProperty(int propertyId) const
返回propertyId 所给属性的值。
另请参阅 setProperty(),boolProperty(),intProperty(),doubleProperty(),stringProperty(),colorProperty(),lengthVectorProperty(), 和Property 。
QList<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const
返回propertyId 给定的属性值。如果属性不是 QTextFormat::LengthVector 类型,则返回空列表。
另请参阅 setProperty(),boolProperty(),intProperty(),doubleProperty(),stringProperty(),colorProperty(),lengthProperty(), 和Property 。
void QTextFormat::merge(const QTextFormat &other)
将other 格式与此格式合并;如有冲突,以other 格式为准。
int QTextFormat::objectIndex() const
返回格式对象的索引,如果格式对象无效,则返回-1。
另请参见 setObjectIndex().
int QTextFormat::objectType() const
返回文本格式的对象类型。
另请参阅 ObjectTypes 和setObjectType()。
QPen QTextFormat::penProperty(int propertyId) const
返回propertyId 所给属性的值;如果该属性不是QMetaType::QPen 类型,则返回Qt::NoPen 。
另请参阅 setProperty(),boolProperty(),intProperty(),doubleProperty(),stringProperty(),lengthProperty(),lengthVectorProperty() 和Property 。
QMap<int, QVariant> QTextFormat::properties() const
返回包含此文本格式所有属性的映射。
QVariant QTextFormat::property(int propertyId) const
返回给定propertyId 指定的属性。
另请参阅 setProperty() 和Property 。
int QTextFormat::propertyCount() const
返回格式中存储的属性数量。
void QTextFormat::setBackground(const QBrush &brush)
将用于绘制文档背景的笔刷设置为指定的brush 。
另请参阅 background()、clearBackground() 和setForeground()。
void QTextFormat::setForeground(const QBrush &brush)
将前景画笔设置为指定的brush 。前景画笔主要用于渲染文本。
另请参阅 foreground()、clearForeground() 和setBackground()。
void QTextFormat::setLayoutDirection(Qt::LayoutDirection direction)
将文档的布局方向设置为指定的direction 。
另请参阅 layoutDirection() 。
void QTextFormat::setObjectIndex(int index)
设置格式对象的对象index 。
另请参阅 objectIndex() 。
void QTextFormat::setObjectType(int type)
将文本格式的对象类型设置为type 。
另请参阅 ObjectTypes 和objectType()。
void QTextFormat::setProperty(int propertyId, const QList<QTextLength> &value)
将propertyId 给定的属性值设置为value 。
另请参阅 property(),lengthVectorProperty() 和Property 。
void QTextFormat::setProperty(int propertyId, const QVariant &value)
将propertyId 指定的属性设置为给定的value 。
另请参阅 Property 。
QString QTextFormat::stringProperty(int propertyId) const
返回propertyId 给定的属性值;如果属性不是QMetaType::QString 类型,则返回空字符串。
另请参阅 setProperty(),boolProperty(),intProperty(),doubleProperty(),colorProperty(),lengthProperty(),lengthVectorProperty() 和Property 。
void QTextFormat::swap(QTextFormat &other)
将此文本格式与other 互换。该操作速度非常快,从未出现过故障。
QTextBlockFormat QTextFormat::toBlockFormat() const
以块格式返回该格式。
QTextCharFormat QTextFormat::toCharFormat() const
将此格式作为字符格式返回。
QTextFrameFormat QTextFormat::toFrameFormat() const
将此格式作为帧格式返回。
QTextImageFormat QTextFormat::toImageFormat() const
将此格式作为图像格式返回。
QTextListFormat QTextFormat::toListFormat() const
将此格式作为列表格式返回。
QTextTableCellFormat QTextFormat::toTableCellFormat() const
将此格式作为表格单元格格式返回。
QTextTableFormat QTextFormat::toTableFormat() const
将此格式作为表格格式返回。
int QTextFormat::type() const
返回此格式的类型。
另请参见 FormatType 。
QVariant QTextFormat::operator QVariant() const
bool QTextFormat::operator!=(const QTextFormat &other) const
如果该文本格式与other 文本格式不同,则返回true
。
QTextFormat &QTextFormat::operator=(const QTextFormat &other)
将other 文本格式赋值给该文本格式,并返回对该文本格式的引用。
bool QTextFormat::operator==(const QTextFormat &other) const
如果此文本格式与other 文本格式相同,则返回true
。
© 2025 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.