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,36 +631,37 @@ QList<int> QAppleKeyMapper::possibleKeys(const QKeyEvent *event) const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else // iOS
|
||||||
// Keyboard keys (non-modifiers)
|
|
||||||
API_AVAILABLE(ios(13.4)) static QHash<NSString *, Qt::Key> uiKitKeys = {
|
|
||||||
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4)
|
|
||||||
{ UIKeyInputF1, Qt::Key_F1 },
|
|
||||||
{ UIKeyInputF2, Qt::Key_F2 },
|
|
||||||
{ UIKeyInputF3, Qt::Key_F3 },
|
|
||||||
{ UIKeyInputF4, Qt::Key_F4 },
|
|
||||||
{ UIKeyInputF5, Qt::Key_F5 },
|
|
||||||
{ UIKeyInputF6, Qt::Key_F6 },
|
|
||||||
{ UIKeyInputF7, Qt::Key_F7 },
|
|
||||||
{ UIKeyInputF8, Qt::Key_F8 },
|
|
||||||
{ UIKeyInputF9, Qt::Key_F9 },
|
|
||||||
{ UIKeyInputF10, Qt::Key_F10 },
|
|
||||||
{ UIKeyInputF11, Qt::Key_F11 },
|
|
||||||
{ UIKeyInputF12, Qt::Key_F12 },
|
|
||||||
{ UIKeyInputHome, Qt::Key_Home },
|
|
||||||
{ UIKeyInputEnd, Qt::Key_End },
|
|
||||||
{ UIKeyInputPageUp, Qt::Key_PageUp },
|
|
||||||
{ UIKeyInputPageDown, Qt::Key_PageDown },
|
|
||||||
#endif
|
|
||||||
{ UIKeyInputEscape, Qt::Key_Escape },
|
|
||||||
{ UIKeyInputUpArrow, Qt::Key_Up },
|
|
||||||
{ UIKeyInputDownArrow, Qt::Key_Down },
|
|
||||||
{ UIKeyInputLeftArrow, Qt::Key_Left },
|
|
||||||
{ UIKeyInputRightArrow, Qt::Key_Right }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// Keyboard keys (non-modifiers)
|
||||||
API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode)
|
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)
|
||||||
|
{ UIKeyInputF1, Qt::Key_F1 },
|
||||||
|
{ UIKeyInputF2, Qt::Key_F2 },
|
||||||
|
{ UIKeyInputF3, Qt::Key_F3 },
|
||||||
|
{ UIKeyInputF4, Qt::Key_F4 },
|
||||||
|
{ UIKeyInputF5, Qt::Key_F5 },
|
||||||
|
{ UIKeyInputF6, Qt::Key_F6 },
|
||||||
|
{ UIKeyInputF7, Qt::Key_F7 },
|
||||||
|
{ UIKeyInputF8, Qt::Key_F8 },
|
||||||
|
{ UIKeyInputF9, Qt::Key_F9 },
|
||||||
|
{ UIKeyInputF10, Qt::Key_F10 },
|
||||||
|
{ UIKeyInputF11, Qt::Key_F11 },
|
||||||
|
{ UIKeyInputF12, Qt::Key_F12 },
|
||||||
|
{ UIKeyInputHome, Qt::Key_Home },
|
||||||
|
{ UIKeyInputEnd, Qt::Key_End },
|
||||||
|
{ UIKeyInputPageUp, Qt::Key_PageUp },
|
||||||
|
{ UIKeyInputPageDown, Qt::Key_PageDown },
|
||||||
|
#endif
|
||||||
|
{ UIKeyInputEscape, Qt::Key_Escape },
|
||||||
|
{ UIKeyInputUpArrow, Qt::Key_Up },
|
||||||
|
{ UIKeyInputDownArrow, Qt::Key_Down },
|
||||||
|
{ UIKeyInputLeftArrow, Qt::Key_Left },
|
||||||
|
{ UIKeyInputRightArrow, Qt::Key_Right }
|
||||||
|
};
|
||||||
|
|
||||||
if (auto key = uiKitKeys.value(keyCode))
|
if (auto key = uiKitKeys.value(keyCode))
|
||||||
return key;
|
return key;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user