Cocoa: Check if charactersIgnoringModifiers is not empty too
If a dead key occurs as a result of pressing a key combination then characters will have 0 length, but charactersIgnoringModifiers will have a valid character in it. This enables key combinations such as ALT+E to be used as a shortcut with an English keyboard even though pressing ALT+E will give a dead key while doing normal text input. Task-number: QTBUG-57933 Change-Id: I52fe9edacefe7298a96af5430831f805626bacd2 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>bb10
parent
82ed3b8ca5
commit
202d3ba3e6
|
|
@ -1523,10 +1523,16 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
|||
|
||||
QChar ch = QChar::ReplacementCharacter;
|
||||
int keyCode = Qt::Key_unknown;
|
||||
if ([characters length] != 0) {
|
||||
|
||||
// If a dead key occurs as a result of pressing a key combination then
|
||||
// characters will have 0 length, but charactersIgnoringModifiers will
|
||||
// have a valid character in it. This enables key combinations such as
|
||||
// ALT+E to be used as a shortcut with an English keyboard even though
|
||||
// pressing ALT+E will give a dead key while doing normal text input.
|
||||
if ([characters length] != 0 || [charactersIgnoringModifiers length] != 0) {
|
||||
if (((modifiers & Qt::MetaModifier) || (modifiers & Qt::AltModifier)) && ([charactersIgnoringModifiers length] != 0))
|
||||
ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
|
||||
else
|
||||
else if ([characters length] != 0)
|
||||
ch = QChar([characters characterAtIndex:0]);
|
||||
keyCode = [self convertKeyCode:ch];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue