Migration of QtMvvm from github
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
891 B

7 years ago
#ifndef WIDGETSEVENTSERVICE_H
#define WIDGETSEVENTSERVICE_H
#include <QtCore/QObject>
#include <QtCore/QHash>
#include <QtCore/QTimer>
#include <QtCore/QSharedPointer>
#include <ieventservice.h>
#include <echoservice.h>
#include <QtMvvmCore/ViewModel>
class WidgetsEventService : public QObject, public IEventService
{
Q_OBJECT
Q_INTERFACES(IEventService)
QTMVVM_INJECT_PROP(EchoService*, echoService, _echoService)
public:
Q_INVOKABLE explicit WidgetsEventService(QObject *parent = nullptr);
explicit WidgetsEventService(EchoService* svc, QObject *parent = nullptr);
7 years ago
int addEvent(const QString &name) override;
void removeEvent(int eventId) override;
Q_SIGNALS:
void eventTriggered(const QString &event) final;
private:
int _cnt;
QHash<int, QSharedPointer<QTimer>> _events;
EchoService* _echoService;
Q_INVOKABLE void qtmvvm_init();
7 years ago
};
#endif // WIDGETSEVENTSERVICE_H