File: LegendBox.qml

package info (click to toggle)
qt6-positioning 6.9.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,068 kB
  • sloc: cpp: 35,693; java: 514; xml: 58; python: 35; makefile: 23
file content (66 lines) | stat: -rw-r--r-- 2,043 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Layouts

Rectangle {
    id: root

    radius: 8
    color: Theme.legendBackgroundColor

    implicitWidth: Math.max(inUseTxt.implicitWidth, inViewTxt.implicitWidth)
                   + rootLayout.columnSpacing
                   + Math.max(inUseIcon.width, inViewIcon.width)
                   + rootLayout.anchors.leftMargin + rootLayout.anchors.rightMargin
    implicitHeight: inUseTxt.implicitHeight + inViewTxt.implicitHeight
                    + rootLayout.rowSpacing
                    + rootLayout.anchors.topMargin + rootLayout.anchors.bottomMargin

    GridLayout {
        id: rootLayout
        columns: 2
        anchors {
            fill: parent
            topMargin: Theme.defaultSpacing
            bottomMargin: Theme.defaultSpacing
            leftMargin: 2 * Theme.defaultSpacing
            rightMargin: 2 * Theme.defaultSpacing
        }
        columnSpacing: Theme.defaultSpacing
        rowSpacing: 0

        Text {
            id: inUseTxt
            text: qsTr("In Use")
            color: Theme.textMainColor
            font.pixelSize: Theme.smallFontSize
            font.weight: Theme.fontLightWeight
            Layout.alignment: Qt.AlignRight
        }
        Rectangle {
            id: inUseIcon
            implicitHeight: inUseTxt.font.pixelSize
            implicitWidth: implicitHeight
            radius: height / 2
            color: Theme.inUseColor
        }

        Text {
            id: inViewTxt
            text: qsTr("In View")
            color: Theme.textMainColor
            font.pixelSize: Theme.smallFontSize
            font.weight: Theme.fontLightWeight
            Layout.alignment: Qt.AlignRight
        }
        Rectangle {
            id: inViewIcon
            implicitHeight: inViewTxt.font.pixelSize
            implicitWidth: implicitHeight
            radius: height / 2
            color: Theme.inViewColor
        }
    }
}