Warning, /plasma/discover/discover/qml/LabelBackground.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *   SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0004  *
0005  *   SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Controls as QQC2
0010 import org.kde.kirigami as Kirigami
0011 
0012 QQC2.Control {
0013     id: root
0014 
0015     Kirigami.Theme.colorSet: Kirigami.Theme.Window
0016     Kirigami.Theme.inherit: false
0017 
0018     property alias text: theLabel.text
0019     property real progress: 1.0
0020 
0021     readonly property bool inProgress: progress > 0
0022 
0023     padding: Kirigami.Units.smallSpacing * 1.5
0024 
0025     background: Item {
0026         visible: root.inProgress
0027         Rectangle {
0028             color: Qt.alpha(Kirigami.Theme.textColor, 0.1)
0029             border.color: Qt.alpha(Kirigami.Theme.textColor, 0.2)
0030             border.width: 1
0031             anchors.fill: parent
0032             radius: root.padding
0033         }
0034 
0035         Rectangle {
0036             anchors {
0037                 top: parent.top
0038                 left: parent.left
0039                 bottom: parent.bottom
0040             }
0041             color: Qt.alpha(Kirigami.Theme.highlightColor, 0.5)
0042             border.color: Kirigami.Theme.highlightColor
0043             border.width: 1
0044             radius: root.padding
0045             width: Math.round(parent.width * Math.max(0, Math.min(1, root.progress)))
0046             visible: width >= radius * 2
0047         }
0048     }
0049 
0050     contentItem: QQC2.Label {
0051         id: theLabel
0052         horizontalAlignment: Text.AlignHCenter
0053         color: root.inProgress ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
0054     }
0055 }