summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-06-12 23:42:59 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-10-30 11:40:18 +0100
commitd7ca800a87a2291c94c6580f0cfe068bb2280caf (patch)
tree8eb635ee119d6b6e893b98df3c3cc04a90da4ba1 /src/testlib
parentf6f797a6c3b794d14c312855bacc8b5b89ea6127 (diff)
Clean up ShortcutOverride handling
Instead of sending the event from random places, send it from QWindowSystemInterface. This allows to send override events on OS X to menus before doing other key processing and reduces the number of ShortcutOverride events on all platforms to exactly one per key press event. Additional test by Friedemann Kleint. Task-number: QTBUG-38986 Change-Id: I6981bb776aba586ebc7c3daa5fd7a0d84c25bc3e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestkeyboard.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index 57c3a27295..e533293476 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -57,6 +57,7 @@
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
+Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1);
namespace QTest
{
@@ -170,6 +171,9 @@ namespace QTest
QKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat);
QSpontaneKeyEvent::setSpontaneous(&a);
+
+ if (press && qt_sendShortcutOverrideEvent(widget, a.timestamp(), code, modifier, text, repeat))
+ return;
if (!qApp->notify(widget, &a))
QTest::qWarn("Keyboard event not accepted by receiving widget");
}