diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2012-07-26 18:48:56 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-02 17:25:37 +0200 |
commit | 5ac4a1304b44283bb0ddf593b08e7e44ed9a107f (patch) | |
tree | 632ffbe48e35227ca25faa6797f2e75901e673e6 /src/gui | |
parent | 4c4ba15a409737abe7cc07bdc452d556ec9ecbdc (diff) |
Make tests compile without gui-private
Add new qt_handleXXX functions that forward to the QWindowSystemInterface
functions, and use those in the testlib inline functions. Remove use of
struct QWindowSystemInterface::TouchPoint from the testlib header files
(requiring some slight increase in ugliness in the two tests that use
that struct).
Also remove the qmake hack that adds private headers to all tests
Change-Id: Iec23537e55a44802f6e9cd463f7a0f82007c5250
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 40 |
1 files changed, 40 insertions, 0 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 |