From a67d7cfe65f6bdb99fd9f50641492dc1d2543801 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 15 Feb 2025 17:10:34 +1300 Subject: [PATCH] examples: add android6 example --- examples/android6/main.go | 29 ++++++++++++++++++++++++++++ examples/android6/startup_android.go | 14 ++++++++++++++ examples/android6/startup_other.go | 7 +++++++ 3 files changed, 50 insertions(+) create mode 100644 examples/android6/main.go create mode 100644 examples/android6/startup_android.go create mode 100644 examples/android6/startup_other.go diff --git a/examples/android6/main.go b/examples/android6/main.go new file mode 100644 index 00000000..7ce9703b --- /dev/null +++ b/examples/android6/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "os" + + qt "github.com/mappu/miqt/qt6" +) + +func myRealMainFunc() { + + qt.NewQApplication(os.Args) + + btn := qt.NewQPushButton3("Hello world!") + btn.SetFixedWidth(320) + + var counter int = 0 + + btn.OnPressed(func() { + counter++ + btn.SetText(fmt.Sprintf("You have clicked the button %d time(s)", counter)) + }) + + btn.Show() + + qt.QApplication_Exec() + + fmt.Println("OK!") +} diff --git a/examples/android6/startup_android.go b/examples/android6/startup_android.go new file mode 100644 index 00000000..2fbc4d5b --- /dev/null +++ b/examples/android6/startup_android.go @@ -0,0 +1,14 @@ +// +build android + +package main + +import "C" // Required for export support + +//export AndroidMain +func AndroidMain() { + myRealMainFunc() +} + +func main() { + // Must be empty +} diff --git a/examples/android6/startup_other.go b/examples/android6/startup_other.go new file mode 100644 index 00000000..d2382476 --- /dev/null +++ b/examples/android6/startup_other.go @@ -0,0 +1,7 @@ +// +build !android + +package main + +func main() { + myRealMainFunc() +}