Warning, /maui/nomad-style/Popup.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * Copyright 2017 Marco Martin <mart@kde.org>
0003  * Copyright 2017 The Qt Company Ltd.
0004  *
0005  * GNU Lesser General Public License Usage
0006  * Alternatively, this file may be used under the terms of the GNU Lesser
0007  * General Public License version 3 as published by the Free Software
0008  * Foundation and appearing in the file LICENSE.LGPLv3 included in the
0009  * packaging of this file. Please review the following information to
0010  * ensure the GNU Lesser General Public License version 3 requirements
0011  * will be met: https://www.gnu.org/licenses/lgpl.html.
0012  *
0013  * GNU General Public License Usage
0014  * Alternatively, this file may be used under the terms of the GNU
0015  * General Public License version 2.0 or later as published by the Free
0016  * Software Foundation and appearing in the file LICENSE.GPL included in
0017  * the packaging of this file. Please review the following information to
0018  * ensure the GNU General Public License version 2.0 requirements will be
0019  * met: http://www.gnu.org/licenses/gpl-2.0.html.
0020  */
0021 
0022 
0023 import QtQuick 2.6
0024 import QtGraphicalEffects 1.0
0025 import QtQuick.Templates 2.3 as T
0026 import org.kde.kirigami 2.2 as Kirigami
0027 
0028 T.Popup {
0029     id: control
0030 
0031     implicitWidth: Math.max(background ? background.implicitWidth : 0,
0032                             contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
0033     implicitHeight: Math.max(background ? background.implicitHeight : 0,
0034                              contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0)
0035 
0036     contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
0037     contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
0038 
0039     topPadding: Kirigami.Units.devicePixelRatio * 4
0040     bottomPadding: Kirigami.Units.devicePixelRatio * 4
0041     rightPadding: Kirigami.Units.devicePixelRatio * 2
0042     leftPadding: Kirigami.Units.devicePixelRatio * 2
0043 
0044     enter: Transition {
0045         NumberAnimation {
0046             property: "opacity"
0047             from: 0
0048             to: 1
0049             easing.type: Easing.InOutQuad
0050             duration: 250
0051         }
0052     }
0053 
0054     exit: Transition {
0055         NumberAnimation {
0056             property: "opacity"
0057             from: 1
0058             to: 0
0059             easing.type: Easing.InOutQuad
0060             duration: 250
0061         }
0062     }
0063 
0064     contentItem: Item { }
0065 
0066     background: Rectangle {
0067         radius: Kirigami.Units.devicePixelRatio * 4
0068         color: Kirigami.Theme.viewBackgroundColor
0069         property color borderColor: Kirigami.Theme.textColor
0070         border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3)
0071         layer.enabled: true
0072         
0073         layer.effect: DropShadow {
0074             transparentBorder: true
0075             radius: 8
0076             samples: 16
0077             horizontalOffset: 0
0078             verticalOffset: 4
0079             color: Qt.rgba(0, 0, 0, 0.3)
0080         }
0081     }
0082 }