Label QML Type

具有继承字体的样式文本标签。更多

Import Statement: import QtQuick.Controls
Inherits:

Text

属性

详细说明

Label 通过样式和font 继承扩展了Text 。默认颜色和字体与样式有关。标签还可以有一个可视化background 项。

Label {
    text: "Label"
}

您可以使用Text 的属性,根据需要更改文本的外观:

Label {
    text: "Hello world"
    font.pixelSize: 22
    font.italic: true
}

另请参阅 自定义标签

属性文档

background : Item

该属性包含背景项。

注意: 如果没有明确指定背景项的大小,它将自动跟随控件的大小。在大多数情况下,无需为背景项指定宽度或高度。

另请参阅 自定义标签


bottomInset : real [since QtQuick.Controls 2.5 (Qt 5.12)]

该属性用于保存背景的底部嵌入。

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 Control LayouttopInset


implicitBackgroundHeight : real [read-only, since QtQuick.Controls 2.5 (Qt 5.12)]

该属性保存隐式背景高度。

其值等于background ? background.implicitHeight : 0

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 implicitBackgroundWidth


implicitBackgroundWidth : real [read-only, since QtQuick.Controls 2.5 (Qt 5.12)]

该属性保存隐式背景宽度。

其值等于background ? background.implicitWidth : 0

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 implicitBackgroundHeight


leftInset : real [since QtQuick.Controls 2.5 (Qt 5.12)]

该属性用于保存背景的左侧嵌入。

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 Control LayoutrightInset


rightInset : real [since QtQuick.Controls 2.5 (Qt 5.12)]

该属性用于保存背景的右嵌套。

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 Control LayoutleftInset


topInset : real [since QtQuick.Controls 2.5 (Qt 5.12)]

该属性用于保存背景的顶部嵌入。

该属性在 QtQuick.Controls 2.5 (Qt 5.12) 中引入。

另请参阅 Control LayoutbottomInset


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