aboutsummaryrefslogtreecommitdiff
path: root/include/widgets/CommandInput.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-09 19:47:50 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-09 19:47:50 +0530
commit61f99089288138989cf244d174882aa5088b738b (patch)
treeea1202b098b92e85b16e670d1c3ea1b86fcaef58 /include/widgets/CommandInput.hpp
parent1e2302be2b47fbeb340db7482ed8476c829a7f66 (diff)
downloadnull-browser-61f99089288138989cf244d174882aa5088b738b.tar.gz
null-browser-61f99089288138989cf244d174882aa5088b738b.zip
Refactor directory structure
Diffstat (limited to 'include/widgets/CommandInput.hpp')
-rw-r--r--include/widgets/CommandInput.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/widgets/CommandInput.hpp b/include/widgets/CommandInput.hpp
new file mode 100644
index 0000000..a6ca0ed
--- /dev/null
+++ b/include/widgets/CommandInput.hpp
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <QBoxLayout>
+#include <QKeyEvent>
+#include <QLineEdit>
+
+class CommandInput : public QWidget {
+ Q_OBJECT
+
+public:
+ CommandInput(QString defaultInput = "", QWidget *parentNode = nullptr);
+ void setInputFocus(bool focussed);
+ bool isInputFocussed();
+ QString getInputCommand();
+ void setInputText(QString text);
+
+signals:
+ void submitted(QString command);
+ void cancelled();
+
+protected:
+ void keyPressEvent(QKeyEvent *event) override;
+ void emitSubmit();
+
+private:
+ QBoxLayout *layout;
+ QLineEdit *input;
+};