9import QtQuick.Templates as T
11import org.kde.plasma.core as PlasmaCore
12import org.kde.ksvg as KSvg
13import org.kde.plasma.plasmoid
14import org.kde.kirigami as Kirigami
24 Layout.fillWidth: true
25 bottomPadding: position === T.ToolBar.Footer ? 0 : -backgroundMetrics.getMargin("bottom")
26 topPadding: position === T.
ToolBar.Footer ? -backgroundMetrics.getMargin(
"top") : 0
28 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
29 contentWidth + leftPadding + rightPadding)
30 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
31 contentHeight + topPadding + bottomPadding)
33 leftInset: backgroundMetrics.getMargin(
"left")
34 rightInset: backgroundMetrics.getMargin(
"right")
35 topInset: position === T.
ToolBar.Footer ? 0 : backgroundMetrics.getMargin(
"top")
36 bottomInset: position === T.
ToolBar.Footer ? backgroundMetrics.getMargin(
"bottom") : 0
41 property int enabledBorders: {
43 const popup = w as PlasmaCore.PopupPlasmaWindow;
45 return Qt.LeftEdge |
Qt.TopEdge |
Qt.RightEdge |
Qt.BottomEdge;
48 const windowBorders = popup.borders;
49 let borders =
Qt.TopEdge |
Qt.BottomEdge;
51 if (windowBorders &
Qt.LeftEdge && Math.floor(background.Kirigami.ScenePosition.x) <= 0) {
52 borders |= Qt.LeftEdge;
54 if (windowBorders &
Qt.RightEdge && Math.ceil(background.Kirigami.ScenePosition.x + background.width) >= w.width) {
55 borders |= Qt.RightEdge;
65 visible: fromCurrentImageSet === backgroundSvg.fromCurrentImageSet
66 imagePath:
"widgets/plasmoidheading"
67 prefix: control.position === T.ToolBar.Header ?
"header" :
"footer"
70 imagePath:
"dialogs/background"
75 if (control.enabledBorders &
Qt.LeftEdge) {
78 if (control.enabledBorders &
Qt.RightEdge) {
81 if (control.enabledBorders &
Qt.TopEdge) {
84 if (control.enabledBorders &
Qt.BottomEdge) {
93 function getMargin(margin:
string): real {
97 if (w && w.hasOwnProperty(
"leftPadding")
98 && w.hasOwnProperty(
"topPadding")
99 && w.hasOwnProperty(
"rightPadding")
100 && w.hasOwnProperty(
"bottomPadding")) {
103 return -w.leftPadding;
105 return -w.topPadding;
107 return -w.rightPadding;
110 return -w.bottomPadding;
112 }
else if (!hasInset) {
113 return -headingSvg.fixedMargins[margin];
115 return -fixedMargins[margin] + inset[margin];
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:41 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.