Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support (until external linking will be supported by go build) #149

Open
wants to merge 38 commits into
base: v1
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d594148
Update capi.cpp
neclepsio Mar 4, 2015
35ce016
Update idletimer.cpp
neclepsio Mar 4, 2015
0235b6a
Update README.md
neclepsio Mar 4, 2015
658f1f9
Update README.md
neclepsio Mar 4, 2015
1bc7e1c
Update README.md
neclepsio Mar 4, 2015
4b90968
Update README.md
neclepsio Mar 4, 2015
e299a47
Update capi.cpp
neclepsio Mar 4, 2015
377fcee
Update capi.cpp
neclepsio Mar 4, 2015
271f860
Update idletimer.cpp
neclepsio Mar 4, 2015
0a8c2e7
Detect use of Qt objects after destruction and other safety features
Feb 4, 2016
15fa509
Add engine.AddImportPath and ClearComponentCache
Feb 10, 2016
0fc3d34
Enable static building on Windows
Feb 10, 2016
60887d8
Fixed unsupported variant type: 1024 (QJSValue)
obscuren Jan 23, 2015
07befdf
Changed to non-hardcoded type for QJSValue
obscuren Jan 27, 2015
a5eeb50
Fix panic when passing around nil/null objects
ricochet1k Mar 12, 2016
b29d141
Add more Qt paths list manipulation functions
Mar 16, 2016
424704a
Don't panic in function calls with zero/invalid parameters
Mar 16, 2016
826359a
Porting go-qml to Go 1.6
SjB Apr 5, 2016
a159017
Merge pull request #2 from ricochet1k/safer
neclepsio Apr 5, 2016
724d0ea
Go 1.6 support (partial)
neclepsio Apr 5, 2016
25510fc
Merge branch 'refs/heads/SjB-go1.6-port' into v1
neclepsio Apr 5, 2016
9e7fbdc
Go 1.6 (final)
neclepsio Apr 5, 2016
b752760
Merge pull request #5 from neclepsio/SjB-go1.6-port
neclepsio Apr 5, 2016
3817cca
Merge branch 'v1' of https://github.com/tgerring/qml into tgerring-v1
neclepsio Apr 5, 2016
01021bc
change datatype the foldr from uintptr to C.GoRef
SjB Apr 6, 2016
2628b57
refactor valueFold.
SjB Apr 6, 2016
a4363f7
added reference lookup for signal function
SjB Apr 6, 2016
ea70551
added reference lookup for go TypeSpec type
SjB Apr 6, 2016
0309d2d
fix missing goRef function
SjB Apr 6, 2016
d3b5814
Merge pull request #8 from SjB/go1.6-port
neclepsio Apr 6, 2016
d4c4a72
fix forgotten dereferenced datap pointer.
SjB Jul 1, 2016
1cd7645
Merge pull request #10 from SjB/go1.6-port
neclepsio Jul 2, 2016
1a4a251
Added support for Go 1.12
neclepsio Feb 27, 2019
39c86d2
Add support for Qt 5.11+
neclepsio Feb 27, 2019
6f4b129
Changed import path (1/2)
neclepsio Feb 27, 2019
c923d26
Changed import path (2/2)
neclepsio Feb 27, 2019
dea943b
Update README.md
neclepsio Feb 27, 2019
4d1f36b
Update README.md
neclepsio Feb 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datatype.go
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ func unpackDataValue(dvalue *C.DataValue, engine *Engine) interface{} {
case C.DTGoAddr:
// ObjectByName also does this fold conversion, to have access
// to the cvalue. Perhaps the fold should be returned.
fold := ensureEngine(engine.addr, C.GoRef(uintptr(datap)))
fold := ensureEngine(engine.addr, C.GoRef(uintptr(*(*unsafe.Pointer)(datap))))
return fold.gvalue
case C.DTInvalid:
return nil
38 changes: 38 additions & 0 deletions examples/govalue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Reproducer for go1.6 port problem

SjB's go 1.6 port worked very well for me for pretty much all of my programs, but
I did discover one corner case that causes problems. The TL;DR is that passing a
go type to qml and back to go does not work.

## What I expect:

Basically the old behaviour. After cloning this repo, try this:

```
GODEBUG=cgocheck=0 go run main.go
```

You should see it print, "Successfully called UseGoType()" and display a white rectangle.

## It doesn't quite work so well with the fix

If we use the 1.6 port (I have copied commit 0309d2df1d6572e107b2bd0712da5b517c4a49be here
for your convenience) then it doesn't work quite like it used to:

```
mv vendor_cjb vendor
go run main.go
```

You should see something like:

```
panic: cannot find fold go reference
goroutine 1 [running, locked to thread]:
panic(0x5716e0, 0xc820090070)
/usr/local/go/src/runtime/panic.go:464 +0x3e6
.../vendor/gopkg.in/qml%2ev1.getFoldFromGoRef(0x7ffc3a3bc044, 0x8aec00)
.../vendor/gopkg.in/qml.v1/bridge.go:230 +0x9e
... cut ...
```
38 changes: 38 additions & 0 deletions examples/govalue/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
"fmt"

"gopkg.in/qml.v1"
)

func main() {
err := qml.Run(run)
if err != nil {
panic(err)
}
}

type GoStruct struct {
}

func (gs *GoStruct) ReturnGoType() *GoStruct {
return gs
}
func (gs *GoStruct) UseGoType(v *GoStruct) {
fmt.Println("Successfully called UseGoType()")
}

func run() error {
engine := qml.NewEngine()
context := engine.Context()
context.SetVar("gostruct", &GoStruct{})
component, err := engine.LoadFile("main.qml")
if err != nil {
return err
}
win := component.CreateWindow(nil)
win.Show()
win.Wait()
return nil
}
9 changes: 9 additions & 0 deletions examples/govalue/main.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import QtQuick 2.0
Rectangle {
width:600
height:600
Component.onCompleted: {
var gt = gostruct.returnGoType()
gt.useGoType(gt)
}
}