[Interest] QML and mac system menu
Alexander Dyagilev
alervdvcw at gmail.com
Tue Sep 10 15:10:33 CEST 2019
Hello,
I have the following code:
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.0
import Qt.labs.platform 1.0 as QtLabs
ApplicationWindow {
width: 1024
height: 600
visible: true
TextArea
{
anchors.fill: parent
selectByMouse: true
}
QtLabs.MenuBar {
QtLabs.Menu {
title: qsTr("&File")
QtLabs.MenuItem {
text: qsTr("&Open")
onTriggered: openDialog.open()
}
QtLabs.MenuItem {
text: qsTr("&Quit")
onTriggered: Qt.quit()
}
}
QtLabs.Menu {
title: qsTr("&Edit")
type: QtLabs.Menu.EditMenu
QtLabs.MenuItem {
text: qsTr("&Copy")
shortcut: StandardKey.Copy
}
QtLabs.MenuItem {
text: qsTr("Cu&t")
shortcut: StandardKey.Cut
}
QtLabs.MenuItem {
text: qsTr("&Paste")
shortcut: StandardKey.Paste
}
}
}
}
1) In my TextArea Cmd+V (Paste) keyboard shortcut works, but Paste menu
item from mac system menu is not working. Am I doing something wrong or
I should implement it on my own? This can be quite annoying because in
my real app I have many text controls in different situations.
2) Is there a way to add my custom menu items to the first menu element
of my app system menu (which is bold). E.g. "untitled" in my case: .
"Quit" menu goes there automatically despite it's in "File" menu really,
according to the QML code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190910/334ea946/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndgdafhjabbjgbkn.png
Type: image/png
Size: 2011 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190910/334ea946/attachment.png>
More information about the Interest
mailing list