therecipe / qt

Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly
GNU Lesser General Public License v3.0
10.5k stars 748 forks source link

qtmoc&&qtdeploy work fine, but qtmoc&&go run . failed #1221

Open raygenyang opened 3 years ago

raygenyang commented 3 years ago

When I use the example "github.com/therecipe/examples/blob/master/advanced/widgets/tableview/main.go", then run then command "qtmoc && go run .", it fails, but it work fine in "qtmoc && qtdeploy".

looking for qtbox in: D:\go-workspace\goproxy\qtbox\qtbox.exe
final qtbox location: D:\go-workspace\goproxy\qtbox\qtbox.exe
panic: reflect: New(nil)

goroutine 1 [running, locked to thread]:
reflect.New(0x0, 0x0, 0x0, 0x0, 0x0)
    c:/go/src/reflect/value.go:2217 +0xca
github.com/therecipe/qt/interop.Z_wrapperFunction(0xc000304050, 0xc000006030)
    Z:/home/user/work/src/github.com/therecipe/qt/interop/interop.go:165 +0x1211
github.com/therecipe/qt/interop._syncCallIntoLocal.func3()
    Z:/home/user/work/src/github.com/therecipe/qt/interop/interop_api.go:64 +0x43
github.com/therecipe/qt/interop.(*mainThreadHelper).runOnMainThread(0xc000050b90, 0xc000320240)
    Z:/home/user/work/src/github.com/therecipe/qt/interop/interop_api.go:36 +0x2c
github.com/therecipe/qt/interop.(*mainThreadHelper).runOnMainThread-fm(0xc000320240)
    Z:/home/user/work/src/github.com/therecipe/qt/interop/moc.go:95 +0x3b
github.com/therecipe/qt/interop.callbackmainThreadHelper36c981_RunOnMainThread(0x5fcba40, 0x166bc9deeb7b05c0)
    Z:/home/user/work/src/github.com/therecipe/qt/interop/moc.go:106 +0xa0
github.com/therecipe/qt/interop._cgoexpwrap_74f6e0c80e95_callbackmainThreadHelper36c981_RunOnMainThread(0x5fcba40, 0x166bc9deeb7b05c0)
    _cgo_gotypes.go:535 +0x3c
github.com/therecipe/qt/interop._Cfunc_mainThreadHelper36c981_EventDefault(0x5fcba40, 0x854cf30, 0x0)
    _cgo_gotypes.go:214 +0x51
github.com/therecipe/qt/interop.(*mainThreadHelper).EventDefault.func1(0x5fcba40, 0x854cf30, 0x854cf30)
    Z:/home/user/work/src/github.com/therecipe/qt/interop/moc.go:478 +0x96
github.com/therecipe/qt/interop.(*mainThreadHelper).EventDefault(0xc000050b90, 0x2971fa0, 0xc000455fc0, 0x5)
    Z:/home/user/work/src/github.com/therecipe/qt/interop/moc.go:478 +0x7b
github.com/therecipe/qt/interop.callbackmainThreadHelper36c981_Event(0x5fcba40, 0x854cf30, 0x26846e0)
    Z:/home/user/work/src/github.com/therecipe/qt/interop/moc.go:473 +0x123
github.com/therecipe/qt/interop._cgoexpwrap_74f6e0c80e95_callbackmainThreadHelper36c981_Event(0x5fcba40, 0x854cf30, 0x8525dc0)
    _cgo_gotypes.go:639 +0x3c
github.com/therecipe/qt/widgets._Cfunc_QApplication_QApplication_Exec(0x0)
    _cgo_gotypes.go:8922 +0x50
github.com/therecipe/qt/widgets.QApplication_Exec(0x1)
    Z:/home/user/work/src/github.com/therecipe/qt/widgets/widgets.go:9694 +0x29
main.main()
    Z:/media/sf_GOPATH0/src/github.com/therecipe/box/full/full_box.go:25 +0x6f
httpRequest error: ["",1927440,"","ConnectHeaderData","___REMOTE_CALLBACK___"] -> Post "http://127.0.0.1:8000/syncCallIntoLocal": read tcp 127.0.0.1:52874->127.0.0.1:8000: wsarecv: An existing connection was forcibly closed by the remote host.
httpRequest error: ["",1927440,"","ConnectRowCount","___REMOTE_CALLBACK___"] -> Post "http://127.0.0.1:8000/syncCallIntoLocal": dial tcp 127.0.0.1:8000: connectex: No connection could be made because the target machine actively refused it.
httpRequest error: ["",1927440,"","ConnectColumnCount","___REMOTE_CALLBACK___"] -> Post "http://127.0.0.1:8000/syncCallIntoLocal": dial tcp 127.0.0.1:8000: connectex: No connection could be made because the target machine actively refused it.
httpRequest error: ["",1927440,"","ConnectData","___REMOTE_CALLBACK___"] -> Post "http://127.0.0.1:8000/syncCallIntoLocal": dial tcp 127.0.0.1:8000: connectex: No connection could be made because the target machine actively refused it.
httpRequest error: ["",1927440,"","ConnectDestroyed","___REMOTE_CALLBACK___"] -> Post "http://127.0.0.1:8000/syncCallIntoLocal": dial tcp 127.0.0.1:8000: connectex: No connection could be made because the target machine actively refused it.
httpRequest error: ["",139811984,"widgets.QTableView","SetModel",{"___className":"","___pointer":1927440}] -> Post "http://127.0.0.1:8000/syncCallIntoLocal": dial tcp 127.0.0.1:8000: connectex: No connection could be made because the target machine actively refused it.
httpRequest error: ["",139732432,"widgets.QWidget","Layout"] -> Post "http://127.0.0.1:8000/syncCallIntoLocal": dial tcp 127.0.0.1:8000: connectex: No connection could be made because the target machine actively refused it.
panic: interface conversion: interface {} is nil, not *widgets.QLayout

goroutine 1 [running, locked to thread]:
github.com/therecipe/qt/widgets.(*QWidget).Layout(0xc0000633b0, 0x18a1920)
    D:/go-workspace/gopath/pkg/mod/github.com/therecipe/qt@v0.0.0-20200904063919-c0c124a5770d/widgets/widgets.go:59228 +0x194
main.main()
    D:/go-workspace/goproxy/tv/main.go:111 +0x3e6

go version go1.14.3 windows/amd64 qt version 5.13.0