From 73089d51206a2948ade29f2ff3778ad5b33d7056 Mon Sep 17 00:00:00 2001 From: mappu Date: Fri, 15 Nov 2024 19:55:52 +1300 Subject: [PATCH] examples/subclass: initial commit --- .gitignore | 1 + examples/subclass/main.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 examples/subclass/main.go diff --git a/.gitignore b/.gitignore index 8612113f..2e87edd7 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/examples/subclass/main.go b/examples/subclass/main.go new file mode 100644 index 00000000..79f25200 --- /dev/null +++ b/examples/subclass/main.go @@ -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() +}