Warning, /plasma/plasma-systemmonitor/src/table/LineChartCellDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls
0009 import QtQuick.Layouts
0010 import QtQml.Models
0011 
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.quickcharts as Charts
0014 
0015 BaseCellDelegate {
0016     id: delegate
0017 
0018     property real maximum: 100
0019     property alias valueSources: chart.valueSources
0020 
0021     property int _row: model.row
0022     property int _column: model.column
0023 
0024     contentItem: Item {
0025         anchors.fill: parent
0026         Charts.LineChart {
0027             id: chart
0028             anchors.fill: parent
0029 
0030             xRange {
0031                 from: 0
0032                 to: 10
0033                 automatic: false
0034             }
0035 
0036             yRange {
0037                 from: 0
0038                 to: delegate.maximum
0039                 automatic: delegate.maximum <= 0
0040             }
0041 
0042             direction: Charts.XYChart.ZeroAtEnd
0043 
0044             opacity: 0.5
0045             fillOpacity: 1
0046             lineWidth: 0
0047 
0048             colorSource: Charts.SingleValueSource { value: delegate.background.selected ? Kirigami.Theme.highlightedTextColor :  Kirigami.Theme.highlightColor }
0049         }
0050 
0051         Label {
0052             id: label
0053 
0054             anchors.centerIn: parent
0055 
0056             padding: Kirigami.Units.smallSpacing
0057 
0058             text: delegate.text
0059             horizontalAlignment: Text.AlignLeft
0060             elide: Text.ElideRight
0061         }
0062     }
0063 
0064     ToolTip.text: delegate.text
0065     ToolTip.delay: Kirigami.Units.toolTipDelay
0066     ToolTip.visible: delegate.hovered && label.truncated
0067 }
0068