From b4bbd58c77fa899dad142ab2bf9715654950215d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 26 Jan 2019 23:11:09 -0800 Subject: [PATCH] Add long press action on PC view for touchscreens --- app/gui/PcView.qml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 2bb25cd4..02957ca5 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -186,20 +186,24 @@ GridView { } } + onPressAndHold: { + if (!model.addPc) { + // popup() ensures the menu appears under the mouse cursor + if (pcContextMenu.popup) { + pcContextMenu.popup() + } + else { + // Qt 5.9 doesn't have popup() + pcContextMenu.open() + } + } + } + MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton; onClicked: { - if (!model.addPc) { - // popup() ensures the menu appears under the mouse cursor - if (pcContextMenu.popup) { - pcContextMenu.popup() - } - else { - // Qt 5.9 doesn't have popup() - pcContextMenu.open() - } - } + parent.onPressAndHold() } }