diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-10 22:04:24 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-10 22:13:15 +0530 |
| commit | 971854bfefad4c644ac3d5f5d6003f24d551bf1d (patch) | |
| tree | 0f5ee90fd5968d345b157d38964094837315edf0 /templates | |
| parent | d400369084107104f51fe217d5781c8d7bd07ff9 (diff) | |
| download | null-browser-971854bfefad4c644ac3d5f5d6003f24d551bf1d.tar.gz null-browser-971854bfefad4c644ac3d5f5d6003f24d551bf1d.zip | |
Add completer + simplify command parsing + class generator
Diffstat (limited to 'templates')
| -rwxr-xr-x | templates/qclass.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/templates/qclass.sh b/templates/qclass.sh new file mode 100755 index 0000000..8ad085a --- /dev/null +++ b/templates/qclass.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env sh + +set -e -o pipefail + +class_name="$1" +path="$2" + +[ -z "$class_name" ] && exit 1 + +mkdir -p "./include/$path"; +mkdir -p "./src/$path"; + +# Header +echo "#pragma once + +#include <QtCore> +#include <QWidget> + +class $class_name : public QWidget { + Q_OBJECT + + public: + $class_name(); +}; +" > "./include/$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" |
