From c6018d1c07c0b7ddad9ed31bdcb4e1ebf78b58e6 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 23 Nov 2024 18:33:04 +1300 Subject: [PATCH] examples/subclass: also test KeyPressEvent --- examples/subclass/main.go | 7 +++++++ 1 file changed, 7 insertions(+) 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()