Warning, /plasma/plasma-systemmonitor/src/page/Container.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 2.14 0008 import QtQuick.Controls 2.14 0009 import QtQuick.Layouts 1.14 0010 0011 import org.kde.kirigami 2.12 as Kirigami 0012 0013 Item { 0014 id: root 0015 implicitWidth: control.implicitWidth 0016 implicitHeight: control.implicitHeight 0017 property bool raised: false 0018 property bool single: true 0019 property bool alwaysShowBackground: false 0020 0021 property Item activeItem 0022 readonly property bool active: activeItem == control || activeItem == root 0023 0024 property int index 0025 0026 signal select(Item item) 0027 signal remove() 0028 signal move(int from, int to) 0029 0030 signal missingSensorsChanged(string id, string title, var sensors) 0031 0032 property alias hovered: control.hovered 0033 property alias contentItem: control.contentItem 0034 property alias background: control.background 0035 property alias mainControl: control 0036 property alias leftPadding: control.leftPadding 0037 property alias rightPadding: control.rightPadding 0038 property alias topPadding: control.topPadding 0039 property alias bottomPadding: control.bottomPadding 0040 0041 readonly property alias toolbar: toolbar 0042 0043 // We distinguish between two different minimum heights: the minimum height 0044 // of the contents and the minimum height of the entire item. The content 0045 // height should match the minimum height of the innermost item, usually 0046 // this will be a face. The maximum of the content heights is then used for 0047 // all rows to ensure rows have the same height. The minimum height is used 0048 // for the actual layouting and includes space for things like the toolbar. 0049 0050 property real minimumContentHeight: contentItem && contentItem.hasOwnProperty("minimumContentHeight") ? 0051 contentItem.minimumContentHeight : 0 0052 property real minimumHeight: contentItem && contentItem.hasOwnProperty("minimumHeight") ? 0053 contentItem.minimumHeight + topPadding + bottomPadding : 0 0054 0055 z: raised ? 99 : 0 0056 0057 Control { 0058 id: control 0059 0060 hoverEnabled: true 0061 0062 width: root.width 0063 height: root.height 0064 0065 leftPadding: Kirigami.Units.largeSpacing 0066 Behavior on leftPadding { NumberAnimation { duration: Kirigami.Units.shortDuration } } 0067 rightPadding: Kirigami.Units.largeSpacing 0068 Behavior on rightPadding { NumberAnimation { duration: Kirigami.Units.shortDuration } } 0069 bottomPadding: Kirigami.Units.largeSpacing 0070 Behavior on bottomPadding { NumberAnimation { duration: Kirigami.Units.shortDuration } } 0071 topPadding: root.active ? toolbar.height + Kirigami.Units.smallSpacing * 2 : Kirigami.Units.largeSpacing * 2 0072 Behavior on topPadding { NumberAnimation { duration: Kirigami.Units.shortDuration } } 0073 0074 background: Item { 0075 PlaceholderRectangle { 0076 id: backgroundRectangle 0077 anchors.fill: parent 0078 highlight: root.hovered 0079 opacity: root.alwaysShowBackground || root.hovered ? 1 : 0 0080 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } 0081 onClicked: root.select(control) 0082 0083 shadow.size: root.raised ? Kirigami.Units.gridUnit : 0 0084 } 0085 0086 EditorToolBar { 0087 id: toolbar 0088 0089 z: 1 0090 0091 anchors { 0092 top: parent.top 0093 left: parent.left 0094 right: parent.right 0095 topMargin: Kirigami.Units.smallSpacing 0096 leftMargin: Kirigami.Units.largeSpacing 0097 rightMargin: Kirigami.Units.largeSpacing 0098 } 0099 0100 single: root.single 0101 moveTarget: root 0102 0103 enabled: opacity >= 1 0104 opacity: root.active ? 1 : 0 0105 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration } } 0106 0107 onMoved: root.move(from, to) 0108 onRemoveClicked: root.remove() 0109 } 0110 } 0111 } 0112 }