diff --git a/.gitignore b/.gitignore index 6d82b81..afe5519 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,4 @@ cmd/handbindings/handbindings cmd/handbindings/bindings_test/direct cmd/handbindings/bindings_test/testapp cmd/genbindings/genbindings - - +examples/helloworld/helloworld diff --git a/examples/helloworld/helloworld.png b/examples/helloworld/helloworld.png new file mode 100644 index 0000000..5402906 Binary files /dev/null and b/examples/helloworld/helloworld.png differ diff --git a/examples/helloworld/main.go b/examples/helloworld/main.go new file mode 100644 index 0000000..3a604ad --- /dev/null +++ b/examples/helloworld/main.go @@ -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!") +}