fix: Replace context menu to system specific

This commit is contained in:
Petr Mironychev
2026-05-28 10:49:56 +02:00
parent af898bd255
commit 8cbeb7132e

View File

@@ -4,6 +4,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt.labs.platform as Platform
import ChatView
import UIControls
@@ -52,7 +53,7 @@ Flow {
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
onClicked: (mouse) => {
if (mouse.button === Qt.RightButton) {
contextMenu.popup()
contextMenu.open()
} else if (mouse.button === Qt.MiddleButton ||
(mouse.button === Qt.LeftButton && (mouse.modifiers & Qt.ControlModifier))) {
root.removeFileFromListByIndex(fileItem.index)
@@ -70,23 +71,23 @@ Flow {
}
}
Menu {
Platform.Menu {
id: contextMenu
MenuItem {
text: "Open in Qt Creator"
Platform.MenuItem {
text: qsTr("Open in Qt Creator")
onTriggered: fileItem.openFileInEditor()
}
MenuItem {
text: "Open in External Editor"
Platform.MenuItem {
text: qsTr("Open in External Editor")
onTriggered: fileItem.openFileInExternalEditor()
}
MenuSeparator {}
Platform.MenuSeparator {}
MenuItem {
text: "Remove"
Platform.MenuItem {
text: qsTr("Remove")
onTriggered: root.removeFileFromListByIndex(fileItem.index)
}
}