Warning, /plasma/plank-player/app/qml/MenuButton.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Aditya Mehra <aix.m@outlook.com>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick 2.15
0006 import QtQuick.Layouts 1.15
0007 import QtQuick.Templates 2.15 as QQCT
0008 import org.kde.kirigami 2.19 as Kirigami
0009 
0010 QQCT.Button {
0011      id: menuBtn
0012      width: listView.width
0013      height: Kirigami.Units.gridUnit * 3
0014      property alias iconSource: menuBtnIcon.source
0015 
0016      readonly property Flickable listView: {
0017          var candidate = parent;
0018          while (candidate) {
0019              if (candidate instanceof Flickable) {
0020                  return candidate;
0021              }
0022              candidate = candidate.parent;
0023          }
0024          return null;
0025      }
0026 
0027      background: Rectangle {
0028          color: menuBtn.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0029          radius: 6
0030      }
0031 
0032      contentItem: RowLayout {
0033          Kirigami.Icon {
0034              id: menuBtnIcon
0035              Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0036              Layout.preferredHeight: Kirigami.Units.iconSizes.medium
0037          }
0038 
0039          QQCT.Label {
0040              id: menuBtnText
0041              text: menuBtn.text
0042              color: Kirigami.Theme.textColor
0043              wrapMode: Text.WordWrap
0044              Layout.fillWidth: true
0045          }
0046      }
0047 
0048      Keys.onReturnPressed: (event)=> {
0049          clicked()
0050      }
0051  }