Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.3.0
-
None
-
-
933fab137dcaa8bff2a65ca67918f2765875d2cf
Description
On OS X, the Cmd-key is the primary shortcut key and the ControlModifier value corresponds to the Command keys on the Macintosh keyboard.
The problem is, TextEdit, TextField and TextArea suck Control+Something clicks and print the corresponding character into the text instead of executing a shortcut command.
import QtQuick 2.3 import QtQuick.Controls 1.2 Rectangle { width: 360 height: 360 function refresh() { input1.text = "" input2.text = "" input3.text = "" } Keys.onPressed: { if (event.modifiers & Qt.ControlModifier) { if (event.key === Qt.Key_W) { Qt.quit() } if (event.key === Qt.Key_R) { refresh() event.accepted = true } } } Column { anchors.centerIn: parent TextEdit { id: input1 text: "Cmd key test" } TextField { id: input2 text: "README" } TextArea { id: input3 text: "Cmd+R to refresh text\nCmd+W to close window" } Button { id: button text: "Unfocus all text fields" onClicked: button.forceActiveFocus() } } }
The code works great on Ubuntu using a PC keyboard.
Attachments
Issue Links
- is replaced by
-
QTBUG-36281 QKeyEvent regression in Qt5
- Closed