void GestureEngine::removeTouchPoint(QTouchEvent::TouchPoint e)
{
    gwc::touchpoint removed_point;
    removed_point.init(e.id(), e.pos().x() / 1920, e.pos().y()/ 1080, 0, 1, 1);
    removed_point.status = gwc::TOUCHREMOVED;
    addEvent(removed_point);
}
void GestureEngine::updateTouchPoint(QTouchEvent::TouchPoint e)
{
    gwc::touchpoint updated_point;
    updated_point.init(e.id(), e.pos().x() / 1920, e.pos().y()/ 1080, 0, 1, 1);
    updated_point.status = gwc::TOUCHUPDATE;
    addEvent(updated_point);
}
void GestureEngine::addTouchPoint(QTouchEvent::TouchPoint e)
{
    gwc::touchpoint new_point;
    new_point.init(e.id(), e.pos().x() / 1920, e.pos().y() / 1080, 0, 1920, 1080);
    new_point.status = gwc::TOUCHADDED;
    addEvent(new_point);

    qDebug() << "Added to Gestureworks";
}
Esempio n. 4
0
QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &s)
{
	dbg.nospace() << "\"TouchPoint\":"
			<< "{ \"id\":" << s.id()
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
			<< ", \"primary\":\"" << (s.isPrimary() ? "true" : "false") << "\""
#endif
			<< ", \"state\":" << touchStateToString(s.state())
			<< ", \"pos\":\"" << s.pos() << "\""
			<< ", \"pressure\":\"" << s.pressure() << "\""
			<< " }";
	return dbg.space();
}
Esempio n. 5
0
PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point)
{
    // The QTouchEvent::TouchPoint API states that ids will be >= 0.
    m_id = static_cast<unsigned>(point.id());
    switch (point.state()) {
    case Qt::TouchPointReleased: m_state = TouchReleased; break;
    case Qt::TouchPointMoved: m_state = TouchMoved; break;
    case Qt::TouchPointPressed: m_state = TouchPressed; break;
    case Qt::TouchPointStationary: m_state = TouchStationary; break;
    }
    m_screenPos = point.screenPos().toPoint();
    m_pos = point.pos().toPoint();
}
PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point, State state)
    // The QTouchEvent::TouchPoint API states that ids will be >= 0.
    : m_id(point.id())
    , m_state(state)
    , m_screenPos(point.screenPos().toPoint())
    , m_pos(point.pos().toPoint())
{
    // Qt reports touch point size as rectangles, but we will pretend it is an oval.
    QRect touchRect = point.rect().toAlignedRect();
    if (touchRect.isValid()) {
        m_radiusX = point.rect().width() / 2;
        m_radiusY = point.rect().height() / 2;
    } else {
        // http://www.w3.org/TR/2011/WD-touch-events-20110505: 1 if no value is known.
        m_radiusX = 1;
        m_radiusY = 1;
    }
    m_force = point.pressure();
    // FIXME: Support m_rotationAngle if QTouchEvent at some point supports it.
}