summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp40
-rw-r--r--src/testlib/qtestkeyboard.h4
-rw-r--r--src/testlib/qtestmouse.h16
-rw-r--r--src/testlib/qtesttouch.h35
-rw-r--r--src/testlib/testlib.pro2
5 files changed, 58 insertions, 39 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 87aa0c60b9..f97dcdf7f3 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -617,4 +617,44 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int poi
handleTabletLeaveProximityEvent(time, device, pointerType, uid);
}
+Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier) {
+ QWindowSystemInterface::handleMouseEvent(w, local, global, b, mods);
+}
+
+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)
+{
+ QWindowSystemInterface::handleKeyEvent(w, t, k, mods, text, autorep, count);
+}
+
+static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
+{
+ QWindowSystemInterface::TouchPoint p;
+ p.id = pt.id();
+ p.flags = pt.flags();
+ p.normalPosition = pt.normalizedPos();
+ p.area = pt.screenRect();
+ p.pressure = pt.pressure();
+ p.state = pt.state();
+ p.velocity = pt.velocity();
+ p.rawPositions = pt.rawScreenPositions();
+ return p;
+}
+static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
+{
+ QList<struct QWindowSystemInterface::TouchPoint> newList;
+
+ Q_FOREACH (QTouchEvent::TouchPoint p, pointList)
+ {
+ newList.append(touchPoint(p));
+ }
+ return newList;
+}
+
+Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
+ const QList<QTouchEvent::TouchPoint> &points,
+ Qt::KeyboardModifiers mods = Qt::NoModifier)
+{
+ QWindowSystemInterface::handleTouchEvent(w, device, touchPointList(points), mods);
+}
+
QT_END_NAMESPACE
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index e694a25898..c96253a77a 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -56,7 +56,6 @@
#include <QtGui/qguiapplication.h>
#include <QtGui/qwindow.h>
#include <QtGui/qevent.h>
-#include <QtGui/qwindowsysteminterface.h>
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/qwidget.h>
@@ -67,6 +66,7 @@ QT_BEGIN_HEADER
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);
namespace QTest
{
@@ -77,7 +77,7 @@ namespace QTest
{
QEvent::Type type;
type = press ? QEvent::KeyPress : QEvent::KeyRelease;
- QWindowSystemInterface::handleKeyEvent(window, type, code, modifier, text, repeat, delay);
+ qt_handleKeyEvent(window, type, code, modifier, text, repeat, delay);
#ifdef QT_MAC_USE_COCOA
QTest::qWait(20);
#else
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index 515c2593b9..fa50466d28 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -54,7 +54,6 @@
#include <QtCore/qpoint.h>
#include <QtCore/qstring.h>
#include <QtGui/qevent.h>
-#include <QtGui/qwindowsysteminterface.h>
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/qapplication.h>
@@ -65,6 +64,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier);
namespace QTest
{
@@ -108,24 +108,24 @@ namespace QTest
switch (action)
{
case MousePress:
- QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),button,stateKey);
+ qt_handleMouseEvent(window,pos,window->mapToGlobal(pos),button,stateKey);
lastButton = button;
break;
case MouseRelease:
- QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton,stateKey);
+ qt_handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton,stateKey);
lastButton = Qt::NoButton;
break;
case MouseDClick:
- QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),button,stateKey);
+ qt_handleMouseEvent(window,pos,window->mapToGlobal(pos),button,stateKey);
qWait(10);
- QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton,stateKey);
+ qt_handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton,stateKey);
qWait(20);
- QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),button,stateKey);
+ qt_handleMouseEvent(window,pos,window->mapToGlobal(pos),button,stateKey);
qWait(10);
- QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton,stateKey);
+ qt_handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton,stateKey);
break;
case MouseMove:
- QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),lastButton,stateKey);
+ qt_handleMouseEvent(window,pos,window->mapToGlobal(pos),lastButton,stateKey);
// No QCursor::setPos() call here. That could potentially result in mouse events sent by the windowing system
// which is highly undesired here. Tests must avoid relying on QCursor.
break;
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index c95d2f41eb..a004ccea10 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -51,7 +51,6 @@
#include <QtTest/qtestassert.h>
#include <QtTest/qtestsystem.h>
#include <QtTest/qtestspontaneevent.h>
-#include <QtGui/qwindowsysteminterface.h>
#include <QtCore/qmap.h>
#include <QtGui/qevent.h>
#ifdef QT_WIDGETS_LIB
@@ -62,6 +61,10 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
+ const QList<QTouchEvent::TouchPoint> &points,
+ Qt::KeyboardModifiers mods = Qt::NoModifier);
+
namespace QTest
{
@@ -131,12 +134,12 @@ namespace QTest
if (!points.isEmpty()) {
if (targetWindow)
{
- QWindowSystemInterface::handleTouchEvent(targetWindow, device, touchPointList(points.values()));
+ qt_handleTouchEvent(targetWindow, device, points.values());
}
#ifdef QT_WIDGETS_LIB
else if (targetWidget)
{
- QWindowSystemInterface::handleTouchEvent(targetWidget->windowHandle(), device, touchPointList(points.values()));
+ qt_handleTouchEvent(targetWidget->windowHandle(), device, points.values());
}
#endif
}
@@ -146,31 +149,7 @@ namespace QTest
points.clear();
}
- static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
- {
- QWindowSystemInterface::TouchPoint p;
- p.id = pt.id();
- p.flags = pt.flags();
- p.normalPosition = pt.normalizedPos();
- p.area = pt.screenRect();
- p.pressure = pt.pressure();
- p.state = pt.state();
- p.velocity = pt.velocity();
- p.rawPositions = pt.rawScreenPositions();
- return p;
- }
- static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
- {
- QList<struct QWindowSystemInterface::TouchPoint> newList;
-
- Q_FOREACH (QTouchEvent::TouchPoint p, pointList)
- {
- newList.append(touchPoint(p));
- }
- return newList;
- }
-
- private:
+private:
#ifdef QT_WIDGETS_LIB
QTouchEventSequence(QWidget *widget, QTouchDevice *aDevice, bool autoCommit)
: targetWidget(widget), targetWindow(0), device(aDevice), commitWhenDestroyed(autoCommit)
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index c6c3a58816..5bbefb9f11 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -4,7 +4,7 @@ TARGET = QtTest
QT = core-private
CONFIG += exceptions
-MODULE_CONFIG = console testlib_defines auto_use_privates
+MODULE_CONFIG = console testlib_defines
unix:!embedded:QMAKE_PKGCONFIG_DESCRIPTION = Qt \
Unit \