examples: add android6 example

This commit is contained in:
mappu 2025-02-15 17:10:34 +13:00
parent 98567bf4ee
commit a67d7cfe65
3 changed files with 50 additions and 0 deletions

29
examples/android6/main.go Normal file
View File

@ -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!")
}

View File

@ -0,0 +1,14 @@
// +build android
package main
import "C" // Required for export support
//export AndroidMain
func AndroidMain() {
myRealMainFunc()
}
func main() {
// Must be empty
}

View File

@ -0,0 +1,7 @@
// +build !android
package main
func main() {
myRealMainFunc()
}