Warning, /office/skrooge/plugins/skrooge/default/SKGValue.qml is written in an unsupported language. File is not indexed.

0001 /***************************************************************************
0002  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0003  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  ***************************************************************************/
0006 import QtQuick 2.12
0007 import QtQuick.Controls 2.12
0008 import QtQuick.Layouts 1.0
0009 
0010 Label {
0011     property var value: null
0012     property var max: null
0013     property var bold: false
0014     property var url: ""
0015     property var backgroundColor: "#FF0000"
0016     
0017     color: '#' + (value == null || max != null ? color_normaltext : (value < 0 ? color_negativetext : color_positivetext))
0018     
0019     Layout.fillWidth: true
0020     Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
0021     font.pointSize: point_size
0022     font.bold: bold
0023 
0024     MouseArea {
0025         anchors.fill: parent
0026         cursorShape: url.length ? Qt.PointingHandCursor : Qt.ArrowCursor
0027         onClicked: {
0028             if (url.length) panel.openPage(url)
0029         }
0030     }
0031         
0032     Rectangle {
0033         anchors.top: parent.top
0034         anchors.bottom: parent.bottom
0035         anchors.left: parent.left
0036         color: parent.backgroundColor
0037         width: parent.max == null || parent.max == 0 ? 0 : Math.abs(parent.width * parent.value / parent.max)
0038         z: -1
0039         visible: parent.value != null && parent.max != null
0040         
0041         Behavior on width {
0042             NumberAnimation {
0043                 duration: 300
0044                 easing.type: Easing.InOutQuad
0045             }
0046         }
0047     }
0048 }