mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
examples/subclass: initial commit
This commit is contained in:
parent
943ccf7b3a
commit
73089d5120
1
.gitignore
vendored
1
.gitignore
vendored
@ -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
37
examples/subclass/main.go
Normal 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()
|
||||
}
|
Loading…
Reference in New Issue
Block a user