Warning, /plasma/kwin/src/kcms/decoration/ui/ButtonGroup.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 import QtQuick
0007 
0008 import org.kde.kirigami 2.20 as Kirigami
0009 import org.kde.kwin.private.kdecoration as KDecoration
0010 
0011 ListView {
0012     id: view
0013     property string key
0014     property bool dragActive: false
0015     property int iconSize: Kirigami.Units.iconSizes.small
0016     orientation: ListView.Horizontal
0017     interactive: false
0018     spacing: Kirigami.Units.smallSpacing
0019     implicitHeight: iconSize
0020     implicitWidth: count * (iconSize + Kirigami.Units.smallSpacing) - Math.min(1, count) * Kirigami.Units.smallSpacing
0021     delegate: Item {
0022         width: view.iconSize
0023         height: view.iconSize
0024         KDecoration.Button {
0025             id: button
0026             property int itemIndex: index
0027             property var buttonsModel: parent.ListView.view.model
0028             bridge: bridgeItem.bridge
0029             settings: settingsItem
0030             type: model["button"]
0031             width: view.iconSize
0032             height: view.iconSize
0033             anchors.fill: Drag.active ? undefined : parent
0034             Drag.keys: [ "decoButtonRemove", view.key ]
0035             Drag.active: dragArea.drag.active
0036             Drag.onActiveChanged: view.dragActive = Drag.active
0037             color: palette.windowText
0038             opacity: parent.enabled ? 1.0 : 0.3
0039         }
0040         MouseArea {
0041             id: dragArea
0042             cursorShape: Qt.SizeAllCursor
0043             anchors.fill: parent
0044             drag.target: button
0045             onReleased: {
0046                 if (drag.target.Drag.target) {
0047                     drag.target.Drag.drop();
0048                 } else {
0049                     drag.target.Drag.cancel();
0050                 }
0051             }
0052         }
0053     }
0054     add: Transition {
0055         NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration/2 }
0056         NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration/2 }
0057     }
0058     move: Transition {
0059         NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration/2 }
0060         NumberAnimation { property: "scale"; from: 0; to: 1.0; duration: Kirigami.Units.longDuration/2 }
0061     }
0062     displaced: Transition {
0063         NumberAnimation { properties: "x,y"; duration: Kirigami.Units.longDuration; easing.type: Easing.OutBounce }
0064     }
0065 }