Warning, /pim/kube/framework/qml/ContextMenuOverlay.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
0003 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
0004 *
0005 * This program is free software; you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation; either version 2 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License along
0016 * with this program; if not, write to the Free Software Foundation, Inc.,
0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019
0020 import QtQuick 2.7
0021 import QtQuick.Controls 2.2
0022 import org.kube.framework 1.0 as Kube
0023 import QtQuick.Layouts 1.3
0024
0025 Item {
0026 id: root
0027 default property alias children: menuLayout.children
0028 function close() {
0029 menu.close()
0030 }
0031
0032 Component.onCompleted: {
0033 for (var i = 0; i < root.children.length; i++) {
0034 var child = root.children[i]
0035 child.Layout.fillWidth = true
0036 child.clicked.connect(close)
0037 }
0038 }
0039
0040 Rectangle {
0041 anchors.fill: parent
0042 color: Kube.Colors.highlightColor
0043 visible: menu.visible
0044 opacity: 0.3
0045 radius: Kube.Units.smallSpacing
0046 }
0047 MouseArea {
0048 id: mouseArea
0049 anchors.fill: parent
0050 hoverEnabled: false
0051 acceptedButtons: Qt.RightButton
0052 z: 1
0053 onClicked: {
0054 menu.x = mouseX
0055 menu.y = mouseY
0056 menu.open()
0057 mouse.accepted = true
0058 }
0059 }
0060 Menu {
0061 id: menu
0062
0063 height: menuLayout.height
0064 width: menuLayout.width
0065 background: Rectangle {
0066 anchors.fill: parent
0067 color: Kube.Colors.backgroundColor
0068 }
0069 ColumnLayout {
0070 id: menuLayout
0071 }
0072 }
0073 }
0074