Avoid file-static initialization of symbols that need @availability check
Fixes crash in key mapper on iOS < 13.4, where the symbols are not available. Pick-to: 6.2 6.3 Fixes: QTBUG-100518 Change-Id: I9bb1a75b17e5f0f50205b757fdb673218d7fb5e0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
851143eff1
commit
242e35e774
@ -631,9 +631,12 @@ QList<int> QAppleKeyMapper::possibleKeys(const QKeyEvent *event) const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else // iOS
|
||||||
|
|
||||||
// Keyboard keys (non-modifiers)
|
// Keyboard keys (non-modifiers)
|
||||||
API_AVAILABLE(ios(13.4)) static QHash<NSString *, Qt::Key> uiKitKeys = {
|
API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode)
|
||||||
|
{
|
||||||
|
static QHash<NSString *, Qt::Key> uiKitKeys = {
|
||||||
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4)
|
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4)
|
||||||
{ UIKeyInputF1, Qt::Key_F1 },
|
{ UIKeyInputF1, Qt::Key_F1 },
|
||||||
{ UIKeyInputF2, Qt::Key_F2 },
|
{ UIKeyInputF2, Qt::Key_F2 },
|
||||||
@ -659,8 +662,6 @@ API_AVAILABLE(ios(13.4)) static QHash<NSString *, Qt::Key> uiKitKeys = {
|
|||||||
{ UIKeyInputRightArrow, Qt::Key_Right }
|
{ UIKeyInputRightArrow, Qt::Key_Right }
|
||||||
};
|
};
|
||||||
|
|
||||||
API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode)
|
|
||||||
{
|
|
||||||
if (auto key = uiKitKeys.value(keyCode))
|
if (auto key = uiKitKeys.value(keyCode))
|
||||||
return key;
|
return key;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user