blob: 8c7ded1fb885118c5c03913f56c536c17a0b406b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#include <QtCore>
#include <lua.hpp>
#include <qevent.h>
#include "events/Event.hpp"
class KeyPressedEvent : public Event {
public:
const QString key;
KeyPressedEvent(QString key) : key(std::move(key)) { kind = "KeyPressed"; }
static KeyPressedEvent *from_qkeyevent(QKeyEvent *qevent) {
// TODO: Using with modifiers
auto *event = new KeyPressedEvent(qevent->text());
return event;
}
void lua_push(lua_State *state) const override {
Event::lua_push(state);
SET_FIELD("key", string, key.toStdString().c_str())
}
};
|