summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtesttouch.h
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-24 10:34:31 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-24 10:34:31 (GMT)
commitd3ce585a235e6a92b8a662c06f8686da977daa49 (patch)
tree92532e67293b2fde9ba44867ff4ffb1e966efaa3 /src/testlib/qtesttouch.h
parentd8b81cad37e9477e609bbbedf0e666163bbbd813 (diff)
downloadQt-d3ce585a235e6a92b8a662c06f8686da977daa49.zip
Qt-d3ce585a235e6a92b8a662c06f8686da977daa49.tar.gz
Qt-d3ce585a235e6a92b8a662c06f8686da977daa49.tar.bz2
Add QTouchEvent::DeviceType and deviceType()
This enum indicates what kind of device generated the touch event (TouchScreen or TouchPad). We use this information to control how touch events are sent, specifically we restrict touch events to a single widget/QGraphicsItem on touch-pads, since there is no direct relationship between the physical touch location on the pad and the on- using the touch-pad).
Diffstat (limited to 'src/testlib/qtesttouch.h')
-rw-r--r--src/testlib/qtesttouch.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index 042dd7d..e35dbe2 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -62,7 +62,9 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Test)
-extern Q_GUI_EXPORT void qt_translateRawTouchEvent(const QList<QTouchEvent::TouchPoint> &touchPoints, QWidget *window);
+extern Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
+ QTouchEvent::DeviceType deviceType,
+ const QList<QTouchEvent::TouchPoint> &touchPoints);
namespace QTest
{
@@ -104,8 +106,8 @@ namespace QTest
}
private:
- QTouchEventSequence(QWidget *widget)
- : targetWidget(widget)
+ QTouchEventSequence(QWidget *widget, QTouchEvent::DeviceType deviceType)
+ : targetWidget(widget), deviceType(deviceType)
{
}
QTouchEventSequence(const QTouchEventSequence &v);
@@ -125,18 +127,20 @@ namespace QTest
}
void commit()
{
- qt_translateRawTouchEvent(points.values(), targetWidget);
+ qt_translateRawTouchEvent(targetWidget, deviceType, points.values());
targetWidget = 0;
}
QMap<int, QTouchEvent::TouchPoint> points;
QWidget *targetWidget;
- friend QTouchEventSequence touchEvent(QWidget*);
+ QTouchEvent::DeviceType deviceType;
+ friend QTouchEventSequence touchEvent(QWidget *, QTouchEvent::DeviceType);
};
- QTouchEventSequence touchEvent(QWidget *widget = 0)
+ QTouchEventSequence touchEvent(QWidget *widget = 0,
+ QTouchEvent::DeviceType deviceType = QTouchEvent::TouchScreen)
{
- return QTouchEventSequence(widget);
+ return QTouchEventSequence(widget, deviceType);
}
}