summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2021-02-05 11:59:02 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-23 10:50:18 +0000
commit7f22edc00cf9b72aa95fbb2f1e60dcf7f65d3e60 (patch)
treeca9ee7e775b6ef40b2cb33870fbee1d0c40c8c45 /src/gui
parenta363e1e8ea416f72380668f483661cef0b526448 (diff)
iOS: Pass the text to handleExtendedKeyEvent when known
This will ensure that the QKeyEvent also has this information passed on as appropriate. Change-Id: I52436404115b453664b9b3414f8ec4e715dd6a28 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 5540c9c10754963375cd34f740e64b068c440a3e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/platform/darwin/qapplekeymapper.mm6
-rw-r--r--src/gui/platform/darwin/qapplekeymapper_p.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/platform/darwin/qapplekeymapper.mm b/src/gui/platform/darwin/qapplekeymapper.mm
index c66fe784ed..760957ba2a 100644
--- a/src/gui/platform/darwin/qapplekeymapper.mm
+++ b/src/gui/platform/darwin/qapplekeymapper.mm
@@ -74,7 +74,7 @@ static Qt::KeyboardModifiers swapModifiersIfNeeded(const Qt::KeyboardModifiers m
}
Qt::Key QAppleKeyMapper::fromNSString(Qt::KeyboardModifiers qtModifiers, NSString *characters,
- NSString *charactersIgnoringModifiers)
+ NSString *charactersIgnoringModifiers, QString &text)
{
if ([characters isEqualToString:@"\t"]) {
if (qtModifiers & Qt::ShiftModifier)
@@ -93,6 +93,10 @@ Qt::Key QAppleKeyMapper::fromNSString(Qt::KeyboardModifiers qtModifiers, NSStrin
} else if ([characters length] != 0) {
ch = QChar([characters characterAtIndex:0]);
}
+ if (!(qtModifiers & (Qt::ControlModifier | Qt::MetaModifier)) &&
+ (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff)) {
+ text = QString::fromNSString(characters);
+ }
if (!ch.isNull())
return Qt::Key(ch.toUpper().unicode());
}
diff --git a/src/gui/platform/darwin/qapplekeymapper_p.h b/src/gui/platform/darwin/qapplekeymapper_p.h
index 8664ab378b..d8ad6bd45c 100644
--- a/src/gui/platform/darwin/qapplekeymapper_p.h
+++ b/src/gui/platform/darwin/qapplekeymapper_p.h
@@ -57,7 +57,7 @@ public:
static Qt::KeyboardModifiers queryKeyboardModifiers();
QList<int> possibleKeys(const QKeyEvent *event) const;
static Qt::Key fromNSString(Qt::KeyboardModifiers qtMods, NSString *characters,
- NSString *charactersIgnoringModifiers);
+ NSString *charactersIgnoringModifiers, QString &text);
#ifdef Q_OS_MACOS
static Qt::KeyboardModifiers fromCocoaModifiers(NSEventModifierFlags cocoaModifiers);
static NSEventModifierFlags toCocoaModifiers(Qt::KeyboardModifiers);