mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
examples/subclass: also test KeyPressEvent
This commit is contained in:
parent
f45604ee13
commit
c6018d1c07
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/mappu/miqt/qt"
|
"github.com/mappu/miqt/qt"
|
||||||
@ -48,6 +49,12 @@ func main() {
|
|||||||
w.Update() // repaints in next event loop tick
|
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()
|
w.Show()
|
||||||
|
|
||||||
qt.QApplication_Exec()
|
qt.QApplication_Exec()
|
||||||
|
Loading…
Reference in New Issue
Block a user