summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qnsview_complextext.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview_complextext.mm')
-rw-r--r--src/plugins/platforms/cocoa/qnsview_complextext.mm11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview_complextext.mm b/src/plugins/platforms/cocoa/qnsview_complextext.mm
index 4be8126299..ad5f5a0827 100644
--- a/src/plugins/platforms/cocoa/qnsview_complextext.mm
+++ b/src/plugins/platforms/cocoa/qnsview_complextext.mm
@@ -112,9 +112,14 @@
KeyEvent newlineEvent(m_currentlyInterpretedKeyEvent ?
m_currentlyInterpretedKeyEvent : NSApp.currentEvent);
newlineEvent.type = QEvent::KeyPress;
- newlineEvent.key = Qt::Key_Return;
- newlineEvent.text = QLatin1Char(kReturnCharCode);
- newlineEvent.nativeVirtualKey = kVK_Return;
+
+ const bool isEnter = newlineEvent.modifiers & Qt::KeypadModifier;
+ newlineEvent.key = isEnter ? Qt::Key_Enter : Qt::Key_Return;
+ newlineEvent.text = isEnter ? QLatin1Char(kEnterCharCode)
+ : QLatin1Char(kReturnCharCode);
+ newlineEvent.nativeVirtualKey = isEnter ? kVK_ANSI_KeypadEnter
+ : kVK_Return;
+
qCDebug(lcQpaKeys) << "Inserting newline via" << newlineEvent;
newlineEvent.sendWindowSystemEvent(m_platformWindow->window());
}