Libplasma

Popup.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.ksvg as KSvg
10//NOTE: importing PlasmaCore is necessary in order to make KSvg load the current Plasma Theme
11import org.kde.plasma.core as PlasmaCore
12import org.kde.kirigami as Kirigami
13
14T.Popup {
15 id: control
16
17 implicitWidth: Math.max(background ? background.implicitWidth : 0,
18 contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
19 implicitHeight: Math.max(background ? background.implicitHeight : 0,
20 contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0)
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: (background as KSvg.FrameSvgItem)?.margins.top ?? undefined
26 leftPadding: (background as KSvg.FrameSvgItem)?.margins.left ?? undefined
27 rightPadding: (background as KSvg.FrameSvgItem)?.margins.right ?? undefined
28 bottomPadding: (background as KSvg.FrameSvgItem)?.margins.bottom ?? undefined
29
30 enter: Transition {
31 NumberAnimation {
32 property: "opacity"
33 from: 0
34 to: 1
35 easing.type: Easing.InOutQuad
36 duration: Kirigami.Units.longDuration
37 }
38 }
39
40 exit: Transition {
41 NumberAnimation {
42 property: "opacity"
43 from: 1
44 to: 0
45 easing.type: Easing.InOutQuad
46 duration: Kirigami.Units.longDuration
47 }
48 }
49
50 contentItem: Item { }
51
52 background: KSvg.FrameSvgItem {
53 implicitWidth: Kirigami.Units.gridUnit * 12
54 imagePath: "widgets/background"
55 }
56}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:34:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.