QCocoaKeyMapper - correctly update key layouts
QCocoaKeyMapper has 2 bugs: - fails to update layouts even if input source changed - while looking for the possible keys it clears bits for neededMods thus making later shortcut match impossible Change-Id: Ie230b973acd5ca6f50b97ca4901ede61b581d273 Task-number: QTBUG-50865 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>bb10
parent
b690fe7cfa
commit
26961e32f3
|
|
@ -390,6 +390,11 @@ bool QCocoaKeyMapper::updateKeyboard()
|
|||
keyboardInputLocale = QLocale::c();
|
||||
keyboardInputDirection = Qt::LeftToRight;
|
||||
}
|
||||
|
||||
const auto newMode = keyboard_mode;
|
||||
deleteLayouts();
|
||||
keyboard_mode = newMode;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -412,10 +417,8 @@ void QCocoaKeyMapper::clearMappings()
|
|||
|
||||
void QCocoaKeyMapper::updateKeyMap(unsigned short macVirtualKey, QChar unicodeKey)
|
||||
{
|
||||
if (updateKeyboard()) {
|
||||
// ### Qt 4 did this:
|
||||
// QKeyMapper::changeKeyboard();
|
||||
}
|
||||
updateKeyboard();
|
||||
|
||||
if (keyLayout[macVirtualKey])
|
||||
return;
|
||||
|
||||
|
|
@ -471,9 +474,8 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
|
|||
for (int i = 1; i < 8; ++i) {
|
||||
Qt::KeyboardModifiers neededMods = ModsTbl[i];
|
||||
int key = kbItem->qtKey[i];
|
||||
if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) {
|
||||
ret << int(key + (keyMods & ~neededMods));
|
||||
}
|
||||
if (key && key != baseKey && ((keyMods & neededMods) == neededMods))
|
||||
ret << int(key + neededMods);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue