Debian Codegraph @

faces/facepackages/colorgrid/contents/ui/FullRepresentation.qml

raw
1 /*
2 SPDX-FileCopyrightText: 2019 Marco Martin <[email protected]>
3 SPDX-FileCopyrightText: 2019 David Edmundson <[email protected]>
4 SPDX-FileCopyrightText: 2019 Arjen Hiemstra <[email protected]>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8
9 import QtQuick
10 import QtQuick.Layouts
11
12 import org.kde.kirigami as Kirigami
13
14 import org.kde.ksysguard.sensors as Sensors
15 import org.kde.ksysguard.faces as Faces
16
17 import org.kde.quickcharts as Charts
18 import org.kde.quickcharts.controls as ChartsControls
19
20 Faces.SensorFace {
21 id: root
22
23 readonly property int columnCount: root.controller.faceConfiguration.columnCount
24
25 // When automatically determining the number of columns, use the square root
26 // of the number of sensors, rounded up. This should give us a number of
27 // columns that generally divides things evenly across the grid.
28 readonly property int autoColumnCount: Math.ceil(Math.sqrt(controller.highPrioritySensorIds.length))
29
30 // Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
31 Layout.minimumWidth: Math.max(Kirigami.Units.gridUnit * 8, grid.Layout.minimumWidth)
32 Layout.preferredWidth: grid.preferredWidth + Kirigami.Units.largeSpacing
33
34 contentItem: FaceGrid {
35 id: grid
36 controller: root.controller
37 colorSource: root.colorSource
38 compact: false
39 columns: root.columnCount > 0 ? root.columnCount : root.autoColumnCount
40 }
41 }