Skip to content
Advertisement

Unable to access menu item in QML through shortcuts

This is the code with QtQuick.Controls.12.2. It displays properly but when I press Ctrl nothing happens.

I expect the print statement to execute. What am I doing wrong here?

JavaScript

Advertisement

Answer

Indeed it looks like it’s not possible to use a single modifier (Ctrl/Shift/…) as a shortcut value.

(See this similar question)

Will work:

JavaScript

Will not work:

JavaScript

A possible workaround for you is to catch the key press outside of the menu:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement