本页内容

TextStyle QML Type

定义控件标签的文本样式。更多...

Import Statement: import Qt.labs.StyleKit
Status: Technology preview

此类型处于技术预览阶段,可能会有变动。

属性

详细说明

TextStyle 提供了用于控制控件内文本标签外观的属性,例如color 、alignment 和padding ,以及某些与字体相关的属性,例如bold 、italic 和font size 。

该属性以text 分组属性的形式,在每个ControlStateStyle 上均可使用。

注意: Qt.labs 模块中的类型在未来的版本中不保证保持兼容性。

另请参阅 DelegateStyle 、ControlStyle 、ControlStateStyle 以及FallbackStyle 参考文档。

属性文档

alignment : Qt::Alignment

文本在可用区域内的对齐方式。

bold : bool

是否应将文本显示为粗体。默认值为false 。

另请参阅 italic 。

bottomPadding : real

文本周围的底部填充。如果未设置,则默认采用padding 。

另请参阅 padding 、topPadding 、leftPadding 以及rightPadding 。

color : color

文本的颜色。

first : TextStyle

用于设置控件中第一个文本元素样式的分组属性,该控件会显示两个独立的文本标签。未设置的属性将回退到text 本身。

另请参阅 second 。

italic : bool

是否应将文本显示为斜体。默认值为false 。

另请参阅 bold 。

leftPadding : real

文本周围的左侧填充。如果未设置,则默认采用padding 。

另请参阅 padding 、rightPadding 、topPadding 以及bottomPadding 。

padding : real

文本周围的均匀填充。设置此选项将为leftPadding 、rightPadding 、topPadding 和bottomPadding 提供默认值。各边均可单独覆盖。

另请参阅 leftPadding 、rightPadding 、topPadding 以及bottomPadding 。

pointSize : real

文本字体的字号。

rightPadding : real

文本周围的右侧填充。如果未设置,则回退为padding 。

另请参阅 padding 、leftPadding 、topPadding 以及bottomPadding 。

second : TextStyle

用于为显示两个独立文本标签的控件中的第二个文本元素设置样式的分组属性。未设置的属性将回退到text 本身。

另请参阅 first 。

topPadding : real

文本周围的顶部填充。如果未设置,则默认使用padding 。

另请参阅 padding 、bottomPadding 、leftPadding 以及rightPadding 。

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