From d37020870600d6c842f9a75ebd3986df6010c25c Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 2 Aug 2025 21:54:15 +0530 Subject: Add hints extra for opening links (number keys only) --- src/events/KeyPressedEvent.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/events/KeyPressedEvent.hpp (limited to 'src/events/KeyPressedEvent.hpp') 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 +#include +#include + +#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()) + } +}; -- cgit v1.3.1