blob: fa8b0a380c69b3eb450be4b0bf94161b76dc136a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick3D
Item {
id: root
property string labelText: ""
property color backgroundColor: "gray"
property bool backgroundVisible: true
property color labelTextColor: "transparent"
property bool borderVisible: false
property font labelFont
property real labelWidth: -1
property real labelHeight: -1
width: Math.max(labelWidth / 2, text0.implicitWidth)
height: Math.max(labelHeight, text0.implicitHeight)
enabled: false
Rectangle {
id: labelBackground
anchors.fill: parent
color: root.backgroundColor
visible: root.backgroundVisible
border.color: root.labelTextColor
border.width: root.borderVisible ? Math.max(0.5, (text0.font.pointSize / 16)) : 0
radius: 3
}
Text {
id: text0
anchors.centerIn: parent
color: root.labelTextColor
text: root.labelText
font: root.labelFont
padding: 4
}
}
|