MauiKit Controls

Popup.qml
1/*
2 * Copyright 2018 Camilo Higuita <milo.h@aol.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick as Q
21import QtQuick.Controls as QQC
22
23import org.mauikit.controls as Maui
24import QtQuick.Effects
25
26/**
27 * Popup
28 * A global sidebar for the application window that can be collapsed.
29 *
30 *
31 *
32 *
33 *
34 *
35 */
36QQC.Popup
37{
38 id: control
39
40 width: (filling ? parent.width : mWidth)
41 height: (filling ? parent.height : mHeight)
42
43 anchors.centerIn: parent
44
45 Q.Behavior on width
46 {
47 enabled: control.hint === 1
48
49 Q.NumberAnimation
50 {
51 duration: Maui.Style.units.shortDuration
52 easing.type: Q.Easing.InOutQuad
53 }
54 }
55
56 Q.Behavior on height
57 {
58 enabled: control.hint === 1
59
60 Q.NumberAnimation
61 {
62 duration: Maui.Style.units.shortDuration
63 easing.type: Q.Easing.InOutQuad
64 }
65 }
66
67 readonly property int mWidth: Math.round(Math.min(control.parent.width * widthHint, maxWidth))
68 readonly property int mHeight: Math.round(Math.min(control.parent.height * heightHint, maxHeight))
70 margins: filling ? 0 : Maui.Style.space.medium
71
72 property bool filling : false
73 /**
74 * content : Item.data
75 */
76 default property alias content : _content.data
77
78 /**
79 * maxWidth : int
80 */
81 property int maxWidth : 700
82
83 /**
84 * maxHeight : int
85 */
86 property int maxHeight : 400
87
88 /**
89 * hint : double
90 */
91 property double hint : 0.9
92
93 /**
94 * heightHint : double
95 */
96 property double heightHint: hint
97
98 /**
99 * widthHint : double
100 */
101 property double widthHint: hint
102
103 contentItem: Q.Item
104 {
105 id: _content
106
107 layer.enabled: true
108 layer.effect: MultiEffect
109 {
110 maskEnabled: true
111 maskThresholdMin: 0.5
112 maskSpreadAtMin: 1.0
113 maskSpreadAtMax: 0.0
114 maskThresholdMax: 1.0
115 maskSource: Q.ShaderEffectSource
116 {
117 sourceItem: Q.Rectangle
118 {
119 width: _content.width
120 height: _content.height
121 radius: control.filling ? 0 : Maui.Style.radiusV
122 }
123 }
124 }
125 }
126
127 Maui.Controls.flat: control.filling
128}
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 12:11:16 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.