qt6: add example

This commit is contained in:
mappu 2024-10-20 18:38:54 +13:00
parent 97c05b7fc7
commit 1e51c9f314
2 changed files with 30 additions and 0 deletions

1
.gitignore vendored
View File

@ -27,6 +27,7 @@ examples/uidesigner/uidesigner
examples/uidesigner/uidesigner.exe
examples/libraries/extras-scintillaedit/extras-scintillaedit
examples/libraries/qt-qprintsupport/qt-qprintsupport
examples/libraries/qt6/qt6
examples/libraries/restricted-extras-qscintilla/restricted-extras-qscintilla
# android temporary build files

View File

@ -0,0 +1,29 @@
package main
import (
"fmt"
"os"
qt "github.com/mappu/miqt/qt6"
)
func main() {
qt.NewQApplication(os.Args)
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!")
}