diff --git a/examples/subclass/main.go b/examples/subclass/main.go index 66d34933..b400cd39 100644 --- a/examples/subclass/main.go +++ b/examples/subclass/main.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "os" "github.com/mappu/miqt/qt" @@ -48,6 +49,12 @@ func main() { w.Update() // repaints in next event loop tick }) + w.OnKeyPressEvent(func(super func(ev *qt.QKeyEvent), ev *qt.QKeyEvent) { + super(ev) + + w.SetTitle(fmt.Sprintf("Keypress %d", ev.Key())) + }) + w.Show() qt.QApplication_Exec()