diff options
author | Ian <ian@mediator-software.com> | 2011-06-20 14:19:11 (GMT) |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2011-06-27 13:48:27 (GMT) |
commit | 053b3620fc182b4d4f7917926235f5631fc4a504 (patch) | |
tree | 9bf9e5ddb4d7c8dfea074ec64f01896273d6475a /src/plugins | |
parent | 6f9cd3170d917c8ab3b526d3e4cc33c714e26648 (diff) | |
download | Qt-053b3620fc182b4d4f7917926235f5631fc4a504.zip Qt-053b3620fc182b4d4f7917926235f5631fc4a504.tar.gz Qt-053b3620fc182b4d4f7917926235f5631fc4a504.tar.bz2 |
Post key events via QWindowSystemInterface, don't post events direcly
Merge-request: 1275
Reviewed-by: con
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/uikit/quikiteventloop.mm | 3 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitwindow.mm | 36 |
2 files changed, 12 insertions, 27 deletions
diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm index c049563..a7c276f 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.mm +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -73,7 +73,6 @@ foreach (QWidget *widget, qApp->topLevelWidgets()) { QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); if (platformWindow) platformWindow->ensureNativeWindow(); - else qDebug() << "Failed to get platform window: " << widget; } return YES; } @@ -81,8 +80,6 @@ - (void)applicationWillTerminate:(UIApplication *)application { Q_UNUSED(application) - // TODO this isn't called for some reason - qDebug() << "quit"; qApp->quit(); } diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm index fe29fd6..ec33cd0 100644 --- a/src/plugins/platforms/uikit/quikitwindow.mm +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -289,37 +289,25 @@ private: - (void)insertText:(NSString *)text { - QKeyEvent *ev; + QString string = QString::fromUtf8([text UTF8String]); int key = 0; if ([text isEqualToString:@"\n"]) key = (int)Qt::Key_Return; - ev = new QKeyEvent(QEvent::KeyPress, - key, - Qt::NoModifier, - QString::fromUtf8([text UTF8String]) - ); - qApp->postEvent(qApp->focusWidget(), ev); - ev = new QKeyEvent(QEvent::KeyRelease, - key, - Qt::NoModifier, - QString::fromUtf8([text UTF8String]) - ); - qApp->postEvent(qApp->focusWidget(), ev); + + // Send key event to window system interface + QWindowSystemInterface::handleKeyEvent( + 0, QEvent::KeyPress, key, Qt::NoModifier, string, false, int(string.length())); + QWindowSystemInterface::handleKeyEvent( + 0, QEvent::KeyRelease, key, Qt::NoModifier, string, false, int(string.length())); } - (void)deleteBackward { - QKeyEvent *ev; - ev = new QKeyEvent(QEvent::KeyPress, - (int)Qt::Key_Backspace, - Qt::NoModifier - ); - qApp->postEvent(qApp->focusWidget(), ev); - ev = new QKeyEvent(QEvent::KeyRelease, - (int)Qt::Key_Backspace, - Qt::NoModifier - ); - qApp->postEvent(qApp->focusWidget(), ev); + // Send key event to window system interface + QWindowSystemInterface::handleKeyEvent( + 0, QEvent::KeyPress, (int)Qt::Key_Backspace, Qt::NoModifier); + QWindowSystemInterface::handleKeyEvent( + 0, QEvent::KeyRelease, (int)Qt::Key_Backspace, Qt::NoModifier); } @end |