aboutsummaryrefslogtreecommitdiff
path: root/templates/qwidget.sh
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-21 19:00:45 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-21 19:44:57 +0530
commit7ec8336431787156826185628ad3ee05dc327d2a (patch)
tree0b984450aa1ee09f6592eadb898b17ffddd45219 /templates/qwidget.sh
parentfdeb33d34a97d062a120f72da919f81d7b1d45bf (diff)
downloadnull-browser-7ec8336431787156826185628ad3ee05dc327d2a.tar.gz
null-browser-7ec8336431787156826185628ad3ee05dc327d2a.zip
Add event loop with uv
Diffstat (limited to 'templates/qwidget.sh')
-rwxr-xr-xtemplates/qwidget.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/templates/qwidget.sh b/templates/qwidget.sh
new file mode 100755
index 0000000..6706e19
--- /dev/null
+++ b/templates/qwidget.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env sh
+
+set -e -o pipefail
+
+class_name="$1"
+path="$2"
+
+[ -z "$class_name" ] && exit 1
+
+if ! [ -z "$path" ]; then
+ mkdir -p "./src/$path"
+fi
+
+# Header
+echo "#pragma once
+
+#include <QtCore>
+#include <QWidget>
+
+class $class_name : public QWidget {
+ Q_OBJECT
+
+ public:
+ $class_name();
+};
+" > "./src/$path/$class_name.hpp"
+
+# Implementation
+echo "#include <QtCore>
+#include <QWidget>
+
+#include \"$path/$class_name.hpp\"
+
+$class_name::$class_name(): QWidget() {}
+" > "./src/$path/$class_name.cpp"