mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-11-14 23:47:09 +00:00
32 lines
717 B
QML
32 lines
717 B
QML
import QtQuick 2.0
|
|
import QtQuick.Controls 2.2
|
|
|
|
MenuItem {
|
|
// Qt 5.10 has a menu property, but we need to support 5.9
|
|
// so we must make our own.
|
|
property Menu parentMenu
|
|
|
|
// Ensure focus can't be given to an invisible item
|
|
enabled: visible
|
|
height: visible ? implicitHeight : 0
|
|
focusPolicy: visible ? Qt.TabFocus : Qt.NoFocus
|
|
|
|
onTriggered: {
|
|
// We must close the context menu first or
|
|
// it can steal focus from any dialogs that
|
|
// onTriggered may spawn.
|
|
parentMenu.close()
|
|
}
|
|
|
|
Keys.onReturnPressed: {
|
|
triggered()
|
|
}
|
|
|
|
Keys.onEnterPressed: {
|
|
triggered()
|
|
}
|
|
|
|
Keys.onEscapePressed: {
|
|
parentMenu.close()
|
|
}
|
|
}
|