C

SinglePointTouchEventDispatcher Class

class Qul::Platform::SinglePointTouchEventDispatcher

A convenience class for handling single point touch from the platform. More...

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

Public Functions

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

Detailed Description

This class simplifies the job of delivering single point touch events from the platform implementation to the Qt Quick Ultralite library.

By using dispatch with events of the type SinglePointTouchEvent, they automatically get delivered to the Qt Quick Ultralite library.

Example

Create an instance of the dispatcher:

#include <platform/singlepointtoucheventdispatcher.h>

static Qul::Platform::SinglePointTouchEventDispatcher touchEventDispatcher;

Now, call dispatch to pass single point touch events on to the Qt Quick Ultralite library:

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

It might be used in combination with Qul::EventQueue like this:

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

private:
    SinglePointTouchEventDispatcher touchEventDispatcher{&screen};
};

Member Function Documentation

SinglePointTouchEventDispatcher::SinglePointTouchEventDispatcher(PlatformInterface::Screen *screen = nullptr)

Constructs and initializes the single point touch event dispatcher for the given screen.

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

Passes the given event on to the Qt Quick Ultralite library.

Available under certain Qt licenses.
Find out more.