Guitar
UserEvent.h
Go to the documentation of this file.
1 #ifndef USEREVENT_H
2 #define USEREVENT_H
3 
4 #include <QEvent>
5 #include <QVariant>
6 #include <functional>
7 
8 enum class UserEvent {
9  Start = QEvent::User,
11 };
12 
13 class StartEvent : public QEvent {
14 public:
16  : QEvent((QEvent::Type)UserEvent::Start)
17  {
18  }
19 };
20 
21 class UserFunctionEvent : public QEvent {
22 public:
23  std::function<void(QVariant const &, void *ptr)> func;
24  QVariant var;
25  void *ptr = nullptr;
26 
27  explicit UserFunctionEvent(std::function<void(QVariant const &, void *ptr)> const &func, QVariant const &var, void *ptr = nullptr)
28  : QEvent((QEvent::Type)UserEvent::UserFunction)
29  , func(func)
30  , var(var)
31  , ptr(ptr)
32  {
33  }
34 };
35 
36 #endif // USEREVENT_H
UserEvent
UserEvent
Definition: UserEvent.h:8
UserFunctionEvent::var
QVariant var
Definition: UserEvent.h:24
UserFunctionEvent::func
std::function< void(QVariant const &, void *ptr)> func
Definition: UserEvent.h:23
UserEvent.h
UserFunctionEvent
Definition: UserEvent.h:21
UserEvent::UserFunction
@ UserFunction
StartEvent::StartEvent
StartEvent()
Definition: UserEvent.h:15
UserEvent::Start
@ Start
StartEvent
Definition: UserEvent.h:13
UserFunctionEvent::UserFunctionEvent
UserFunctionEvent(std::function< void(QVariant const &, void *ptr)> const &func, QVariant const &var, void *ptr=nullptr)
Definition: UserEvent.h:27
UserFunctionEvent::ptr
void * ptr
Definition: UserEvent.h:25