Warning, /maui/mauikit/src/style.5/Popup.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   Copyright 2018 Camilo Higuita <milo.h@aol.com>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 import QtQuick 2.14
0021 import org.mauikit.controls 1.3 as Maui
0022 
0023 import QtQuick.Templates 2.15 as T
0024 
0025 import QtGraphicalEffects 1.0
0026 
0027 /**
0028  * Popup
0029  * A global sidebar for the application window that can be collapsed.
0030  *
0031  *
0032  *
0033  *
0034  *
0035  *
0036  */
0037 T.Popup
0038 {
0039     id: control
0040 
0041     parent: T.Overlay.overlay
0042     Maui.Theme.colorSet: Maui.Theme.View
0043 
0044     closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
0045 
0046     width: (filling ? parent.width  : mWidth)
0047     height: (filling ? parent.height : mHeight)
0048 
0049     Behavior on width
0050     {
0051         enabled: control.hint === 1
0052 
0053         NumberAnimation
0054         {
0055             duration: Maui.Style.units.shortDuration
0056             easing.type: Easing.InOutQuad
0057         }
0058     }
0059 
0060     Behavior on height
0061     {
0062         enabled: control.hint === 1
0063 
0064         NumberAnimation
0065         {
0066             duration: Maui.Style.units.shortDuration
0067             easing.type: Easing.InOutQuad
0068         }
0069     }
0070 
0071     readonly property int mWidth:  Math.round(Math.min(control.parent.width * widthHint, maxWidth))
0072     readonly property int mHeight: Math.round(Math.min(control.parent.height * heightHint, maxHeight))
0073 
0074     anchors.centerIn: parent
0075 
0076     modal: true
0077     padding: 0
0078     clip: false
0079 
0080     margins: filling ? 0 : Maui.Style.space.medium
0081 
0082     property bool filling : false
0083     /**
0084      * content : Item.data
0085      */
0086     default property alias content : _content.data
0087 
0088     /**
0089          * maxWidth : int
0090          */
0091     property int maxWidth : 700
0092 
0093     /**
0094          * maxHeight : int
0095          */
0096     property int maxHeight : 400
0097 
0098     /**
0099          * hint : double
0100          */
0101     property double hint : 0.9
0102 
0103     /**
0104          * heightHint : double
0105          */
0106     property double heightHint: hint
0107 
0108     /**
0109          * widthHint : double
0110          */
0111     property double widthHint: hint
0112 
0113     contentItem: Item
0114     {
0115         id: _content
0116         layer.enabled: true
0117         layer.effect: OpacityMask
0118         {
0119             cached: true
0120             maskSource:  Rectangle
0121             {
0122                 width: _content.width
0123                 height: _content.height
0124                 radius:  control.filling ? 0 : Maui.Style.radiusV
0125             }
0126         }
0127     }
0128 
0129     background: Rectangle
0130     {
0131         color: control.Maui.Theme.backgroundColor
0132 
0133         radius:  control.filling ? 0 : Maui.Style.radiusV
0134         // property color borderColor: Maui.Theme.textColor
0135         // border.color: Maui.Style.trueBlack ? Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) : undefined
0136         layer.enabled: !control.filling
0137         layer.effect: DropShadow
0138         {
0139             horizontalOffset: 0
0140             verticalOffset: 0
0141             radius: 8
0142             samples: 16
0143             color: "#80000000"
0144             transparentBorder: true
0145         }
0146 
0147         Behavior on color
0148         {
0149             Maui.ColorTransition{}
0150         }
0151     }
0152 
0153     //         enter: Transition {
0154     //             NumberAnimation {
0155     //                 property: "opacity"
0156     //                 from: 0
0157     //                 to: 1
0158     //                 easing.type: Easing.InOutQuad
0159     //                 duration: 250
0160     //             }
0161     //         }
0162     //
0163     //         exit: Transition {
0164     //             NumberAnimation {
0165     //                 property: "opacity"
0166     //                 from: 1
0167     //                 to: 0
0168     //                 easing.type: Easing.InOutQuad
0169     //                 duration: 250
0170     //             }
0171     //         }
0172     //
0173 
0174 
0175     //         T.Overlay.modal: Rectangle
0176     //         {
0177     //             color: Qt.rgba( control.Maui.Theme.backgroundColor.r,  control.Maui.Theme.backgroundColor.g,  control.Maui.Theme.backgroundColor.b, 0.7)
0178     //
0179     //             Behavior on opacity { NumberAnimation { duration: 150 } }
0180     //         }
0181     //
0182     //         T.Overlay.modeless: Rectangle
0183     //         {
0184     //             color: Qt.rgba( control.Maui.Theme.backgroundColor.r,  control.Maui.Theme.backgroundColor.g,  control.Maui.Theme.backgroundColor.b, 0.7)
0185     //             Behavior on opacity { NumberAnimation { duration: 150 } }
0186     //         }
0187     /**
0188          *
0189          */
0190 
0191 }