mirror of
https://github.com/mappu/miqt.git
synced 2025-01-08 16:38:37 +00:00
goroutine6: run as many workers as GOMAXPROCS
This commit is contained in:
parent
38a75178ca
commit
8777a73081
@ -3,16 +3,19 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
qt "github.com/mappu/miqt/qt6"
|
qt "github.com/mappu/miqt/qt6"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
threadcount := runtime.GOMAXPROCS(0)
|
||||||
|
|
||||||
qt.NewQApplication(os.Args)
|
qt.NewQApplication(os.Args)
|
||||||
|
|
||||||
window := qt.NewQMainWindow2()
|
window := qt.NewQMainWindow2()
|
||||||
window.QWidget.SetFixedSize2(250, 200)
|
window.QWidget.SetFixedSize2(250, 50*(threadcount+1))
|
||||||
window.QWidget.SetWindowTitle("goroutine Example")
|
window.QWidget.SetWindowTitle("goroutine Example")
|
||||||
|
|
||||||
widget := qt.NewQWidget(window.QWidget)
|
widget := qt.NewQWidget(window.QWidget)
|
||||||
@ -20,7 +23,7 @@ func main() {
|
|||||||
widget.SetLayout(layout.QBoxLayout.QLayout)
|
widget.SetLayout(layout.QBoxLayout.QLayout)
|
||||||
window.SetCentralWidget(widget)
|
window.SetCentralWidget(widget)
|
||||||
|
|
||||||
labels := make([]*qt.QLabel, 3)
|
labels := make([]*qt.QLabel, threadcount)
|
||||||
for i := range labels {
|
for i := range labels {
|
||||||
label := qt.NewQLabel(window.QWidget)
|
label := qt.NewQLabel(window.QWidget)
|
||||||
label.SetAlignment(qt.AlignCenter)
|
label.SetAlignment(qt.AlignCenter)
|
||||||
|
Loading…
Reference in New Issue
Block a user