Warning, /network/neochat/src/qml/AvatarTabButton.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
0002 // SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
0003 // SPDX-License-Identifier: LGPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Layouts
0007 import QtQuick.Controls as QQC2
0008 import QtQuick.Templates as T
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.kirigamiaddons.delegates as Delegates
0011 import org.kde.kirigamiaddons.labs.components as KirigamiComponents
0012 
0013 Delegates.RoundedItemDelegate {
0014     id: root
0015 
0016     property url source
0017 
0018     signal contextMenuRequested
0019     signal selected
0020 
0021     padding: Kirigami.Units.largeSpacing
0022 
0023     QQC2.ToolTip.visible: hovered
0024     QQC2.ToolTip.text: text
0025     QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0026 
0027     Accessible.onPressAction: selected()
0028     Keys.onSpacePressed: selected()
0029     Keys.onEnterPressed: selected()
0030 
0031     onPressAndHold: root.contextMenuRequested()
0032 
0033     TapHandler {
0034         acceptedButtons: Qt.RightButton | Qt.LeftButton
0035         onTapped: (eventPoint, button) => {
0036             if (button === Qt.RightButton) {
0037                 root.contextMenuRequested();
0038             } else {
0039                 root.selected();
0040             }
0041         }
0042     }
0043 
0044     contentItem: KirigamiComponents.Avatar {
0045         source: root.source
0046         name: root.text
0047     }
0048 }