Warning, /maui/mauikit/src/controls.5/PieButton.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 QtQuick.Controls 2.14
0022
0023 import org.mauikit.controls 1.2 as Maui
0024
0025 import QtQuick.Layouts 1.3
0026 import QtGraphicalEffects 1.0
0027
0028 /**
0029 * PieButton
0030 * A global sidebar for the application window that can be collapsed.
0031 *
0032 *
0033 *
0034 *
0035 *
0036 *
0037 */
0038 Item
0039 {
0040 id: control
0041
0042 /**
0043 * alignment : int
0044 */
0045 property int alignment : Qt.AlignLeft
0046
0047 /**
0048 * maxWidth : int
0049 */
0050 property int maxWidth : ApplicationWindow.overlay.width - control.anchors.margins
0051
0052 /**
0053 * actions : list<Action>
0054 */
0055 default property list<Action> actions
0056
0057 /**
0058 * icon : icon
0059 */
0060 property alias icon : _button.icon
0061
0062 /**
0063 * text : string
0064 */
0065 property alias text: _button.text
0066
0067 /**
0068 * display : ToolButton.display
0069 */
0070 property alias display: _button.display
0071
0072 implicitWidth: _actionsBar.visible ? Math.min(maxWidth, height + _actionsBar.implicitWidth + Maui.Style.space.big) : height
0073
0074 Behavior on implicitWidth
0075 {
0076 NumberAnimation
0077 {
0078 duration: Maui.Style.units.longDuration
0079 easing.type: Easing.InOutQuad
0080 }
0081 }
0082
0083 MouseArea
0084 {
0085 id: _overlay
0086 anchors.fill: parent
0087 parent: control.parent
0088 preventStealing: true
0089 propagateComposedEvents: true
0090 visible: _actionsBar.visible
0091 opacity: visible ? 1 : 0
0092
0093 Behavior on opacity
0094 {
0095 NumberAnimation
0096 {
0097 duration: Maui.Style.units.longDuration
0098 easing.type: Easing.InOutQuad
0099 }
0100 }
0101 Rectangle
0102 {
0103 color: Qt.rgba(control.Maui.Theme.backgroundColor.r,control.Maui.Theme.backgroundColor.g,control.Maui.Theme.backgroundColor.b, 0.5)
0104 anchors.fill: parent
0105 }
0106
0107 onClicked:
0108 {
0109 control.close()
0110 mouse.accepted = false
0111 }
0112 }
0113
0114 Rectangle
0115 {
0116 id: _background
0117 visible: control.implicitWidth > height
0118 anchors.fill: parent
0119 color: control.Maui.Theme.backgroundColor
0120 radius: Maui.Style.radiusV
0121 }
0122
0123 DropShadow
0124 {
0125 visible: _actionsBar.visible
0126 anchors.fill: _background
0127 cached: true
0128 horizontalOffset: 0
0129 verticalOffset: 0
0130 radius: 8.0
0131 samples: 16
0132 color: "#333"
0133 opacity: 0.5
0134 smooth: true
0135 source: _background
0136 }
0137
0138 RowLayout
0139 {
0140 anchors.fill: parent
0141
0142 Maui.ToolBar
0143 {
0144 id: _actionsBar
0145 visible: false
0146 Layout.fillWidth: true
0147 Layout.fillHeight: true
0148
0149 background: null
0150
0151 middleContent: Repeater
0152 {
0153 model: control.actions
0154
0155 ToolButton
0156 {
0157 Layout.fillHeight: true
0158 action: modelData
0159 display: ToolButton.TextUnderIcon
0160 onClicked: control.close()
0161 }
0162 }
0163 }
0164
0165 Maui.FloatingButton
0166 {
0167 id: _button
0168 Layout.preferredWidth: control.height
0169 Layout.preferredHeight: control.height
0170 Layout.alignment:Qt.AlignRight
0171
0172 onClicked: _actionsBar.visible = !_actionsBar.visible
0173 }
0174 }
0175
0176 /**
0177 *
0178 */
0179 function open()
0180 {
0181 _actionsBar.visible = true
0182 }
0183
0184 /**
0185 *
0186 */
0187 function close()
0188 {
0189 _actionsBar.visible = false
0190 }
0191 }
0192
0193
0194
0195