From 10d01df3726558b37b6faeb5e9b442122a454463 Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 26 Nov 2024 19:55:26 +1300 Subject: [PATCH] qtscript: add example --- .gitignore | 1 + examples/libraries/qt-script/main.go | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 examples/libraries/qt-script/main.go diff --git a/.gitignore b/.gitignore index c752ae03..a1dabbbf 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ examples/libraries/extras-scintillaedit/extras-scintillaedit examples/libraries/qt-multimedia/qt-multimedia examples/libraries/qt-network/qt-network examples/libraries/qt-printsupport/qt-printsupport +examples/libraries/qt-script/qt-script examples/libraries/qt-svg/qt-svg examples/libraries/qt6-multimedia/qt6-multimedia examples/libraries/restricted-extras-qscintilla/restricted-extras-qscintilla diff --git a/examples/libraries/qt-script/main.go b/examples/libraries/qt-script/main.go new file mode 100644 index 00000000..1df6b5ce --- /dev/null +++ b/examples/libraries/qt-script/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "os" + + "github.com/mappu/miqt/qt" + "github.com/mappu/miqt/qt/script" +) + +func main() { + + qt.NewQApplication(os.Args) + + inputProgram := "1 + 2" + + eng := script.NewQScriptEngine() + result := eng.Evaluate(inputProgram) + + fmt.Printf("%s = %1.f\n", inputProgram, result.ToNumber()) + + // qt.QApplication_Exec() +}