mirror of
https://github.com/mappu/miqt.git
synced 2025-02-23 04:50:24 +00:00
examples: add android6 example
This commit is contained in:
parent
98567bf4ee
commit
a67d7cfe65
29
examples/android6/main.go
Normal file
29
examples/android6/main.go
Normal 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!")
|
||||||
|
}
|
14
examples/android6/startup_android.go
Normal file
14
examples/android6/startup_android.go
Normal 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
|
||||||
|
}
|
7
examples/android6/startup_other.go
Normal file
7
examples/android6/startup_other.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// +build !android
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
myRealMainFunc()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user