Plasma-framework

Drawer.qml
1/*
2 SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7import QtQuick
8import QtQuick.Templates as T
9import org.kde.kirigami as Kirigami
10import org.kde.ksvg as KSvg
11//NOTE: importing PlasmaCore is necessary in order to make KSvg load the current Plasma Theme
12import org.kde.plasma.core as PlasmaCore
13
14T.Drawer {
15 id: control
16
17 parent: T.ApplicationWindow.overlay
18
19 implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
20 implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
21
22 contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
23 contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
24
25 topPadding: control.edge === Qt.BottomEdge ? 1 : 0
26 leftPadding: control.edge === Qt.RightEdge ? 1 : 0
27 rightPadding: control.edge === Qt.LeftEdge ? 1 : 0
28 bottomPadding: control.edge === Qt.TopEdge ? 1 : 0
29
30 background: KSvg.FrameSvgItem {
31 anchors {
32 fill: parent
33 leftMargin: -margins.left
34 topMargin: -margins.top
35 rightMargin: -margins.right
36 bottomMargin: -margins.bottom
37 }
38 implicitWidth: Kirigami.Units.gridUnit * 12
39 imagePath: "widgets/background"
40 enabledBorders: {
41 switch (control.edge) {
42 case Qt.BottomEdge:
43 return KSvg.FrameSvgItem.TopBorder;
44 case Qt.RightEdge:
45 return KSvg.FrameSvgItem.LeftBorder;
46 case Qt.TopEdge:
47 return KSvg.FrameSvgItem.BottomBorder;
48 case Qt.LeftEdge:
49 default:
50 return KSvg.FrameSvgItem.RightBorder;
51 }
52 }
53 }
54
55 enter: Transition {
56 SmoothedAnimation {
57 velocity: 5
58 }
59 }
60 exit: Transition {
61 SmoothedAnimation {
62 velocity: 5
63 }
64 }
65}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:54:11 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.