examples/subclass: initial commit

This commit is contained in:
mappu 2024-11-15 19:55:52 +13:00
parent 943ccf7b3a
commit 73089d5120
2 changed files with 38 additions and 0 deletions

1
.gitignore vendored
View File

@ -27,6 +27,7 @@ examples/mdoutliner/mdoutliner6
examples/windowsmanifest/windowsmanifest
examples/uidesigner/uidesigner
examples/trivialwizard6/trivialwizard6
examples/subclass/subclass
examples/libraries/extras-scintillaedit/extras-scintillaedit
examples/libraries/qt-multimedia/qt-multimedia
examples/libraries/qt-network/qt-network

37
examples/subclass/main.go Normal file
View File

@ -0,0 +1,37 @@
package main
import (
"os"
"github.com/mappu/miqt/qt"
)
func main() {
qt.NewQApplication(os.Args)
widget := qt.NewQWidget2()
widget.SetFixedWidth(320)
widget.SetFixedHeight(240)
widget.OnPaintEvent(func(ev *qt.QPaintEvent) {
panic("xyz")
ptr := qt.NewQPainter2(widget.QPaintDevice)
defer ptr.Delete()
br := qt.NewQBrush12(qt.Black, qt.SolidPattern)
defer br.Delete()
ptr.SetBrush(br)
ptr.DrawRect2(80, 60, 160, 120)
ptr.End()
})
widget.Show()
widget.Repaint()
widget.Update()
qt.QApplication_Exec()
}