Warning, /maui/mauikit/src/controls.6/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 0021 import QtQuick.Controls 0022 0023 import org.mauikit.controls 1.3 as Maui 0024 0025 import QtQuick.Layouts 0026 import Qt5Compat.GraphicalEffects 0027 0028 /** 0029 * @inherit QtQuick.Controls.Control 0030 * @brief A group of actions positioned in a plegable ribbon that fold/unfolds from a big floating colored button. 0031 * 0032 * <a href="https://doc.qt.io/qt-6/qml-qtquick-controls-control.html">This control inherits from QQC2 Control, to checkout its inherited properties refer to the Qt Docs.</a> 0033 * 0034 * @image html Misc/piebutton.gif 0035 * 0036 * @code 0037 * Maui.PieButton 0038 * { 0039 * Maui.Theme.inherit: false 0040 * anchors.right: parent.right 0041 * anchors.bottom: parent.bottom 0042 * anchors.margins: Maui.Style.space.big 0043 * 0044 * icon.name: "list-add" 0045 * 0046 * Action 0047 * { 0048 * icon.name: "love" 0049 * } 0050 * 0051 * Action 0052 * { 0053 * icon.name: "folder" 0054 * } 0055 * 0056 * Action 0057 * { 0058 * icon.name: "anchor" 0059 * } 0060 * } 0061 * @endcode 0062 * 0063 * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/PieButton.qml">You can find a more complete example at this link.</a> 0064 * 0065 */ 0066 Control 0067 { 0068 id: control 0069 0070 /** 0071 * @brief The action children of this control. 0072 */ 0073 default property list<Action> actions 0074 0075 /** 0076 * @brief The icon group property alias to set the icon name, color, and size. 0077 * @note See Qt documentation on the icon group. 0078 * @property icon PieButton::icon 0079 */ 0080 property alias icon : _button.icon 0081 0082 /** 0083 * @brief The text to be use in the main floating button. 0084 * @property string PieButton::text 0085 */ 0086 property alias text: _button.text 0087 0088 /** 0089 * @brief How to display the text and the icon of the main floating button. 0090 * By default this is set to `ToolButton.IconOnly` 0091 * @property enum PieButton::display 0092 */ 0093 property alias display: _button.display 0094 0095 implicitWidth: implicitContentWidth + leftPadding + rightPadding 0096 implicitHeight: implicitContentHeight + topPadding + bottomPadding 0097 0098 // Behavior on implicitWidth 0099 // { 0100 // NumberAnimation 0101 // { 0102 // duration: Maui.Style.units.longDuration 0103 // easing.type: Easing.InOutQuad 0104 // } 0105 // } 0106 0107 background: Rectangle 0108 { 0109 id: _background 0110 visible: control.implicitWidth > height 0111 0112 color: Maui.Theme.backgroundColor 0113 radius: Maui.Style.radiusV 0114 layer.enabled: true 0115 0116 layer.effect: DropShadow 0117 { 0118 cached: true 0119 horizontalOffset: 0 0120 verticalOffset: 0 0121 radius: 8.0 0122 samples: 16 0123 color: "#333" 0124 opacity: 0.5 0125 smooth: true 0126 source: _background 0127 } 0128 } 0129 0130 contentItem: RowLayout 0131 { 0132 id: _layout 0133 0134 Maui.ToolBar 0135 { 0136 id: _actionsBar 0137 visible: false 0138 0139 background: null 0140 0141 middleContent: Repeater 0142 { 0143 model: control.actions 0144 0145 ToolButton 0146 { 0147 Layout.fillHeight: true 0148 action: modelData 0149 display: ToolButton.TextUnderIcon 0150 onClicked: control.close() 0151 } 0152 } 0153 } 0154 0155 Maui.FloatingButton 0156 { 0157 id: _button 0158 Layout.alignment:Qt.AlignRight 0159 0160 onClicked: _actionsBar.visible = !_actionsBar.visible 0161 } 0162 } 0163 0164 /** 0165 * @brief Forces to open the ribbon containing the action buttons. 0166 */ 0167 function open() 0168 { 0169 _actionsBar.visible = true 0170 } 0171 0172 /** 0173 * @brief Forces to close the ribbon containing the action buttons. 0174 */ 0175 function close() 0176 { 0177 _actionsBar.visible = false 0178 } 0179 } 0180 0181 0182 0183