本页内容

C

Qul::Platform::SinglePointTouchEventDispatcher Class

class Qul::Platform::SinglePointTouchEventDispatcher

一个用于处理平台单点触控的便捷类。更多...

Header: #include <platform/singlepointtoucheventdispatcher.h>
Since: Qt Quick Ultralite (Platform) 1.4

公共函数

SinglePointTouchEventDispatcher(Qul::PlatformInterface::Screen *screen = NULL)
void dispatch(const Qul::Platform::SinglePointTouchEvent &event)

详细说明

该类简化了将单点触摸事件从平台实现传递到Qt Quick Ultralite库的工作。

通过在dispatch 中使用SinglePointTouchEvent 类型的事件,这些事件会自动传递到Qt Quick Ultralite库。

示例

创建分发器的实例:

#include <platform/singlepointtoucheventdispatcher.h>

static Qul::Platform::SinglePointTouchEventDispatcher touchEventDispatcher;

现在,调用 dispatch 方法将单点触摸事件传递给Qt Quick Ultralite 库:

touchEventDispatcher.dispatch(Qul::Platform::SinglePointTouchEvent { timestamp, x, y, pressed });

它可与Qul::EventQueue 结合使用,如下所示:

class SinglePointTouchEventQueue : public EventQueue<SinglePointTouchEvent>
{
public:
    virtual void onEvent(const SinglePointTouchEvent &event)
    {
        touchEventDispatcher.dispatch(event);
    }

private:
    SinglePointTouchEventDispatcher touchEventDispatcher{&screen};
};

成员函数文档

[explicit] SinglePointTouchEventDispatcher::SinglePointTouchEventDispatcher(Qul::PlatformInterface::Screen *screen = NULL)

为给定的screen 创建并初始化单点触摸事件分发器。

void SinglePointTouchEventDispatcher::dispatch(const Qul::Platform::SinglePointTouchEvent &event)

将给定的event 传递给Qt Quick Ultralite库。

在某些 Qt 许可下可用。
了解更多。