Add room context menu with Leave/Decline invite

This commit is contained in:
miruka
2019-08-21 14:58:57 -04:00
parent fea2178461
commit 6067c8ec96
5 changed files with 56 additions and 21 deletions

5
src/qml/Base/HMenu.qml Normal file
View File

@@ -0,0 +1,5 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Menu {
}

View File

@@ -0,0 +1,5 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
MenuItem {
}

View File

@@ -20,6 +20,8 @@ HButton {
readonly property alias rightInfo: rightInfo
readonly property alias subtitle: subtitle
property HMenu contextMenu: HMenu {}
property Item image
property Item details: HColumnLayout {
@@ -75,14 +77,6 @@ HButton {
onActivated: view.currentIndex = model.index
onClicked: {
view.highlightRangeMode = ListView.NoHighlightRange
view.highlightMoveDuration = 0
activated()
view.highlightRangeMode = ListView.ApplyRange
view.highlightMoveDuration = theme.animationDuration
}
Timer {
interval: 100
@@ -91,4 +85,25 @@ HButton {
// Component.onCompleted won't work for this
onTriggered: if (shouldBeCurrent) view.currentIndex = model.index
}
TapHandler {
acceptedButtons: Qt.LeftButton
onTapped: {
view.highlightRangeMode = ListView.NoHighlightRange
view.highlightMoveDuration = 0
activated()
view.highlightRangeMode = ListView.ApplyRange
view.highlightMoveDuration = theme.animationDuration
}
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: if (contextMenu.count > 0) contextMenu.popup()
}
TapHandler {
acceptedButtons: Qt.LeftButton | Qt.RightButton
onLongPressed: if (contextMenu.count > 0) contextMenu.popup()
}
}