mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
examples: add helloworld example
This commit is contained in:
parent
bfbe24e275
commit
754b76d18a
3
.gitignore
vendored
3
.gitignore
vendored
@ -7,5 +7,4 @@ cmd/handbindings/handbindings
|
|||||||
cmd/handbindings/bindings_test/direct
|
cmd/handbindings/bindings_test/direct
|
||||||
cmd/handbindings/bindings_test/testapp
|
cmd/handbindings/bindings_test/testapp
|
||||||
cmd/genbindings/genbindings
|
cmd/genbindings/genbindings
|
||||||
|
examples/helloworld/helloworld
|
||||||
|
|
||||||
|
BIN
examples/helloworld/helloworld.png
Normal file
BIN
examples/helloworld/helloworld.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
30
examples/helloworld/main.go
Normal file
30
examples/helloworld/main.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"miqt/qt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
app := qt.NewQApplication(os.Args)
|
||||||
|
_ = app
|
||||||
|
|
||||||
|
btn := qt.NewQPushButton2("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!")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user