aboutsummaryrefslogtreecommitdiff
path: root/src/events/KeyPressedEvent.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-08-02 21:54:15 +0530
committerAkshay Nair <phenax5@gmail.com>2025-08-02 21:58:49 +0530
commitd37020870600d6c842f9a75ebd3986df6010c25c (patch)
tree471e4ebac8661dcc299df61fb01436071e88f4b5 /src/events/KeyPressedEvent.hpp
parent052f043274e122cf4e8f4589e1256d5dfd526252 (diff)
downloadnull-browser-d37020870600d6c842f9a75ebd3986df6010c25c.tar.gz
null-browser-d37020870600d6c842f9a75ebd3986df6010c25c.zip
Add hints extra for opening links (number keys only)
Diffstat (limited to 'src/events/KeyPressedEvent.hpp')
-rw-r--r--src/events/KeyPressedEvent.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/events/KeyPressedEvent.hpp b/src/events/KeyPressedEvent.hpp
new file mode 100644
index 0000000..8c7ded1
--- /dev/null
+++ b/src/events/KeyPressedEvent.hpp
@@ -0,0 +1,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())
+ }
+};