Merge pull request #56 from mappu/miqt-container-types

Add QMap<> binding
This commit is contained in:
mappu 2024-11-04 22:21:22 +13:00 committed by GitHub
commit 7c824c28d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
772 changed files with 8902 additions and 8646 deletions

View File

@ -74,10 +74,12 @@ MIQT is a clean-room binding that does not use any code from other Qt bindings.
Most functions are implemented 1:1. [The Qt documentation](https://doc.qt.io/qt-5/classes.html) should be used.
The `QByteArray`, `QString`, `QList<T>`, and `QVector<T>` types are projected as plain Go `[]byte`, `string`, and `[]T`. Therefore, you can't call any of QByteArray/QString/QList/QVector's helper methods, you must use some Go equivalent method instead.
The `QByteArray`, `QString`, `QList<T>`, `QVector<T>`, `QMap<K,V>`, `QHash<K,V>` types are projected as plain Go `[]byte`, `string`, `[]T`, and `map[K]V`. Therefore, you can't call any of the Qt type's methods, you must use some Go equivalent method instead.
- Go strings are internally converted to QString using `QString::fromUtf8`. Therefore, the Go string must be UTF-8 to avoid [mojibake](https://en.wikipedia.org/wiki/Mojibake). If the Go string contains binary data, the conversion would corrupt such bytes into U+FFFD (<28>). On return to Go space, this becomes `\xEF\xBF\xBD`.
- The iteration order of a Qt QMap/QHash will differ from the Go map iteration order. QMap is iterated by key order, but Go maps and QHash iterate in an undefined internal order.
Where Qt returns a C++ object by value (e.g. `QSize`), the binding may have moved it to the heap, and in Go this may be represented as a pointer type. In such cases, a Go finalizer is added to automatically delete the heap object. This means code using MIQT can look basically similar to the Qt C++ equivalent code.
The `connect(sourceObject, sourceSignal, targetObject, targetSlot)` is projected as `targetObject.onSourceSignal(func()...)`.
@ -189,7 +191,7 @@ pacman -S mingw-w64-ucrt-x86_64-qt6-base # For Qt 6
go build -ldflags "-s -w -H windowsgui"
```
- Note: the MSYS2 `qt5-base` package [links against `libicu`](https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-qt5-base/PKGBUILD#L241), whereas the Fsu0413 Qt packages do not. When using MSYS2, your distribution size including `.dll` files will be larger.
- Note: the MSYS2 `qt5-base` package [is built to use `libicu`](https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-qt5-base/PKGBUILD#L241), whereas the Fsu0413 Qt packages are not. [ICU is included by default with Windows 10 1703 and later](https://devblogs.microsoft.com/oldnewthing/20210527-00/?p=105255). If you are targeting older versions of Windows, then when using MSYS2, your distribution size including `.dll` files will be larger.
For static linking:
@ -254,7 +256,7 @@ See FAQ Q3 for advice about docker performance.
*Tested with Raymii Qt 5.15 / Android SDK 31 / Android NDK 22*
Miqt supports compiling for Android. Some extra steps are required to bridge the Java, C++, Go worlds.
MIQT supports compiling for Android. Some extra steps are required to bridge the Java, C++, Go worlds.
![](doc/android-architecture.png)

View File

@ -82,6 +82,8 @@ func AllowHeader(fullpath string) bool {
"qbytearray.h", // QByteArray does not exist in this binding
"qlist.h", // QList does not exist in this binding
"qvector.h", // QVector does not exist in this binding
"qhash.h", // QHash does not exist in this binding
"qmap.h", // QMap does not exist in this binding
"qtcoreexports.h", // Nothing bindable here and has Q_CORE_EXPORT definition issues
"q20algorithm.h", // Qt 6 unstable header
"q20functional.h", // Qt 6 unstable header
@ -216,9 +218,6 @@ func AllowMethod(className string, mm CppMethod) error {
// Any type not permitted by AllowClass is also not permitted by this method.
func AllowType(p CppParameter, isReturnType bool) error {
if p.QMapOf() {
return ErrTooComplex // Example???
}
if p.QPairOf() {
return ErrTooComplex // e.g. QGradientStop
}
@ -238,6 +237,15 @@ func AllowType(p CppParameter, isReturnType bool) error {
return ErrTooComplex
}
}
if kType, vType, ok := p.QMapOf(); ok {
if err := AllowType(kType, isReturnType); err != nil {
return err
}
if err := AllowType(vType, isReturnType); err != nil {
return err
}
}
if !AllowClass(p.ParameterType) {
return ErrTooComplex // This whole class type has been blocked, not only as a parameter/return type
}
@ -294,6 +302,12 @@ func AllowType(p CppParameter, isReturnType bool) error {
if strings.Contains(p.ParameterType, `Iterator::value_type`) {
return ErrTooComplex // e.g. qcbormap
}
if strings.Contains(p.ParameterType, `>::iterator`) ||
strings.Contains(p.ParameterType, `>::const_iterator`) {
// qresultstore.h tries to create a
// NewQtPrivate__ResultIteratorBase2(_mapIterator QMap<int, ResultItem>__const_iterator)
return ErrTooComplex
}
if strings.Contains(p.ParameterType, `::QPrivate`) {
return ErrTooComplex // e.g. QAbstractItemModel::QPrivateSignal
}

View File

@ -15,10 +15,13 @@ func (p CppParameter) RenderTypeCabi() string {
return "struct miqt_string"
} else if _, ok := p.QListOf(); ok {
return "struct miqt_array*"
return "struct miqt_array"
} else if _, ok := p.QSetOf(); ok {
return "struct miqt_array*"
return "struct miqt_array"
} else if _, _, ok := p.QMapOf(); ok {
return "struct miqt_map"
} else if (p.Pointer || p.ByRef) && p.QtClassType() {
return cabiClassName(p.ParameterType) + "*"
@ -155,10 +158,10 @@ func emitParametersCabi(m CppMethod, selfType string) string {
tmp = append(tmp, "struct miqt_string "+p.ParameterName)
} else if t, ok := p.QListOf(); ok {
tmp = append(tmp, "struct miqt_array* /* of "+t.RenderTypeCabi()+" */ "+p.ParameterName)
tmp = append(tmp, "struct miqt_array /* of "+t.RenderTypeCabi()+" */ "+p.ParameterName)
} else if t, ok := p.QSetOf(); ok {
tmp = append(tmp, "struct miqt_array* /* Set of "+t.RenderTypeCabi()+" */ "+p.ParameterName)
tmp = append(tmp, "struct miqt_array /* Set of "+t.RenderTypeCabi()+" */ "+p.ParameterName)
} else if p.QtClassType() {
if p.ByRef || p.Pointer {
@ -218,10 +221,10 @@ func emitCABI2CppForwarding(p CppParameter, indent string) (preamble string, for
} else if listType, ok := p.QListOf(); ok {
preamble += indent + p.GetQtCppType().ParameterType + " " + nameprefix + "_QList;\n"
preamble += indent + nameprefix + "_QList.reserve(" + p.ParameterName + "->len);\n"
preamble += indent + nameprefix + "_QList.reserve(" + p.ParameterName + ".len);\n"
preamble += indent + listType.RenderTypeCabi() + "* " + nameprefix + "_arr = static_cast<" + listType.RenderTypeCabi() + "*>(" + p.ParameterName + "->data);\n"
preamble += indent + "for(size_t i = 0; i < " + p.ParameterName + "->len; ++i) {\n"
preamble += indent + listType.RenderTypeCabi() + "* " + nameprefix + "_arr = static_cast<" + listType.RenderTypeCabi() + "*>(" + p.ParameterName + ".data);\n"
preamble += indent + "for(size_t i = 0; i < " + p.ParameterName + ".len; ++i) {\n"
listType.ParameterName = nameprefix + "_arr[i]"
addPre, addFwd := emitCABI2CppForwarding(listType, indent+"\t")
@ -231,6 +234,32 @@ func emitCABI2CppForwarding(p CppParameter, indent string) (preamble string, for
preamble += indent + "}\n"
return preamble, nameprefix + "_QList"
} else if kType, vType, ok := p.QMapOf(); ok {
preamble += indent + p.GetQtCppType().ParameterType + " " + nameprefix + "_QMap;\n"
// This container may be a QMap or a QHash
// QHash supports .reserve(), but QMap doesn't
if strings.HasPrefix(p.ParameterType, "QHash<") {
preamble += indent + nameprefix + "_QMap.reserve(" + p.ParameterName + ".len);\n"
}
preamble += indent + kType.RenderTypeCabi() + "* " + nameprefix + "_karr = static_cast<" + kType.RenderTypeCabi() + "*>(" + p.ParameterName + ".keys);\n"
preamble += indent + vType.RenderTypeCabi() + "* " + nameprefix + "_varr = static_cast<" + vType.RenderTypeCabi() + "*>(" + p.ParameterName + ".values);\n"
preamble += indent + "for(size_t i = 0; i < " + p.ParameterName + ".len; ++i) {\n"
kType.ParameterName = nameprefix + "_karr[i]"
addPreK, addFwdK := emitCABI2CppForwarding(kType, indent+"\t")
preamble += addPreK
vType.ParameterName = nameprefix + "_varr[i]"
addPreV, addFwdV := emitCABI2CppForwarding(vType, indent+"\t")
preamble += addPreV
preamble += indent + "\t" + nameprefix + "_QMap[" + addFwdK + "] = " + addFwdV + ";\n"
preamble += indent + "}\n"
return preamble, nameprefix + "_QMap"
} else if p.IsFlagType() || p.IntType() || p.IsKnownEnum() {
castSrc := p.ParameterName
castType := p.RenderTypeQtCpp()
@ -362,9 +391,9 @@ func emitAssignCppToCabi(assignExpression string, p CppParameter, rvalue string)
afterCall += emitAssignCppToCabi(indent+"\t"+namePrefix+"_arr[i] = ", t, namePrefix+"_ret[i]")
afterCall += indent + "}\n"
afterCall += indent + "struct miqt_array* " + namePrefix + "_out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));\n"
afterCall += indent + "" + namePrefix + "_out->len = " + namePrefix + "_ret.length();\n"
afterCall += indent + "" + namePrefix + "_out->data = static_cast<void*>(" + namePrefix + "_arr);\n"
afterCall += indent + "struct miqt_array " + namePrefix + "_out;\n"
afterCall += indent + "" + namePrefix + "_out.len = " + namePrefix + "_ret.length();\n"
afterCall += indent + "" + namePrefix + "_out.data = static_cast<void*>(" + namePrefix + "_arr);\n"
afterCall += indent + assignExpression + "" + namePrefix + "_out;\n"
@ -380,9 +409,33 @@ func emitAssignCppToCabi(assignExpression string, p CppParameter, rvalue string)
afterCall += emitAssignCppToCabi(indent+"\t"+namePrefix+"_arr["+namePrefix+"_ctr++] = ", t, namePrefix+"_itr.next()")
afterCall += indent + "}\n"
afterCall += indent + "struct miqt_array* " + namePrefix + "_out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));\n"
afterCall += indent + "" + namePrefix + "_out->len = " + namePrefix + "_ret.size();\n"
afterCall += indent + "" + namePrefix + "_out->data = static_cast<void*>(" + namePrefix + "_arr);\n"
afterCall += indent + "struct miqt_array " + namePrefix + "_out;\n"
afterCall += indent + "" + namePrefix + "_out.len = " + namePrefix + "_ret.size();\n"
afterCall += indent + "" + namePrefix + "_out.data = static_cast<void*>(" + namePrefix + "_arr);\n"
afterCall += indent + assignExpression + "" + namePrefix + "_out;\n"
} else if kType, vType, ok := p.QMapOf(); ok {
// QMap<K,V>
shouldReturn = p.RenderTypeQtCpp() + " " + namePrefix + "_ret = "
afterCall += indent + "// Convert QMap<> from C++ memory to manually-managed C memory\n"
afterCall += indent + "" + kType.RenderTypeCabi() + "* " + namePrefix + "_karr = static_cast<" + kType.RenderTypeCabi() + "*>(malloc(sizeof(" + kType.RenderTypeCabi() + ") * " + namePrefix + "_ret.size()));\n"
afterCall += indent + "" + vType.RenderTypeCabi() + "* " + namePrefix + "_varr = static_cast<" + vType.RenderTypeCabi() + "*>(malloc(sizeof(" + vType.RenderTypeCabi() + ") * " + namePrefix + "_ret.size()));\n"
afterCall += indent + "int " + namePrefix + "_ctr = 0;\n"
afterCall += indent + "for (auto " + namePrefix + "_itr = " + namePrefix + "_ret.keyValueBegin(); " + namePrefix + "_itr != " + namePrefix + "_ret.keyValueEnd(); ++" + namePrefix + "_itr) {\n"
afterCall += emitAssignCppToCabi(indent+"\t"+namePrefix+"_karr["+namePrefix+"_ctr] = ", kType, namePrefix+"_itr->first")
afterCall += emitAssignCppToCabi(indent+"\t"+namePrefix+"_varr["+namePrefix+"_ctr] = ", vType, namePrefix+"_itr->second")
afterCall += indent + "\t" + namePrefix + "_ctr++;\n"
afterCall += indent + "}\n"
afterCall += indent + "struct miqt_map " + namePrefix + "_out;\n"
afterCall += indent + "" + namePrefix + "_out.len = " + namePrefix + "_ret.size();\n"
afterCall += indent + "" + namePrefix + "_out.keys = static_cast<void*>(" + namePrefix + "_karr);\n"
afterCall += indent + "" + namePrefix + "_out.values = static_cast<void*>(" + namePrefix + "_varr);\n"
afterCall += indent + assignExpression + "" + namePrefix + "_out;\n"
@ -428,44 +481,42 @@ func emitAssignCppToCabi(assignExpression string, p CppParameter, rvalue string)
func getReferencedTypes(src *CppParsedHeader) []string {
foundTypes := map[string]struct{}{}
maybeAddType := func(p CppParameter) {
if p.QtClassType() {
foundTypes[p.ParameterType] = struct{}{}
}
if t, ok := p.QListOf(); ok {
foundTypes["QList"] = struct{}{} // FIXME or QVector?
if t.QtClassType() {
foundTypes[t.ParameterType] = struct{}{}
}
}
if kType, vType, ok := p.QMapOf(); ok {
foundTypes["QMap"] = struct{}{} // FIXME or QHash?
if kType.QtClassType() {
foundTypes[kType.ParameterType] = struct{}{}
}
if vType.QtClassType() {
foundTypes[vType.ParameterType] = struct{}{}
}
}
}
for _, c := range src.Classes {
foundTypes[c.ClassName] = struct{}{}
for _, ctor := range c.Ctors {
for _, p := range ctor.Parameters {
if p.QtClassType() {
foundTypes[p.ParameterType] = struct{}{}
}
if t, ok := p.QListOf(); ok {
foundTypes["QList"] = struct{}{} // FIXME or QVector?
if t.QtClassType() {
foundTypes[t.ParameterType] = struct{}{}
}
}
maybeAddType(p)
}
}
for _, m := range c.Methods {
for _, p := range m.Parameters {
if p.QtClassType() {
foundTypes[p.ParameterType] = struct{}{}
}
if t, ok := p.QListOf(); ok {
foundTypes["QList"] = struct{}{} // FIXME or QVector?
if t.QtClassType() {
foundTypes[t.ParameterType] = struct{}{}
}
}
}
if m.ReturnType.QtClassType() {
foundTypes[m.ReturnType.ParameterType] = struct{}{}
}
if t, ok := m.ReturnType.QListOf(); ok {
foundTypes["QList"] = struct{}{} // FIXME or QVector?
if t.QtClassType() {
foundTypes[t.ParameterType] = struct{}{}
}
maybeAddType(p)
}
maybeAddType(m.ReturnType)
}
}
@ -477,10 +528,7 @@ func getReferencedTypes(src *CppParsedHeader) []string {
// Convert to sorted list
foundTypesList := make([]string, 0, len(foundTypes))
for ft := range foundTypes {
if strings.HasPrefix(ft, "QList<") || strings.HasPrefix(ft, "QVector<") { // TODO properly exclude via the QListOf() check above
continue
}
if strings.HasSuffix(ft, "Private") { // qbrush.h finds QGradientPrivate
if !AllowClass(ft) {
continue
}
@ -504,6 +552,15 @@ func cabiClassName(className string) string {
return strings.Replace(className, `::`, `__`, -1)
}
func cabiPreventStructDeclaration(className string) bool {
switch className {
case "QList", "QString", "QSet", "QMap", "QHash":
return true // These types are reprojected
default:
return false
}
}
func emitBindingHeader(src *CppParsedHeader, filename string, packageName string) (string, error) {
ret := strings.Builder{}
@ -537,7 +594,7 @@ extern "C" {
ret.WriteString("#ifdef __cplusplus\n")
for _, ft := range foundTypesList {
if ft == "QList" || ft == "QString" { // These types are reprojected
if cabiPreventStructDeclaration(ft) {
continue
}
@ -559,7 +616,7 @@ extern "C" {
ret.WriteString("#else\n")
for _, ft := range foundTypesList {
if ft == "QList" || ft == "QString" { // These types are reprojected
if cabiPreventStructDeclaration(ft) {
continue
}
ret.WriteString(`typedef struct ` + cabiClassName(ft) + " " + cabiClassName(ft) + ";\n")

View File

@ -39,6 +39,10 @@ func (p CppParameter) RenderTypeGo(gfs *goFileState) string {
return "map[" + t.RenderTypeGo(gfs) + "]struct{}"
}
if t1, t2, ok := p.QMapOf(); ok {
return "map[" + t1.RenderTypeGo(gfs) + "]" + t2.RenderTypeGo(gfs)
}
if p.ParameterType == "void" && p.Pointer {
return "unsafe.Pointer"
}
@ -154,11 +158,15 @@ func (p CppParameter) parameterTypeCgo() string {
}
if _, ok := p.QListOf(); ok {
return "*C.struct_miqt_array"
return "C.struct_miqt_array"
}
if _, ok := p.QSetOf(); ok {
return "*C.struct_miqt_array"
return "C.struct_miqt_array"
}
if _, _, ok := p.QMapOf(); ok {
return "C.struct_miqt_map"
}
tmp := strings.Replace(p.RenderTypeCabi(), `*`, "", -1)
@ -182,6 +190,15 @@ func (p CppParameter) parameterTypeCgo() string {
}
}
func (p CppParameter) mallocSizeCgoExpression() string {
if p.ParameterType == "QString" || p.ParameterType == "QByteArray" {
return "int(unsafe.Sizeof(C.struct_miqt_string{}))"
}
// Default (sizeof pointer)
return "8"
}
func (gfs *goFileState) emitParametersGo(params []CppParameter) string {
tmp := make([]string, 0, len(params))
@ -289,18 +306,9 @@ func (gfs *goFileState) emitParameterGo2CABIForwarding(p CppParameter) (preamble
// Go: convert T[] -> t* and len
// CABI: create a real QList<>
gfs.imports["runtime"] = struct{}{}
gfs.imports["unsafe"] = struct{}{}
var mallocSize string
if listType.ParameterType == "QString" || listType.ParameterType == "QByteArray" {
preamble += "// For the C ABI, malloc a C array of structs\n"
mallocSize = "int(unsafe.Sizeof(C.struct_miqt_string{}))"
} else {
preamble += "// For the C ABI, malloc a C array of raw pointers\n"
mallocSize = "8"
}
mallocSize := listType.mallocSizeCgoExpression()
preamble += nameprefix + "_CArray := (*[0xffff]" + listType.parameterTypeCgo() + ")(C.malloc(C.size_t(" + mallocSize + " * len(" + p.ParameterName + "))))\n"
preamble += "defer C.free(unsafe.Pointer(" + nameprefix + "_CArray))\n"
@ -313,14 +321,46 @@ func (gfs *goFileState) emitParameterGo2CABIForwarding(p CppParameter) (preamble
preamble += nameprefix + "_CArray[i] = " + innerRvalue + "\n"
preamble += "}\n"
preamble += p.ParameterName + "_ma := &C.struct_miqt_array{len: C.size_t(len(" + p.ParameterName + ")), data: unsafe.Pointer(" + nameprefix + "_CArray)}\n"
preamble += "defer runtime.KeepAlive(unsafe.Pointer(" + nameprefix + "_ma))\n"
preamble += p.ParameterName + "_ma := C.struct_miqt_array{len: C.size_t(len(" + p.ParameterName + ")), data: unsafe.Pointer(" + nameprefix + "_CArray)}\n"
rvalue = p.ParameterName + "_ma"
} else if _, ok := p.QSetOf(); ok {
panic("QSet<> arguments are not yet implemented") // n.b. doesn't seem to exist in QtCore/QtGui/QtWidgets at all
} else if kType, vType, ok := p.QMapOf(); ok {
// QMap<T>
gfs.imports["unsafe"] = struct{}{}
preamble += nameprefix + "_Keys_CArray := (*[0xffff]" + kType.parameterTypeCgo() + ")(C.malloc(C.size_t(" + kType.mallocSizeCgoExpression() + " * len(" + p.ParameterName + "))))\n"
preamble += "defer C.free(unsafe.Pointer(" + nameprefix + "_Keys_CArray))\n"
preamble += nameprefix + "_Values_CArray := (*[0xffff]" + vType.parameterTypeCgo() + ")(C.malloc(C.size_t(" + vType.mallocSizeCgoExpression() + " * len(" + p.ParameterName + "))))\n"
preamble += "defer C.free(unsafe.Pointer(" + nameprefix + "_Values_CArray))\n"
preamble += nameprefix + "_ctr := 0\n"
preamble += "for " + nameprefix + "_k, " + nameprefix + "_v := range " + p.ParameterName + "{\n"
kType.ParameterName = nameprefix + "_k"
addPreamble, innerRvalue := gfs.emitParameterGo2CABIForwarding(kType)
preamble += addPreamble
preamble += nameprefix + "_Keys_CArray[" + nameprefix + "_ctr] = " + innerRvalue + "\n"
vType.ParameterName = nameprefix + "_v"
addPreamble, innerRvalue = gfs.emitParameterGo2CABIForwarding(vType)
preamble += addPreamble
preamble += nameprefix + "_Values_CArray[" + nameprefix + "_ctr] = " + innerRvalue + "\n"
preamble += nameprefix + "_ctr++\n"
preamble += "}\n"
preamble += p.ParameterName + "_mm := C.struct_miqt_map{\nlen: C.size_t(len(" + p.ParameterName + ")),\nkeys: unsafe.Pointer(" + nameprefix + "_Keys_CArray),\nvalues: unsafe.Pointer(" + nameprefix + "_Values_CArray),\n}\n"
rvalue = p.ParameterName + "_mm"
} else if p.Pointer && p.ParameterType == "char" {
// Single char* argument
gfs.imports["unsafe"] = struct{}{}
@ -412,7 +452,7 @@ func (gfs *goFileState) emitCabiToGo(assignExpr string, rt CppParameter, rvalue
} else if t, ok := rt.QListOf(); ok {
gfs.imports["unsafe"] = struct{}{}
shouldReturn = "var " + namePrefix + "_ma *C.struct_miqt_array = "
shouldReturn = "var " + namePrefix + "_ma C.struct_miqt_array = "
afterword += namePrefix + "_ret := make([]" + t.RenderTypeGo(gfs) + ", int(" + namePrefix + "_ma.len))\n"
afterword += namePrefix + "_outCast := (*[0xffff]" + t.parameterTypeCgo() + ")(unsafe.Pointer(" + namePrefix + "_ma.data)) // hey ya\n"
@ -421,7 +461,7 @@ func (gfs *goFileState) emitCabiToGo(assignExpr string, rt CppParameter, rvalue
afterword += gfs.emitCabiToGo(namePrefix+"_ret[i] = ", t, namePrefix+"_outCast[i]")
afterword += "}\n"
afterword += "C.free(unsafe.Pointer(" + namePrefix + "_ma))\n"
afterword += assignExpr + " " + namePrefix + "_ret\n"
return shouldReturn + " " + rvalue + "\n" + afterword
@ -429,7 +469,7 @@ func (gfs *goFileState) emitCabiToGo(assignExpr string, rt CppParameter, rvalue
gfs.imports["unsafe"] = struct{}{}
shouldReturn = "var " + namePrefix + "_ma *C.struct_miqt_array = "
shouldReturn = "var " + namePrefix + "_ma C.struct_miqt_array = "
afterword += namePrefix + "_ret := make(map[" + t.RenderTypeGo(gfs) + "]struct{}, int(" + namePrefix + "_ma.len))\n"
afterword += namePrefix + "_outCast := (*[0xffff]" + t.parameterTypeCgo() + ")(unsafe.Pointer(" + namePrefix + "_ma.data)) // hey ya\n"
@ -439,7 +479,24 @@ func (gfs *goFileState) emitCabiToGo(assignExpr string, rt CppParameter, rvalue
afterword += namePrefix + "_ret[" + namePrefix + "_element] = struct{}{}\n"
afterword += "}\n"
afterword += "C.free(unsafe.Pointer(" + namePrefix + "_ma))\n"
afterword += assignExpr + " " + namePrefix + "_ret\n"
return shouldReturn + " " + rvalue + "\n" + afterword
} else if kType, vType, ok := rt.QMapOf(); ok {
gfs.imports["unsafe"] = struct{}{}
shouldReturn = "var " + namePrefix + "_mm C.struct_miqt_map = "
afterword += namePrefix + "_ret := make(map[" + kType.RenderTypeGo(gfs) + "]" + vType.RenderTypeGo(gfs) + ", int(" + namePrefix + "_mm.len))\n"
afterword += namePrefix + "_Keys := (*[0xffff]" + kType.parameterTypeCgo() + ")(unsafe.Pointer(" + namePrefix + "_mm.keys))\n"
afterword += namePrefix + "_Values := (*[0xffff]" + vType.parameterTypeCgo() + ")(unsafe.Pointer(" + namePrefix + "_mm.values))\n"
afterword += "for i := 0; i < int(" + namePrefix + "_mm.len); i++ {\n"
afterword += gfs.emitCabiToGo(namePrefix+"_entry_Key := ", kType, namePrefix+"_Keys[i]") + "\n"
afterword += gfs.emitCabiToGo(namePrefix+"_entry_Value := ", vType, namePrefix+"_Values[i]") + "\n"
afterword += namePrefix + "_ret[" + namePrefix + "_entry_Key] = " + namePrefix + "_entry_Value\n"
afterword += "}\n"
afterword += assignExpr + " " + namePrefix + "_ret\n"
return shouldReturn + " " + rvalue + "\n" + afterword

View File

@ -105,6 +105,9 @@ func (p CppParameter) IsFlagType() bool {
func (p CppParameter) QtClassType() bool {
// QtClassType returns false for our customized container types (QList,
// QMap, QSet, etc)
// Maybe if it's an inner class
if _, ok := KnownClassnames[p.ParameterType]; ok {
return true
@ -142,9 +145,36 @@ func (p CppParameter) QListOf() (CppParameter, bool) {
return CppParameter{}, false
}
func (p CppParameter) QMapOf() bool {
return strings.HasPrefix(p.ParameterType, `QMap<`) ||
strings.HasPrefix(p.ParameterType, `QHash<`) // TODO support this
func (p CppParameter) QMapOf() (CppParameter, CppParameter, bool) {
// n.b. Need to block QMap<k,v>::const_terator
if strings.HasPrefix(p.ParameterType, `QMap<`) && strings.HasSuffix(p.ParameterType, `>`) {
interior := tokenizeMultipleParameters(p.ParameterType[5 : len(p.ParameterType)-1])
if len(interior) != 2 {
panic("QMap<> has unexpected number of template arguments")
}
first := parseSingleTypeString(interior[0])
first.ParameterName = p.ParameterName + "_mapkey"
second := parseSingleTypeString(interior[1])
second.ParameterName = p.ParameterName + "_mapval"
return first, second, true
}
if strings.HasPrefix(p.ParameterType, `QHash<`) && strings.HasSuffix(p.ParameterType, `>`) {
interior := tokenizeMultipleParameters(p.ParameterType[6 : len(p.ParameterType)-1])
if len(interior) != 2 {
panic("QHash<> has unexpected number of template arguments")
}
first := parseSingleTypeString(interior[0])
first.ParameterName = p.ParameterName + "_hashkey"
second := parseSingleTypeString(interior[1])
second.ParameterName = p.ParameterName + "_hashval"
return first, second, true
}
return CppParameter{}, CppParameter{}, false
}
func (p CppParameter) QPairOf() bool {

View File

@ -3,6 +3,7 @@ package main
import (
"os"
"reflect"
"strings"
"testing"
"github.com/mappu/miqt/qt"
@ -91,9 +92,9 @@ func testMarshalling(t *testing.T) {
t.Errorf("QList<Q*>: expected %#v, got %#v", expect, got)
}
}
})
// QByteArray
t.Run("QByteArray", func(t *testing.T) {
input := "foo bar baz"
@ -103,8 +104,36 @@ func testMarshalling(t *testing.T) {
if input != got {
t.Fatalf("QByteArray: expected %q, got %q", input, got)
}
})
// QMap
t.Run("QMap", func(t *testing.T) {
input := make(map[string]qt.QVariant)
input["foo"] = *qt.NewQVariant14("FOO")
input["bar"] = *qt.NewQVariant14("BAR")
input["baz"] = *qt.NewQVariant14("BAZ")
qtobj := qt.QJsonObject_FromVariantMap(input)
got := qtobj.ToVariantMap()
if len(got) != len(input) {
t.Fatalf("QMap: expected len %d, got len %d", len(input), len(got))
}
for src_key, _ := range input {
qvalue, ok := got[src_key]
if !ok {
t.Fatalf("QMap: missing entry %q", src_key)
}
gotValue := qvalue.ToString()
expectValue := strings.ToUpper(src_key)
if gotValue != expectValue {
t.Fatalf("QMap: single value expected %q, got %q", expectValue, gotValue)
}
}
})
}
func TestMarshalling(t *testing.T) {

View File

@ -18,6 +18,12 @@ struct miqt_array {
void* data;
};
struct miqt_map {
size_t len;
void* keys;
void* values;
};
struct miqt_string* miqt_strdup(const char* src, size_t len);
typedef const char const_char;

View File

@ -41,18 +41,18 @@ QsciLexer* QsciAbstractAPIs_Lexer(const QsciAbstractAPIs* self) {
return self->lexer();
}
void QsciAbstractAPIs_UpdateAutoCompletionList(QsciAbstractAPIs* self, struct miqt_array* /* of struct miqt_string */ context, struct miqt_array* /* of struct miqt_string */ list) {
void QsciAbstractAPIs_UpdateAutoCompletionList(QsciAbstractAPIs* self, struct miqt_array /* of struct miqt_string */ context, struct miqt_array /* of struct miqt_string */ list) {
QStringList context_QList;
context_QList.reserve(context->len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context->data);
for(size_t i = 0; i < context->len; ++i) {
context_QList.reserve(context.len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context.data);
for(size_t i = 0; i < context.len; ++i) {
QString context_arr_i_QString = QString::fromUtf8(context_arr[i].data, context_arr[i].len);
context_QList.push_back(context_arr_i_QString);
}
QStringList list_QList;
list_QList.reserve(list->len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list->data);
for(size_t i = 0; i < list->len; ++i) {
list_QList.reserve(list.len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list.data);
for(size_t i = 0; i < list.len; ++i) {
QString list_arr_i_QString = QString::fromUtf8(list_arr[i].data, list_arr[i].len);
list_QList.push_back(list_arr_i_QString);
}
@ -64,18 +64,18 @@ void QsciAbstractAPIs_AutoCompletionSelected(QsciAbstractAPIs* self, struct miqt
self->autoCompletionSelected(selection_QString);
}
struct miqt_array* QsciAbstractAPIs_CallTips(QsciAbstractAPIs* self, struct miqt_array* /* of struct miqt_string */ context, int commas, int style, struct miqt_array* /* of int */ shifts) {
struct miqt_array QsciAbstractAPIs_CallTips(QsciAbstractAPIs* self, struct miqt_array /* of struct miqt_string */ context, int commas, int style, struct miqt_array /* of int */ shifts) {
QStringList context_QList;
context_QList.reserve(context->len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context->data);
for(size_t i = 0; i < context->len; ++i) {
context_QList.reserve(context.len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context.data);
for(size_t i = 0; i < context.len; ++i) {
QString context_arr_i_QString = QString::fromUtf8(context_arr[i].data, context_arr[i].len);
context_QList.push_back(context_arr_i_QString);
}
QList<int> shifts_QList;
shifts_QList.reserve(shifts->len);
int* shifts_arr = static_cast<int*>(shifts->data);
for(size_t i = 0; i < shifts->len; ++i) {
shifts_QList.reserve(shifts.len);
int* shifts_arr = static_cast<int*>(shifts.data);
for(size_t i = 0; i < shifts.len; ++i) {
shifts_QList.push_back(static_cast<int>(shifts_arr[i]));
}
QStringList _ret = self->callTips(context_QList, static_cast<int>(commas), static_cast<QsciScintilla::CallTipsStyle>(style), shifts_QList);
@ -91,9 +91,9 @@ struct miqt_array* QsciAbstractAPIs_CallTips(QsciAbstractAPIs* self, struct miqt
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -77,7 +77,6 @@ func (this *QsciAbstractAPIs) Lexer() *QsciLexer {
}
func (this *QsciAbstractAPIs) UpdateAutoCompletionList(context []string, list []string) {
// For the C ABI, malloc a C array of structs
context_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(context))))
defer C.free(unsafe.Pointer(context_CArray))
for i := range context {
@ -87,9 +86,7 @@ func (this *QsciAbstractAPIs) UpdateAutoCompletionList(context []string, list []
defer C.free(unsafe.Pointer(context_i_ms.data))
context_CArray[i] = context_i_ms
}
context_ma := &C.struct_miqt_array{len: C.size_t(len(context)), data: unsafe.Pointer(context_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(context_ma))
// For the C ABI, malloc a C array of structs
context_ma := C.struct_miqt_array{len: C.size_t(len(context)), data: unsafe.Pointer(context_CArray)}
list_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(list))))
defer C.free(unsafe.Pointer(list_CArray))
for i := range list {
@ -99,8 +96,7 @@ func (this *QsciAbstractAPIs) UpdateAutoCompletionList(context []string, list []
defer C.free(unsafe.Pointer(list_i_ms.data))
list_CArray[i] = list_i_ms
}
list_ma := &C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(list_ma))
list_ma := C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
C.QsciAbstractAPIs_UpdateAutoCompletionList(this.h, context_ma, list_ma)
}
@ -113,7 +109,6 @@ func (this *QsciAbstractAPIs) AutoCompletionSelected(selection string) {
}
func (this *QsciAbstractAPIs) CallTips(context []string, commas int, style QsciScintilla__CallTipsStyle, shifts []int) []string {
// For the C ABI, malloc a C array of structs
context_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(context))))
defer C.free(unsafe.Pointer(context_CArray))
for i := range context {
@ -123,17 +118,14 @@ func (this *QsciAbstractAPIs) CallTips(context []string, commas int, style QsciS
defer C.free(unsafe.Pointer(context_i_ms.data))
context_CArray[i] = context_i_ms
}
context_ma := &C.struct_miqt_array{len: C.size_t(len(context)), data: unsafe.Pointer(context_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(context_ma))
// For the C ABI, malloc a C array of raw pointers
context_ma := C.struct_miqt_array{len: C.size_t(len(context)), data: unsafe.Pointer(context_CArray)}
shifts_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(shifts))))
defer C.free(unsafe.Pointer(shifts_CArray))
for i := range shifts {
shifts_CArray[i] = (C.int)(shifts[i])
}
shifts_ma := &C.struct_miqt_array{len: C.size_t(len(shifts)), data: unsafe.Pointer(shifts_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(shifts_ma))
var _ma *C.struct_miqt_array = C.QsciAbstractAPIs_CallTips(this.h, context_ma, (C.int)(commas), (C.int)(style), shifts_ma)
shifts_ma := C.struct_miqt_array{len: C.size_t(len(shifts)), data: unsafe.Pointer(shifts_CArray)}
var _ma C.struct_miqt_array = C.QsciAbstractAPIs_CallTips(this.h, context_ma, (C.int)(commas), (C.int)(style), shifts_ma)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -142,7 +134,6 @@ func (this *QsciAbstractAPIs) CallTips(context []string, commas int, style QsciS
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -28,9 +28,9 @@ void* QsciAbstractAPIs_Metacast(QsciAbstractAPIs* self, const char* param1);
struct miqt_string QsciAbstractAPIs_Tr(const char* s);
struct miqt_string QsciAbstractAPIs_TrUtf8(const char* s);
QsciLexer* QsciAbstractAPIs_Lexer(const QsciAbstractAPIs* self);
void QsciAbstractAPIs_UpdateAutoCompletionList(QsciAbstractAPIs* self, struct miqt_array* /* of struct miqt_string */ context, struct miqt_array* /* of struct miqt_string */ list);
void QsciAbstractAPIs_UpdateAutoCompletionList(QsciAbstractAPIs* self, struct miqt_array /* of struct miqt_string */ context, struct miqt_array /* of struct miqt_string */ list);
void QsciAbstractAPIs_AutoCompletionSelected(QsciAbstractAPIs* self, struct miqt_string selection);
struct miqt_array* QsciAbstractAPIs_CallTips(QsciAbstractAPIs* self, struct miqt_array* /* of struct miqt_string */ context, int commas, int style, struct miqt_array* /* of int */ shifts);
struct miqt_array QsciAbstractAPIs_CallTips(QsciAbstractAPIs* self, struct miqt_array /* of struct miqt_string */ context, int commas, int style, struct miqt_array /* of int */ shifts);
struct miqt_string QsciAbstractAPIs_Tr2(const char* s, const char* c);
struct miqt_string QsciAbstractAPIs_Tr3(const char* s, const char* c, int n);
struct miqt_string QsciAbstractAPIs_TrUtf82(const char* s, const char* c);

View File

@ -92,18 +92,18 @@ bool QsciAPIs_SavePrepared(const QsciAPIs* self) {
return self->savePrepared();
}
void QsciAPIs_UpdateAutoCompletionList(QsciAPIs* self, struct miqt_array* /* of struct miqt_string */ context, struct miqt_array* /* of struct miqt_string */ list) {
void QsciAPIs_UpdateAutoCompletionList(QsciAPIs* self, struct miqt_array /* of struct miqt_string */ context, struct miqt_array /* of struct miqt_string */ list) {
QStringList context_QList;
context_QList.reserve(context->len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context->data);
for(size_t i = 0; i < context->len; ++i) {
context_QList.reserve(context.len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context.data);
for(size_t i = 0; i < context.len; ++i) {
QString context_arr_i_QString = QString::fromUtf8(context_arr[i].data, context_arr[i].len);
context_QList.push_back(context_arr_i_QString);
}
QStringList list_QList;
list_QList.reserve(list->len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list->data);
for(size_t i = 0; i < list->len; ++i) {
list_QList.reserve(list.len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list.data);
for(size_t i = 0; i < list.len; ++i) {
QString list_arr_i_QString = QString::fromUtf8(list_arr[i].data, list_arr[i].len);
list_QList.push_back(list_arr_i_QString);
}
@ -115,18 +115,18 @@ void QsciAPIs_AutoCompletionSelected(QsciAPIs* self, struct miqt_string sel) {
self->autoCompletionSelected(sel_QString);
}
struct miqt_array* QsciAPIs_CallTips(QsciAPIs* self, struct miqt_array* /* of struct miqt_string */ context, int commas, int style, struct miqt_array* /* of int */ shifts) {
struct miqt_array QsciAPIs_CallTips(QsciAPIs* self, struct miqt_array /* of struct miqt_string */ context, int commas, int style, struct miqt_array /* of int */ shifts) {
QStringList context_QList;
context_QList.reserve(context->len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context->data);
for(size_t i = 0; i < context->len; ++i) {
context_QList.reserve(context.len);
struct miqt_string* context_arr = static_cast<struct miqt_string*>(context.data);
for(size_t i = 0; i < context.len; ++i) {
QString context_arr_i_QString = QString::fromUtf8(context_arr[i].data, context_arr[i].len);
context_QList.push_back(context_arr_i_QString);
}
QList<int> shifts_QList;
shifts_QList.reserve(shifts->len);
int* shifts_arr = static_cast<int*>(shifts->data);
for(size_t i = 0; i < shifts->len; ++i) {
shifts_QList.reserve(shifts.len);
int* shifts_arr = static_cast<int*>(shifts.data);
for(size_t i = 0; i < shifts.len; ++i) {
shifts_QList.push_back(static_cast<int>(shifts_arr[i]));
}
QStringList _ret = self->callTips(context_QList, static_cast<int>(commas), static_cast<QsciScintilla::CallTipsStyle>(style), shifts_QList);
@ -142,9 +142,9 @@ struct miqt_array* QsciAPIs_CallTips(QsciAPIs* self, struct miqt_array* /* of st
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -152,7 +152,7 @@ bool QsciAPIs_Event(QsciAPIs* self, QEvent* e) {
return self->event(e);
}
struct miqt_array* QsciAPIs_InstalledAPIFiles(const QsciAPIs* self) {
struct miqt_array QsciAPIs_InstalledAPIFiles(const QsciAPIs* self) {
QStringList _ret = self->installedAPIFiles();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -166,9 +166,9 @@ struct miqt_array* QsciAPIs_InstalledAPIFiles(const QsciAPIs* self) {
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -135,7 +135,6 @@ func (this *QsciAPIs) SavePrepared() bool {
}
func (this *QsciAPIs) UpdateAutoCompletionList(context []string, list []string) {
// For the C ABI, malloc a C array of structs
context_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(context))))
defer C.free(unsafe.Pointer(context_CArray))
for i := range context {
@ -145,9 +144,7 @@ func (this *QsciAPIs) UpdateAutoCompletionList(context []string, list []string)
defer C.free(unsafe.Pointer(context_i_ms.data))
context_CArray[i] = context_i_ms
}
context_ma := &C.struct_miqt_array{len: C.size_t(len(context)), data: unsafe.Pointer(context_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(context_ma))
// For the C ABI, malloc a C array of structs
context_ma := C.struct_miqt_array{len: C.size_t(len(context)), data: unsafe.Pointer(context_CArray)}
list_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(list))))
defer C.free(unsafe.Pointer(list_CArray))
for i := range list {
@ -157,8 +154,7 @@ func (this *QsciAPIs) UpdateAutoCompletionList(context []string, list []string)
defer C.free(unsafe.Pointer(list_i_ms.data))
list_CArray[i] = list_i_ms
}
list_ma := &C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(list_ma))
list_ma := C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
C.QsciAPIs_UpdateAutoCompletionList(this.h, context_ma, list_ma)
}
@ -171,7 +167,6 @@ func (this *QsciAPIs) AutoCompletionSelected(sel string) {
}
func (this *QsciAPIs) CallTips(context []string, commas int, style QsciScintilla__CallTipsStyle, shifts []int) []string {
// For the C ABI, malloc a C array of structs
context_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(context))))
defer C.free(unsafe.Pointer(context_CArray))
for i := range context {
@ -181,17 +176,14 @@ func (this *QsciAPIs) CallTips(context []string, commas int, style QsciScintilla
defer C.free(unsafe.Pointer(context_i_ms.data))
context_CArray[i] = context_i_ms
}
context_ma := &C.struct_miqt_array{len: C.size_t(len(context)), data: unsafe.Pointer(context_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(context_ma))
// For the C ABI, malloc a C array of raw pointers
context_ma := C.struct_miqt_array{len: C.size_t(len(context)), data: unsafe.Pointer(context_CArray)}
shifts_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(shifts))))
defer C.free(unsafe.Pointer(shifts_CArray))
for i := range shifts {
shifts_CArray[i] = (C.int)(shifts[i])
}
shifts_ma := &C.struct_miqt_array{len: C.size_t(len(shifts)), data: unsafe.Pointer(shifts_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(shifts_ma))
var _ma *C.struct_miqt_array = C.QsciAPIs_CallTips(this.h, context_ma, (C.int)(commas), (C.int)(style), shifts_ma)
shifts_ma := C.struct_miqt_array{len: C.size_t(len(shifts)), data: unsafe.Pointer(shifts_CArray)}
var _ma C.struct_miqt_array = C.QsciAPIs_CallTips(this.h, context_ma, (C.int)(commas), (C.int)(style), shifts_ma)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -200,7 +192,6 @@ func (this *QsciAPIs) CallTips(context []string, commas int, style QsciScintilla
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -209,7 +200,7 @@ func (this *QsciAPIs) Event(e *qt.QEvent) bool {
}
func (this *QsciAPIs) InstalledAPIFiles() []string {
var _ma *C.struct_miqt_array = C.QsciAPIs_InstalledAPIFiles(this.h)
var _ma C.struct_miqt_array = C.QsciAPIs_InstalledAPIFiles(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -218,7 +209,6 @@ func (this *QsciAPIs) InstalledAPIFiles() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -40,11 +40,11 @@ struct miqt_string QsciAPIs_DefaultPreparedName(const QsciAPIs* self);
bool QsciAPIs_IsPrepared(const QsciAPIs* self);
bool QsciAPIs_LoadPrepared(QsciAPIs* self);
bool QsciAPIs_SavePrepared(const QsciAPIs* self);
void QsciAPIs_UpdateAutoCompletionList(QsciAPIs* self, struct miqt_array* /* of struct miqt_string */ context, struct miqt_array* /* of struct miqt_string */ list);
void QsciAPIs_UpdateAutoCompletionList(QsciAPIs* self, struct miqt_array /* of struct miqt_string */ context, struct miqt_array /* of struct miqt_string */ list);
void QsciAPIs_AutoCompletionSelected(QsciAPIs* self, struct miqt_string sel);
struct miqt_array* QsciAPIs_CallTips(QsciAPIs* self, struct miqt_array* /* of struct miqt_string */ context, int commas, int style, struct miqt_array* /* of int */ shifts);
struct miqt_array QsciAPIs_CallTips(QsciAPIs* self, struct miqt_array /* of struct miqt_string */ context, int commas, int style, struct miqt_array /* of int */ shifts);
bool QsciAPIs_Event(QsciAPIs* self, QEvent* e);
struct miqt_array* QsciAPIs_InstalledAPIFiles(const QsciAPIs* self);
struct miqt_array QsciAPIs_InstalledAPIFiles(const QsciAPIs* self);
void QsciAPIs_ApiPreparationCancelled(QsciAPIs* self);
void QsciAPIs_connect_ApiPreparationCancelled(QsciAPIs* self, intptr_t slot);
void QsciAPIs_ApiPreparationStarted(QsciAPIs* self);

View File

@ -12,16 +12,16 @@ bool QsciCommandSet_WriteSettings(QsciCommandSet* self, QSettings* qs) {
return self->writeSettings(*qs);
}
struct miqt_array* QsciCommandSet_Commands(QsciCommandSet* self) {
struct miqt_array QsciCommandSet_Commands(QsciCommandSet* self) {
QList<QsciCommand *>& _ret = self->commands();
// Convert QList<> from C++ memory to manually-managed C memory
QsciCommand** _arr = static_cast<QsciCommand**>(malloc(sizeof(QsciCommand*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -51,13 +51,12 @@ func (this *QsciCommandSet) WriteSettings(qs *qt.QSettings) bool {
}
func (this *QsciCommandSet) Commands() []*QsciCommand {
var _ma *C.struct_miqt_array = C.QsciCommandSet_Commands(this.h)
var _ma C.struct_miqt_array = C.QsciCommandSet_Commands(this.h)
_ret := make([]*QsciCommand, int(_ma.len))
_outCast := (*[0xffff]*C.QsciCommand)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQsciCommand(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -25,7 +25,7 @@ typedef struct QsciCommandSet QsciCommandSet;
bool QsciCommandSet_ReadSettings(QsciCommandSet* self, QSettings* qs);
bool QsciCommandSet_WriteSettings(QsciCommandSet* self, QSettings* qs);
struct miqt_array* QsciCommandSet_Commands(QsciCommandSet* self);
struct miqt_array QsciCommandSet_Commands(QsciCommandSet* self);
void QsciCommandSet_ClearKeys(QsciCommandSet* self);
void QsciCommandSet_ClearAlternateKeys(QsciCommandSet* self);
QsciCommand* QsciCommandSet_BoundTo(const QsciCommandSet* self, int key);

View File

@ -60,7 +60,7 @@ const char* QsciLexer_AutoCompletionFillups(const QsciLexer* self) {
return (const char*) self->autoCompletionFillups();
}
struct miqt_array* QsciLexer_AutoCompletionWordSeparators(const QsciLexer* self) {
struct miqt_array QsciLexer_AutoCompletionWordSeparators(const QsciLexer* self) {
QStringList _ret = self->autoCompletionWordSeparators();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -74,9 +74,9 @@ struct miqt_array* QsciLexer_AutoCompletionWordSeparators(const QsciLexer* self)
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -97,7 +97,7 @@ func (this *QsciLexer) AutoCompletionFillups() string {
}
func (this *QsciLexer) AutoCompletionWordSeparators() []string {
var _ma *C.struct_miqt_array = C.QsciLexer_AutoCompletionWordSeparators(this.h)
var _ma C.struct_miqt_array = C.QsciLexer_AutoCompletionWordSeparators(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -106,7 +106,6 @@ func (this *QsciLexer) AutoCompletionWordSeparators() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -40,7 +40,7 @@ const char* QsciLexer_Lexer(const QsciLexer* self);
int QsciLexer_LexerId(const QsciLexer* self);
QsciAbstractAPIs* QsciLexer_Apis(const QsciLexer* self);
const char* QsciLexer_AutoCompletionFillups(const QsciLexer* self);
struct miqt_array* QsciLexer_AutoCompletionWordSeparators(const QsciLexer* self);
struct miqt_array QsciLexer_AutoCompletionWordSeparators(const QsciLexer* self);
int QsciLexer_AutoIndentStyle(QsciLexer* self);
const char* QsciLexer_BlockEnd(const QsciLexer* self);
int QsciLexer_BlockLookback(const QsciLexer* self);

View File

@ -56,7 +56,7 @@ const char* QsciLexerCoffeeScript_Lexer(const QsciLexerCoffeeScript* self) {
return (const char*) self->lexer();
}
struct miqt_array* QsciLexerCoffeeScript_AutoCompletionWordSeparators(const QsciLexerCoffeeScript* self) {
struct miqt_array QsciLexerCoffeeScript_AutoCompletionWordSeparators(const QsciLexerCoffeeScript* self) {
QStringList _ret = self->autoCompletionWordSeparators();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -70,9 +70,9 @@ struct miqt_array* QsciLexerCoffeeScript_AutoCompletionWordSeparators(const Qsci
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -124,7 +124,7 @@ func (this *QsciLexerCoffeeScript) Lexer() string {
}
func (this *QsciLexerCoffeeScript) AutoCompletionWordSeparators() []string {
var _ma *C.struct_miqt_array = C.QsciLexerCoffeeScript_AutoCompletionWordSeparators(this.h)
var _ma C.struct_miqt_array = C.QsciLexerCoffeeScript_AutoCompletionWordSeparators(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -133,7 +133,6 @@ func (this *QsciLexerCoffeeScript) AutoCompletionWordSeparators() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -35,7 +35,7 @@ struct miqt_string QsciLexerCoffeeScript_Tr(const char* s);
struct miqt_string QsciLexerCoffeeScript_TrUtf8(const char* s);
const char* QsciLexerCoffeeScript_Language(const QsciLexerCoffeeScript* self);
const char* QsciLexerCoffeeScript_Lexer(const QsciLexerCoffeeScript* self);
struct miqt_array* QsciLexerCoffeeScript_AutoCompletionWordSeparators(const QsciLexerCoffeeScript* self);
struct miqt_array QsciLexerCoffeeScript_AutoCompletionWordSeparators(const QsciLexerCoffeeScript* self);
const char* QsciLexerCoffeeScript_BlockEnd(const QsciLexerCoffeeScript* self);
const char* QsciLexerCoffeeScript_BlockStart(const QsciLexerCoffeeScript* self);
const char* QsciLexerCoffeeScript_BlockStartKeyword(const QsciLexerCoffeeScript* self);

View File

@ -60,7 +60,7 @@ const char* QsciLexerCPP_Lexer(const QsciLexerCPP* self) {
return (const char*) self->lexer();
}
struct miqt_array* QsciLexerCPP_AutoCompletionWordSeparators(const QsciLexerCPP* self) {
struct miqt_array QsciLexerCPP_AutoCompletionWordSeparators(const QsciLexerCPP* self) {
QStringList _ret = self->autoCompletionWordSeparators();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -74,9 +74,9 @@ struct miqt_array* QsciLexerCPP_AutoCompletionWordSeparators(const QsciLexerCPP*
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -162,7 +162,7 @@ func (this *QsciLexerCPP) Lexer() string {
}
func (this *QsciLexerCPP) AutoCompletionWordSeparators() []string {
var _ma *C.struct_miqt_array = C.QsciLexerCPP_AutoCompletionWordSeparators(this.h)
var _ma C.struct_miqt_array = C.QsciLexerCPP_AutoCompletionWordSeparators(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -171,7 +171,6 @@ func (this *QsciLexerCPP) AutoCompletionWordSeparators() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -36,7 +36,7 @@ struct miqt_string QsciLexerCPP_Tr(const char* s);
struct miqt_string QsciLexerCPP_TrUtf8(const char* s);
const char* QsciLexerCPP_Language(const QsciLexerCPP* self);
const char* QsciLexerCPP_Lexer(const QsciLexerCPP* self);
struct miqt_array* QsciLexerCPP_AutoCompletionWordSeparators(const QsciLexerCPP* self);
struct miqt_array QsciLexerCPP_AutoCompletionWordSeparators(const QsciLexerCPP* self);
const char* QsciLexerCPP_BlockEnd(const QsciLexerCPP* self);
const char* QsciLexerCPP_BlockStart(const QsciLexerCPP* self);
const char* QsciLexerCPP_BlockStartKeyword(const QsciLexerCPP* self);

View File

@ -56,7 +56,7 @@ const char* QsciLexerD_Lexer(const QsciLexerD* self) {
return (const char*) self->lexer();
}
struct miqt_array* QsciLexerD_AutoCompletionWordSeparators(const QsciLexerD* self) {
struct miqt_array QsciLexerD_AutoCompletionWordSeparators(const QsciLexerD* self) {
QStringList _ret = self->autoCompletionWordSeparators();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -70,9 +70,9 @@ struct miqt_array* QsciLexerD_AutoCompletionWordSeparators(const QsciLexerD* sel
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -123,7 +123,7 @@ func (this *QsciLexerD) Lexer() string {
}
func (this *QsciLexerD) AutoCompletionWordSeparators() []string {
var _ma *C.struct_miqt_array = C.QsciLexerD_AutoCompletionWordSeparators(this.h)
var _ma C.struct_miqt_array = C.QsciLexerD_AutoCompletionWordSeparators(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -132,7 +132,6 @@ func (this *QsciLexerD) AutoCompletionWordSeparators() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -35,7 +35,7 @@ struct miqt_string QsciLexerD_Tr(const char* s);
struct miqt_string QsciLexerD_TrUtf8(const char* s);
const char* QsciLexerD_Language(const QsciLexerD* self);
const char* QsciLexerD_Lexer(const QsciLexerD* self);
struct miqt_array* QsciLexerD_AutoCompletionWordSeparators(const QsciLexerD* self);
struct miqt_array QsciLexerD_AutoCompletionWordSeparators(const QsciLexerD* self);
const char* QsciLexerD_BlockEnd(const QsciLexerD* self);
const char* QsciLexerD_BlockStart(const QsciLexerD* self);
const char* QsciLexerD_BlockStartKeyword(const QsciLexerD* self);

View File

@ -56,7 +56,7 @@ const char* QsciLexerLua_Lexer(const QsciLexerLua* self) {
return (const char*) self->lexer();
}
struct miqt_array* QsciLexerLua_AutoCompletionWordSeparators(const QsciLexerLua* self) {
struct miqt_array QsciLexerLua_AutoCompletionWordSeparators(const QsciLexerLua* self) {
QStringList _ret = self->autoCompletionWordSeparators();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -70,9 +70,9 @@ struct miqt_array* QsciLexerLua_AutoCompletionWordSeparators(const QsciLexerLua*
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -120,7 +120,7 @@ func (this *QsciLexerLua) Lexer() string {
}
func (this *QsciLexerLua) AutoCompletionWordSeparators() []string {
var _ma *C.struct_miqt_array = C.QsciLexerLua_AutoCompletionWordSeparators(this.h)
var _ma C.struct_miqt_array = C.QsciLexerLua_AutoCompletionWordSeparators(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -129,7 +129,6 @@ func (this *QsciLexerLua) AutoCompletionWordSeparators() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -35,7 +35,7 @@ struct miqt_string QsciLexerLua_Tr(const char* s);
struct miqt_string QsciLexerLua_TrUtf8(const char* s);
const char* QsciLexerLua_Language(const QsciLexerLua* self);
const char* QsciLexerLua_Lexer(const QsciLexerLua* self);
struct miqt_array* QsciLexerLua_AutoCompletionWordSeparators(const QsciLexerLua* self);
struct miqt_array QsciLexerLua_AutoCompletionWordSeparators(const QsciLexerLua* self);
const char* QsciLexerLua_BlockStart(const QsciLexerLua* self);
int QsciLexerLua_BraceStyle(const QsciLexerLua* self);
QColor* QsciLexerLua_DefaultColor(const QsciLexerLua* self, int style);

View File

@ -56,7 +56,7 @@ const char* QsciLexerPascal_Lexer(const QsciLexerPascal* self) {
return (const char*) self->lexer();
}
struct miqt_array* QsciLexerPascal_AutoCompletionWordSeparators(const QsciLexerPascal* self) {
struct miqt_array QsciLexerPascal_AutoCompletionWordSeparators(const QsciLexerPascal* self) {
QStringList _ret = self->autoCompletionWordSeparators();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -70,9 +70,9 @@ struct miqt_array* QsciLexerPascal_AutoCompletionWordSeparators(const QsciLexerP
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -115,7 +115,7 @@ func (this *QsciLexerPascal) Lexer() string {
}
func (this *QsciLexerPascal) AutoCompletionWordSeparators() []string {
var _ma *C.struct_miqt_array = C.QsciLexerPascal_AutoCompletionWordSeparators(this.h)
var _ma C.struct_miqt_array = C.QsciLexerPascal_AutoCompletionWordSeparators(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -124,7 +124,6 @@ func (this *QsciLexerPascal) AutoCompletionWordSeparators() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -35,7 +35,7 @@ struct miqt_string QsciLexerPascal_Tr(const char* s);
struct miqt_string QsciLexerPascal_TrUtf8(const char* s);
const char* QsciLexerPascal_Language(const QsciLexerPascal* self);
const char* QsciLexerPascal_Lexer(const QsciLexerPascal* self);
struct miqt_array* QsciLexerPascal_AutoCompletionWordSeparators(const QsciLexerPascal* self);
struct miqt_array QsciLexerPascal_AutoCompletionWordSeparators(const QsciLexerPascal* self);
const char* QsciLexerPascal_BlockEnd(const QsciLexerPascal* self);
const char* QsciLexerPascal_BlockStart(const QsciLexerPascal* self);
const char* QsciLexerPascal_BlockStartKeyword(const QsciLexerPascal* self);

View File

@ -56,7 +56,7 @@ const char* QsciLexerPerl_Lexer(const QsciLexerPerl* self) {
return (const char*) self->lexer();
}
struct miqt_array* QsciLexerPerl_AutoCompletionWordSeparators(const QsciLexerPerl* self) {
struct miqt_array QsciLexerPerl_AutoCompletionWordSeparators(const QsciLexerPerl* self) {
QStringList _ret = self->autoCompletionWordSeparators();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -70,9 +70,9 @@ struct miqt_array* QsciLexerPerl_AutoCompletionWordSeparators(const QsciLexerPer
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -141,7 +141,7 @@ func (this *QsciLexerPerl) Lexer() string {
}
func (this *QsciLexerPerl) AutoCompletionWordSeparators() []string {
var _ma *C.struct_miqt_array = C.QsciLexerPerl_AutoCompletionWordSeparators(this.h)
var _ma C.struct_miqt_array = C.QsciLexerPerl_AutoCompletionWordSeparators(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -150,7 +150,6 @@ func (this *QsciLexerPerl) AutoCompletionWordSeparators() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -35,7 +35,7 @@ struct miqt_string QsciLexerPerl_Tr(const char* s);
struct miqt_string QsciLexerPerl_TrUtf8(const char* s);
const char* QsciLexerPerl_Language(const QsciLexerPerl* self);
const char* QsciLexerPerl_Lexer(const QsciLexerPerl* self);
struct miqt_array* QsciLexerPerl_AutoCompletionWordSeparators(const QsciLexerPerl* self);
struct miqt_array QsciLexerPerl_AutoCompletionWordSeparators(const QsciLexerPerl* self);
const char* QsciLexerPerl_BlockEnd(const QsciLexerPerl* self);
const char* QsciLexerPerl_BlockStart(const QsciLexerPerl* self);
int QsciLexerPerl_BraceStyle(const QsciLexerPerl* self);

View File

@ -56,7 +56,7 @@ const char* QsciLexerPython_Lexer(const QsciLexerPython* self) {
return (const char*) self->lexer();
}
struct miqt_array* QsciLexerPython_AutoCompletionWordSeparators(const QsciLexerPython* self) {
struct miqt_array QsciLexerPython_AutoCompletionWordSeparators(const QsciLexerPython* self) {
QStringList _ret = self->autoCompletionWordSeparators();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -70,9 +70,9 @@ struct miqt_array* QsciLexerPython_AutoCompletionWordSeparators(const QsciLexerP
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -130,7 +130,7 @@ func (this *QsciLexerPython) Lexer() string {
}
func (this *QsciLexerPython) AutoCompletionWordSeparators() []string {
var _ma *C.struct_miqt_array = C.QsciLexerPython_AutoCompletionWordSeparators(this.h)
var _ma C.struct_miqt_array = C.QsciLexerPython_AutoCompletionWordSeparators(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -139,7 +139,6 @@ func (this *QsciLexerPython) AutoCompletionWordSeparators() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -35,7 +35,7 @@ struct miqt_string QsciLexerPython_Tr(const char* s);
struct miqt_string QsciLexerPython_TrUtf8(const char* s);
const char* QsciLexerPython_Language(const QsciLexerPython* self);
const char* QsciLexerPython_Lexer(const QsciLexerPython* self);
struct miqt_array* QsciLexerPython_AutoCompletionWordSeparators(const QsciLexerPython* self);
struct miqt_array QsciLexerPython_AutoCompletionWordSeparators(const QsciLexerPython* self);
int QsciLexerPython_BlockLookback(const QsciLexerPython* self);
const char* QsciLexerPython_BlockStart(const QsciLexerPython* self);
int QsciLexerPython_BraceStyle(const QsciLexerPython* self);

View File

@ -54,7 +54,7 @@ struct miqt_string QsciScintilla_TrUtf8(const char* s) {
return _ms;
}
struct miqt_array* QsciScintilla_ApiContext(QsciScintilla* self, int pos, int* context_start, int* last_word_start) {
struct miqt_array QsciScintilla_ApiContext(QsciScintilla* self, int pos, int* context_start, int* last_word_start) {
QStringList _ret = self->apiContext(static_cast<int>(pos), static_cast<int&>(*context_start), static_cast<int&>(*last_word_start));
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -68,9 +68,9 @@ struct miqt_array* QsciScintilla_ApiContext(QsciScintilla* self, int pos, int* c
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -206,16 +206,16 @@ QColor* QsciScintilla_Color(const QsciScintilla* self) {
return new QColor(self->color());
}
struct miqt_array* QsciScintilla_ContractedFolds(const QsciScintilla* self) {
struct miqt_array QsciScintilla_ContractedFolds(const QsciScintilla* self) {
QList<int> _ret = self->contractedFolds();
// Convert QList<> from C++ memory to manually-managed C memory
int* _arr = static_cast<int*>(malloc(sizeof(int) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -542,11 +542,11 @@ void QsciScintilla_SetAutoCompletionFillups(QsciScintilla* self, const char* fil
self->setAutoCompletionFillups(fillups);
}
void QsciScintilla_SetAutoCompletionWordSeparators(QsciScintilla* self, struct miqt_array* /* of struct miqt_string */ separators) {
void QsciScintilla_SetAutoCompletionWordSeparators(QsciScintilla* self, struct miqt_array /* of struct miqt_string */ separators) {
QStringList separators_QList;
separators_QList.reserve(separators->len);
struct miqt_string* separators_arr = static_cast<struct miqt_string*>(separators->data);
for(size_t i = 0; i < separators->len; ++i) {
separators_QList.reserve(separators.len);
struct miqt_string* separators_arr = static_cast<struct miqt_string*>(separators.data);
for(size_t i = 0; i < separators.len; ++i) {
QString separators_arr_i_QString = QString::fromUtf8(separators_arr[i].data, separators_arr[i].len);
separators_QList.push_back(separators_arr_i_QString);
}
@ -577,11 +577,11 @@ void QsciScintilla_SetCallTipsVisible(QsciScintilla* self, int nr) {
self->setCallTipsVisible(static_cast<int>(nr));
}
void QsciScintilla_SetContractedFolds(QsciScintilla* self, struct miqt_array* /* of int */ folds) {
void QsciScintilla_SetContractedFolds(QsciScintilla* self, struct miqt_array /* of int */ folds) {
QList<int> folds_QList;
folds_QList.reserve(folds->len);
int* folds_arr = static_cast<int*>(folds->data);
for(size_t i = 0; i < folds->len; ++i) {
folds_QList.reserve(folds.len);
int* folds_arr = static_cast<int*>(folds.data);
for(size_t i = 0; i < folds.len; ++i) {
folds_QList.push_back(static_cast<int>(folds_arr[i]));
}
self->setContractedFolds(folds_QList);
@ -788,11 +788,11 @@ void QsciScintilla_SetWrapIndentMode(QsciScintilla* self, int mode) {
self->setWrapIndentMode(static_cast<QsciScintilla::WrapIndentMode>(mode));
}
void QsciScintilla_ShowUserList(QsciScintilla* self, int id, struct miqt_array* /* of struct miqt_string */ list) {
void QsciScintilla_ShowUserList(QsciScintilla* self, int id, struct miqt_array /* of struct miqt_string */ list) {
QStringList list_QList;
list_QList.reserve(list->len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list->data);
for(size_t i = 0; i < list->len; ++i) {
list_QList.reserve(list.len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list.data);
for(size_t i = 0; i < list.len; ++i) {
QString list_arr_i_QString = QString::fromUtf8(list_arr[i].data, list_arr[i].len);
list_QList.push_back(list_arr_i_QString);
}

View File

@ -290,7 +290,7 @@ func QsciScintilla_TrUtf8(s string) string {
}
func (this *QsciScintilla) ApiContext(pos int, context_start *int, last_word_start *int) []string {
var _ma *C.struct_miqt_array = C.QsciScintilla_ApiContext(this.h, (C.int)(pos), (*C.int)(unsafe.Pointer(context_start)), (*C.int)(unsafe.Pointer(last_word_start)))
var _ma C.struct_miqt_array = C.QsciScintilla_ApiContext(this.h, (C.int)(pos), (*C.int)(unsafe.Pointer(context_start)), (*C.int)(unsafe.Pointer(last_word_start)))
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -299,7 +299,6 @@ func (this *QsciScintilla) ApiContext(pos int, context_start *int, last_word_sta
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -433,13 +432,12 @@ func (this *QsciScintilla) Color() *qt.QColor {
}
func (this *QsciScintilla) ContractedFolds() []int {
var _ma *C.struct_miqt_array = C.QsciScintilla_ContractedFolds(this.h)
var _ma C.struct_miqt_array = C.QsciScintilla_ContractedFolds(this.h)
_ret := make([]int, int(_ma.len))
_outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = (int)(_outCast[i])
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -786,7 +784,6 @@ func (this *QsciScintilla) SetAutoCompletionFillups(fillups string) {
}
func (this *QsciScintilla) SetAutoCompletionWordSeparators(separators []string) {
// For the C ABI, malloc a C array of structs
separators_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(separators))))
defer C.free(unsafe.Pointer(separators_CArray))
for i := range separators {
@ -796,8 +793,7 @@ func (this *QsciScintilla) SetAutoCompletionWordSeparators(separators []string)
defer C.free(unsafe.Pointer(separators_i_ms.data))
separators_CArray[i] = separators_i_ms
}
separators_ma := &C.struct_miqt_array{len: C.size_t(len(separators)), data: unsafe.Pointer(separators_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(separators_ma))
separators_ma := C.struct_miqt_array{len: C.size_t(len(separators)), data: unsafe.Pointer(separators_CArray)}
C.QsciScintilla_SetAutoCompletionWordSeparators(this.h, separators_ma)
}
@ -826,14 +822,12 @@ func (this *QsciScintilla) SetCallTipsVisible(nr int) {
}
func (this *QsciScintilla) SetContractedFolds(folds []int) {
// For the C ABI, malloc a C array of raw pointers
folds_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(folds))))
defer C.free(unsafe.Pointer(folds_CArray))
for i := range folds {
folds_CArray[i] = (C.int)(folds[i])
}
folds_ma := &C.struct_miqt_array{len: C.size_t(len(folds)), data: unsafe.Pointer(folds_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(folds_ma))
folds_ma := C.struct_miqt_array{len: C.size_t(len(folds)), data: unsafe.Pointer(folds_CArray)}
C.QsciScintilla_SetContractedFolds(this.h, folds_ma)
}
@ -1041,7 +1035,6 @@ func (this *QsciScintilla) SetWrapIndentMode(mode QsciScintilla__WrapIndentMode)
}
func (this *QsciScintilla) ShowUserList(id int, list []string) {
// For the C ABI, malloc a C array of structs
list_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(list))))
defer C.free(unsafe.Pointer(list_CArray))
for i := range list {
@ -1051,8 +1044,7 @@ func (this *QsciScintilla) ShowUserList(id int, list []string) {
defer C.free(unsafe.Pointer(list_i_ms.data))
list_CArray[i] = list_i_ms
}
list_ma := &C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(list_ma))
list_ma := C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
C.QsciScintilla_ShowUserList(this.h, (C.int)(id), list_ma)
}

View File

@ -55,7 +55,7 @@ QMetaObject* QsciScintilla_MetaObject(const QsciScintilla* self);
void* QsciScintilla_Metacast(QsciScintilla* self, const char* param1);
struct miqt_string QsciScintilla_Tr(const char* s);
struct miqt_string QsciScintilla_TrUtf8(const char* s);
struct miqt_array* QsciScintilla_ApiContext(QsciScintilla* self, int pos, int* context_start, int* last_word_start);
struct miqt_array QsciScintilla_ApiContext(QsciScintilla* self, int pos, int* context_start, int* last_word_start);
void QsciScintilla_Annotate(QsciScintilla* self, int line, struct miqt_string text, int style);
void QsciScintilla_Annotate2(QsciScintilla* self, int line, struct miqt_string text, QsciStyle* style);
void QsciScintilla_Annotate3(QsciScintilla* self, int line, QsciStyledText* text);
@ -84,7 +84,7 @@ void QsciScintilla_ClearFolds(QsciScintilla* self);
void QsciScintilla_ClearIndicatorRange(QsciScintilla* self, int lineFrom, int indexFrom, int lineTo, int indexTo, int indicatorNumber);
void QsciScintilla_ClearRegisteredImages(QsciScintilla* self);
QColor* QsciScintilla_Color(const QsciScintilla* self);
struct miqt_array* QsciScintilla_ContractedFolds(const QsciScintilla* self);
struct miqt_array QsciScintilla_ContractedFolds(const QsciScintilla* self);
void QsciScintilla_ConvertEols(QsciScintilla* self, int mode);
QMenu* QsciScintilla_CreateStandardContextMenu(QsciScintilla* self);
QsciDocument* QsciScintilla_Document(const QsciScintilla* self);
@ -164,14 +164,14 @@ void QsciScintilla_SetFoldMarginColors(QsciScintilla* self, QColor* fore, QColor
void QsciScintilla_SetAnnotationDisplay(QsciScintilla* self, int display);
void QsciScintilla_SetAutoCompletionFillupsEnabled(QsciScintilla* self, bool enabled);
void QsciScintilla_SetAutoCompletionFillups(QsciScintilla* self, const char* fillups);
void QsciScintilla_SetAutoCompletionWordSeparators(QsciScintilla* self, struct miqt_array* /* of struct miqt_string */ separators);
void QsciScintilla_SetAutoCompletionWordSeparators(QsciScintilla* self, struct miqt_array /* of struct miqt_string */ separators);
void QsciScintilla_SetCallTipsBackgroundColor(QsciScintilla* self, QColor* col);
void QsciScintilla_SetCallTipsForegroundColor(QsciScintilla* self, QColor* col);
void QsciScintilla_SetCallTipsHighlightColor(QsciScintilla* self, QColor* col);
void QsciScintilla_SetCallTipsPosition(QsciScintilla* self, int position);
void QsciScintilla_SetCallTipsStyle(QsciScintilla* self, int style);
void QsciScintilla_SetCallTipsVisible(QsciScintilla* self, int nr);
void QsciScintilla_SetContractedFolds(QsciScintilla* self, struct miqt_array* /* of int */ folds);
void QsciScintilla_SetContractedFolds(QsciScintilla* self, struct miqt_array /* of int */ folds);
void QsciScintilla_SetDocument(QsciScintilla* self, QsciDocument* document);
void QsciScintilla_AddEdgeColumn(QsciScintilla* self, int colnr, QColor* col);
void QsciScintilla_ClearEdgeColumns(QsciScintilla* self);
@ -220,7 +220,7 @@ void QsciScintilla_SetWhitespaceBackgroundColor(QsciScintilla* self, QColor* col
void QsciScintilla_SetWhitespaceForegroundColor(QsciScintilla* self, QColor* col);
void QsciScintilla_SetWhitespaceSize(QsciScintilla* self, int size);
void QsciScintilla_SetWrapIndentMode(QsciScintilla* self, int mode);
void QsciScintilla_ShowUserList(QsciScintilla* self, int id, struct miqt_array* /* of struct miqt_string */ list);
void QsciScintilla_ShowUserList(QsciScintilla* self, int id, struct miqt_array /* of struct miqt_string */ list);
QsciCommandSet* QsciScintilla_StandardCommands(const QsciScintilla* self);
int QsciScintilla_TabDrawMode(const QsciScintilla* self);
bool QsciScintilla_TabIndents(const QsciScintilla* self);

View File

@ -80,16 +80,16 @@ bool QAbstractEventDispatcher_UnregisterTimers(QAbstractEventDispatcher* self, Q
return self->unregisterTimers(object);
}
struct miqt_array* QAbstractEventDispatcher_RegisteredTimers(const QAbstractEventDispatcher* self, QObject* object) {
struct miqt_array QAbstractEventDispatcher_RegisteredTimers(const QAbstractEventDispatcher* self, QObject* object) {
QList<QAbstractEventDispatcher::TimerInfo> _ret = self->registeredTimers(object);
// Convert QList<> from C++ memory to manually-managed C memory
QAbstractEventDispatcher__TimerInfo** _arr = static_cast<QAbstractEventDispatcher__TimerInfo**>(malloc(sizeof(QAbstractEventDispatcher__TimerInfo*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QAbstractEventDispatcher::TimerInfo(_ret[i]);
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -109,7 +109,7 @@ func (this *QAbstractEventDispatcher) UnregisterTimers(object *QObject) bool {
}
func (this *QAbstractEventDispatcher) RegisteredTimers(object *QObject) []QAbstractEventDispatcher__TimerInfo {
var _ma *C.struct_miqt_array = C.QAbstractEventDispatcher_RegisteredTimers(this.h, object.cPointer())
var _ma C.struct_miqt_array = C.QAbstractEventDispatcher_RegisteredTimers(this.h, object.cPointer())
_ret := make([]QAbstractEventDispatcher__TimerInfo, int(_ma.len))
_outCast := (*[0xffff]*C.QAbstractEventDispatcher__TimerInfo)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -118,7 +118,6 @@ func (this *QAbstractEventDispatcher) RegisteredTimers(object *QObject) []QAbstr
_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_lv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -50,7 +50,7 @@ int QAbstractEventDispatcher_RegisterTimer(QAbstractEventDispatcher* self, int i
void QAbstractEventDispatcher_RegisterTimer2(QAbstractEventDispatcher* self, int timerId, int interval, int timerType, QObject* object);
bool QAbstractEventDispatcher_UnregisterTimer(QAbstractEventDispatcher* self, int timerId);
bool QAbstractEventDispatcher_UnregisterTimers(QAbstractEventDispatcher* self, QObject* object);
struct miqt_array* QAbstractEventDispatcher_RegisteredTimers(const QAbstractEventDispatcher* self, QObject* object);
struct miqt_array QAbstractEventDispatcher_RegisteredTimers(const QAbstractEventDispatcher* self, QObject* object);
int QAbstractEventDispatcher_RemainingTime(QAbstractEventDispatcher* self, int timerId);
void QAbstractEventDispatcher_WakeUp(QAbstractEventDispatcher* self);
void QAbstractEventDispatcher_Interrupt(QAbstractEventDispatcher* self);

View File

@ -96,16 +96,16 @@ bool QAbstractItemDelegate_HelpEvent(QAbstractItemDelegate* self, QHelpEvent* ev
return self->helpEvent(event, view, *option, *index);
}
struct miqt_array* QAbstractItemDelegate_PaintingRoles(const QAbstractItemDelegate* self) {
struct miqt_array QAbstractItemDelegate_PaintingRoles(const QAbstractItemDelegate* self) {
QVector<int> _ret = self->paintingRoles();
// Convert QList<> from C++ memory to manually-managed C memory
int* _arr = static_cast<int*>(malloc(sizeof(int) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -133,13 +133,12 @@ func (this *QAbstractItemDelegate) HelpEvent(event *QHelpEvent, view *QAbstractI
}
func (this *QAbstractItemDelegate) PaintingRoles() []int {
var _ma *C.struct_miqt_array = C.QAbstractItemDelegate_PaintingRoles(this.h)
var _ma C.struct_miqt_array = C.QAbstractItemDelegate_PaintingRoles(this.h)
_ret := make([]int, int(_ma.len))
_outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = (int)(_outCast[i])
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -55,7 +55,7 @@ void QAbstractItemDelegate_UpdateEditorGeometry(const QAbstractItemDelegate* sel
bool QAbstractItemDelegate_EditorEvent(QAbstractItemDelegate* self, QEvent* event, QAbstractItemModel* model, QStyleOptionViewItem* option, QModelIndex* index);
struct miqt_string QAbstractItemDelegate_ElidedText(QFontMetrics* fontMetrics, int width, int mode, struct miqt_string text);
bool QAbstractItemDelegate_HelpEvent(QAbstractItemDelegate* self, QHelpEvent* event, QAbstractItemView* view, QStyleOptionViewItem* option, QModelIndex* index);
struct miqt_array* QAbstractItemDelegate_PaintingRoles(const QAbstractItemDelegate* self);
struct miqt_array QAbstractItemDelegate_PaintingRoles(const QAbstractItemDelegate* self);
void QAbstractItemDelegate_CommitData(QAbstractItemDelegate* self, QWidget* editor);
void QAbstractItemDelegate_connect_CommitData(QAbstractItemDelegate* self, intptr_t slot);
void QAbstractItemDelegate_CloseEditor(QAbstractItemDelegate* self, QWidget* editor);

View File

@ -1,7 +1,9 @@
#include <QAbstractItemModel>
#include <QAbstractListModel>
#include <QAbstractTableModel>
#include <QByteArray>
#include <QList>
#include <QMap>
#include <QMetaObject>
#include <QMimeData>
#include <QModelIndex>
@ -269,7 +271,35 @@ bool QAbstractItemModel_SetHeaderData(QAbstractItemModel* self, int section, int
return self->setHeaderData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation), *value);
}
struct miqt_array* QAbstractItemModel_MimeTypes(const QAbstractItemModel* self) {
struct miqt_map QAbstractItemModel_ItemData(const QAbstractItemModel* self, QModelIndex* index) {
QMap<int, QVariant> _ret = self->itemData(*index);
// Convert QMap<> from C++ memory to manually-managed C memory
int* _karr = static_cast<int*>(malloc(sizeof(int) * _ret.size()));
QVariant** _varr = static_cast<QVariant**>(malloc(sizeof(QVariant*) * _ret.size()));
int _ctr = 0;
for (auto _itr = _ret.keyValueBegin(); _itr != _ret.keyValueEnd(); ++_itr) {
_karr[_ctr] = _itr->first;
_varr[_ctr] = new QVariant(_itr->second);
_ctr++;
}
struct miqt_map _out;
_out.len = _ret.size();
_out.keys = static_cast<void*>(_karr);
_out.values = static_cast<void*>(_varr);
return _out;
}
bool QAbstractItemModel_SetItemData(QAbstractItemModel* self, QModelIndex* index, struct miqt_map roles) {
QMap<int, QVariant> roles_QMap;
int* roles_karr = static_cast<int*>(roles.keys);
QVariant** roles_varr = static_cast<QVariant**>(roles.values);
for(size_t i = 0; i < roles.len; ++i) {
roles_QMap[static_cast<int>(roles_karr[i])] = *(roles_varr[i]);
}
return self->setItemData(*index, roles_QMap);
}
struct miqt_array QAbstractItemModel_MimeTypes(const QAbstractItemModel* self) {
QStringList _ret = self->mimeTypes();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -283,17 +313,17 @@ struct miqt_array* QAbstractItemModel_MimeTypes(const QAbstractItemModel* self)
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
QMimeData* QAbstractItemModel_MimeData(const QAbstractItemModel* self, struct miqt_array* /* of QModelIndex* */ indexes) {
QMimeData* QAbstractItemModel_MimeData(const QAbstractItemModel* self, struct miqt_array /* of QModelIndex* */ indexes) {
QModelIndexList indexes_QList;
indexes_QList.reserve(indexes->len);
QModelIndex** indexes_arr = static_cast<QModelIndex**>(indexes->data);
for(size_t i = 0; i < indexes->len; ++i) {
indexes_QList.reserve(indexes.len);
QModelIndex** indexes_arr = static_cast<QModelIndex**>(indexes.data);
for(size_t i = 0; i < indexes.len; ++i) {
indexes_QList.push_back(*(indexes_arr[i]));
}
return self->mimeData(indexes_QList);
@ -386,16 +416,16 @@ QModelIndex* QAbstractItemModel_Buddy(const QAbstractItemModel* self, QModelInde
return new QModelIndex(self->buddy(*index));
}
struct miqt_array* QAbstractItemModel_Match(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value) {
struct miqt_array QAbstractItemModel_Match(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value) {
QModelIndexList _ret = self->match(*start, static_cast<int>(role), *value);
// Convert QList<> from C++ memory to manually-managed C memory
QModelIndex** _arr = static_cast<QModelIndex**>(malloc(sizeof(QModelIndex*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QModelIndex(_ret[i]);
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -403,6 +433,29 @@ QSize* QAbstractItemModel_Span(const QAbstractItemModel* self, QModelIndex* inde
return new QSize(self->span(*index));
}
struct miqt_map QAbstractItemModel_RoleNames(const QAbstractItemModel* self) {
QHash<int, QByteArray> _ret = self->roleNames();
// Convert QMap<> from C++ memory to manually-managed C memory
int* _karr = static_cast<int*>(malloc(sizeof(int) * _ret.size()));
struct miqt_string* _varr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.size()));
int _ctr = 0;
for (auto _itr = _ret.keyValueBegin(); _itr != _ret.keyValueEnd(); ++_itr) {
_karr[_ctr] = _itr->first;
QByteArray _hashval_qb = _itr->second;
struct miqt_string _hashval_ms;
_hashval_ms.len = _hashval_qb.length();
_hashval_ms.data = static_cast<char*>(malloc(_hashval_ms.len));
memcpy(_hashval_ms.data, _hashval_qb.data(), _hashval_ms.len);
_varr[_ctr] = _hashval_ms;
_ctr++;
}
struct miqt_map _out;
_out.len = _ret.size();
_out.keys = static_cast<void*>(_karr);
_out.values = static_cast<void*>(_varr);
return _out;
}
bool QAbstractItemModel_CheckIndex(const QAbstractItemModel* self, QModelIndex* index) {
return self->checkIndex(*index);
}
@ -581,29 +634,29 @@ void QAbstractItemModel_Sort2(QAbstractItemModel* self, int column, int order) {
self->sort(static_cast<int>(column), static_cast<Qt::SortOrder>(order));
}
struct miqt_array* QAbstractItemModel_Match4(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value, int hits) {
struct miqt_array QAbstractItemModel_Match4(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value, int hits) {
QModelIndexList _ret = self->match(*start, static_cast<int>(role), *value, static_cast<int>(hits));
// Convert QList<> from C++ memory to manually-managed C memory
QModelIndex** _arr = static_cast<QModelIndex**>(malloc(sizeof(QModelIndex*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QModelIndex(_ret[i]);
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
struct miqt_array* QAbstractItemModel_Match5(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value, int hits, int flags) {
struct miqt_array QAbstractItemModel_Match5(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value, int hits, int flags) {
QModelIndexList _ret = self->match(*start, static_cast<int>(role), *value, static_cast<int>(hits), static_cast<Qt::MatchFlags>(flags));
// Convert QList<> from C++ memory to manually-managed C memory
QModelIndex** _arr = static_cast<QModelIndex**>(malloc(sizeof(QModelIndex*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QModelIndex(_ret[i]);
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -611,11 +664,11 @@ bool QAbstractItemModel_CheckIndex2(const QAbstractItemModel* self, QModelIndex*
return self->checkIndex(*index, static_cast<QAbstractItemModel::CheckIndexOptions>(options));
}
void QAbstractItemModel_DataChanged3(QAbstractItemModel* self, QModelIndex* topLeft, QModelIndex* bottomRight, struct miqt_array* /* of int */ roles) {
void QAbstractItemModel_DataChanged3(QAbstractItemModel* self, QModelIndex* topLeft, QModelIndex* bottomRight, struct miqt_array /* of int */ roles) {
QVector<int> roles_QList;
roles_QList.reserve(roles->len);
int* roles_arr = static_cast<int*>(roles->data);
for(size_t i = 0; i < roles->len; ++i) {
roles_QList.reserve(roles.len);
int* roles_arr = static_cast<int*>(roles.data);
for(size_t i = 0; i < roles.len; ++i) {
roles_QList.push_back(static_cast<int>(roles_arr[i]));
}
self->dataChanged(*topLeft, *bottomRight, roles_QList);
@ -635,19 +688,19 @@ void QAbstractItemModel_connect_DataChanged3(QAbstractItemModel* self, intptr_t
for (size_t i = 0, e = roles_ret.length(); i < e; ++i) {
roles_arr[i] = roles_ret[i];
}
struct miqt_array* roles_out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
roles_out->len = roles_ret.length();
roles_out->data = static_cast<void*>(roles_arr);
struct miqt_array* sigval3 = roles_out;
struct miqt_array roles_out;
roles_out.len = roles_ret.length();
roles_out.data = static_cast<void*>(roles_arr);
struct miqt_array sigval3 = roles_out;
miqt_exec_callback_QAbstractItemModel_DataChanged3(slot, sigval1, sigval2, sigval3);
});
}
void QAbstractItemModel_LayoutChanged1(QAbstractItemModel* self, struct miqt_array* /* of QPersistentModelIndex* */ parents) {
void QAbstractItemModel_LayoutChanged1(QAbstractItemModel* self, struct miqt_array /* of QPersistentModelIndex* */ parents) {
QList<QPersistentModelIndex> parents_QList;
parents_QList.reserve(parents->len);
QPersistentModelIndex** parents_arr = static_cast<QPersistentModelIndex**>(parents->data);
for(size_t i = 0; i < parents->len; ++i) {
parents_QList.reserve(parents.len);
QPersistentModelIndex** parents_arr = static_cast<QPersistentModelIndex**>(parents.data);
for(size_t i = 0; i < parents.len; ++i) {
parents_QList.push_back(*(parents_arr[i]));
}
self->layoutChanged(parents_QList);
@ -661,19 +714,19 @@ void QAbstractItemModel_connect_LayoutChanged1(QAbstractItemModel* self, intptr_
for (size_t i = 0, e = parents_ret.length(); i < e; ++i) {
parents_arr[i] = new QPersistentModelIndex(parents_ret[i]);
}
struct miqt_array* parents_out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
parents_out->len = parents_ret.length();
parents_out->data = static_cast<void*>(parents_arr);
struct miqt_array* sigval1 = parents_out;
struct miqt_array parents_out;
parents_out.len = parents_ret.length();
parents_out.data = static_cast<void*>(parents_arr);
struct miqt_array sigval1 = parents_out;
miqt_exec_callback_QAbstractItemModel_LayoutChanged1(slot, sigval1);
});
}
void QAbstractItemModel_LayoutChanged2(QAbstractItemModel* self, struct miqt_array* /* of QPersistentModelIndex* */ parents, int hint) {
void QAbstractItemModel_LayoutChanged2(QAbstractItemModel* self, struct miqt_array /* of QPersistentModelIndex* */ parents, int hint) {
QList<QPersistentModelIndex> parents_QList;
parents_QList.reserve(parents->len);
QPersistentModelIndex** parents_arr = static_cast<QPersistentModelIndex**>(parents->data);
for(size_t i = 0; i < parents->len; ++i) {
parents_QList.reserve(parents.len);
QPersistentModelIndex** parents_arr = static_cast<QPersistentModelIndex**>(parents.data);
for(size_t i = 0; i < parents.len; ++i) {
parents_QList.push_back(*(parents_arr[i]));
}
self->layoutChanged(parents_QList, static_cast<QAbstractItemModel::LayoutChangeHint>(hint));
@ -687,21 +740,21 @@ void QAbstractItemModel_connect_LayoutChanged2(QAbstractItemModel* self, intptr_
for (size_t i = 0, e = parents_ret.length(); i < e; ++i) {
parents_arr[i] = new QPersistentModelIndex(parents_ret[i]);
}
struct miqt_array* parents_out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
parents_out->len = parents_ret.length();
parents_out->data = static_cast<void*>(parents_arr);
struct miqt_array* sigval1 = parents_out;
struct miqt_array parents_out;
parents_out.len = parents_ret.length();
parents_out.data = static_cast<void*>(parents_arr);
struct miqt_array sigval1 = parents_out;
QAbstractItemModel::LayoutChangeHint hint_ret = hint;
int sigval2 = static_cast<int>(hint_ret);
miqt_exec_callback_QAbstractItemModel_LayoutChanged2(slot, sigval1, sigval2);
});
}
void QAbstractItemModel_LayoutAboutToBeChanged1(QAbstractItemModel* self, struct miqt_array* /* of QPersistentModelIndex* */ parents) {
void QAbstractItemModel_LayoutAboutToBeChanged1(QAbstractItemModel* self, struct miqt_array /* of QPersistentModelIndex* */ parents) {
QList<QPersistentModelIndex> parents_QList;
parents_QList.reserve(parents->len);
QPersistentModelIndex** parents_arr = static_cast<QPersistentModelIndex**>(parents->data);
for(size_t i = 0; i < parents->len; ++i) {
parents_QList.reserve(parents.len);
QPersistentModelIndex** parents_arr = static_cast<QPersistentModelIndex**>(parents.data);
for(size_t i = 0; i < parents.len; ++i) {
parents_QList.push_back(*(parents_arr[i]));
}
self->layoutAboutToBeChanged(parents_QList);
@ -715,19 +768,19 @@ void QAbstractItemModel_connect_LayoutAboutToBeChanged1(QAbstractItemModel* self
for (size_t i = 0, e = parents_ret.length(); i < e; ++i) {
parents_arr[i] = new QPersistentModelIndex(parents_ret[i]);
}
struct miqt_array* parents_out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
parents_out->len = parents_ret.length();
parents_out->data = static_cast<void*>(parents_arr);
struct miqt_array* sigval1 = parents_out;
struct miqt_array parents_out;
parents_out.len = parents_ret.length();
parents_out.data = static_cast<void*>(parents_arr);
struct miqt_array sigval1 = parents_out;
miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged1(slot, sigval1);
});
}
void QAbstractItemModel_LayoutAboutToBeChanged2(QAbstractItemModel* self, struct miqt_array* /* of QPersistentModelIndex* */ parents, int hint) {
void QAbstractItemModel_LayoutAboutToBeChanged2(QAbstractItemModel* self, struct miqt_array /* of QPersistentModelIndex* */ parents, int hint) {
QList<QPersistentModelIndex> parents_QList;
parents_QList.reserve(parents->len);
QPersistentModelIndex** parents_arr = static_cast<QPersistentModelIndex**>(parents->data);
for(size_t i = 0; i < parents->len; ++i) {
parents_QList.reserve(parents.len);
QPersistentModelIndex** parents_arr = static_cast<QPersistentModelIndex**>(parents.data);
for(size_t i = 0; i < parents.len; ++i) {
parents_QList.push_back(*(parents_arr[i]));
}
self->layoutAboutToBeChanged(parents_QList, static_cast<QAbstractItemModel::LayoutChangeHint>(hint));
@ -741,10 +794,10 @@ void QAbstractItemModel_connect_LayoutAboutToBeChanged2(QAbstractItemModel* self
for (size_t i = 0, e = parents_ret.length(); i < e; ++i) {
parents_arr[i] = new QPersistentModelIndex(parents_ret[i]);
}
struct miqt_array* parents_out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
parents_out->len = parents_ret.length();
parents_out->data = static_cast<void*>(parents_arr);
struct miqt_array* sigval1 = parents_out;
struct miqt_array parents_out;
parents_out.len = parents_ret.length();
parents_out.data = static_cast<void*>(parents_arr);
struct miqt_array sigval1 = parents_out;
QAbstractItemModel::LayoutChangeHint hint_ret = hint;
int sigval2 = static_cast<int>(hint_ret);
miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged2(slot, sigval1, sigval2);

View File

@ -448,8 +448,45 @@ func (this *QAbstractItemModel) SetHeaderData(section int, orientation Orientati
return (bool)(C.QAbstractItemModel_SetHeaderData(this.h, (C.int)(section), (C.int)(orientation), value.cPointer()))
}
func (this *QAbstractItemModel) ItemData(index *QModelIndex) map[int]QVariant {
var _mm C.struct_miqt_map = C.QAbstractItemModel_ItemData(this.h, index.cPointer())
_ret := make(map[int]QVariant, int(_mm.len))
_Keys := (*[0xffff]C.int)(unsafe.Pointer(_mm.keys))
_Values := (*[0xffff]*C.QVariant)(unsafe.Pointer(_mm.values))
for i := 0; i < int(_mm.len); i++ {
_entry_Key := (int)(_Keys[i])
_mapval_ret := _Values[i]
_mapval_goptr := newQVariant(_mapval_ret)
_mapval_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_entry_Value := *_mapval_goptr
_ret[_entry_Key] = _entry_Value
}
return _ret
}
func (this *QAbstractItemModel) SetItemData(index *QModelIndex, roles map[int]QVariant) bool {
roles_Keys_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(roles))))
defer C.free(unsafe.Pointer(roles_Keys_CArray))
roles_Values_CArray := (*[0xffff]*C.QVariant)(C.malloc(C.size_t(8 * len(roles))))
defer C.free(unsafe.Pointer(roles_Values_CArray))
roles_ctr := 0
for roles_k, roles_v := range roles {
roles_Keys_CArray[roles_ctr] = (C.int)(roles_k)
roles_Values_CArray[roles_ctr] = roles_v.cPointer()
roles_ctr++
}
roles_mm := C.struct_miqt_map{
len: C.size_t(len(roles)),
keys: unsafe.Pointer(roles_Keys_CArray),
values: unsafe.Pointer(roles_Values_CArray),
}
return (bool)(C.QAbstractItemModel_SetItemData(this.h, index.cPointer(), roles_mm))
}
func (this *QAbstractItemModel) MimeTypes() []string {
var _ma *C.struct_miqt_array = C.QAbstractItemModel_MimeTypes(this.h)
var _ma C.struct_miqt_array = C.QAbstractItemModel_MimeTypes(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -458,19 +495,16 @@ func (this *QAbstractItemModel) MimeTypes() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func (this *QAbstractItemModel) MimeData(indexes []QModelIndex) *QMimeData {
// For the C ABI, malloc a C array of raw pointers
indexes_CArray := (*[0xffff]*C.QModelIndex)(C.malloc(C.size_t(8 * len(indexes))))
defer C.free(unsafe.Pointer(indexes_CArray))
for i := range indexes {
indexes_CArray[i] = indexes[i].cPointer()
}
indexes_ma := &C.struct_miqt_array{len: C.size_t(len(indexes)), data: unsafe.Pointer(indexes_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(indexes_ma))
indexes_ma := C.struct_miqt_array{len: C.size_t(len(indexes)), data: unsafe.Pointer(indexes_CArray)}
return UnsafeNewQMimeData(unsafe.Pointer(C.QAbstractItemModel_MimeData(this.h, indexes_ma)))
}
@ -562,7 +596,7 @@ func (this *QAbstractItemModel) Buddy(index *QModelIndex) *QModelIndex {
}
func (this *QAbstractItemModel) Match(start *QModelIndex, role int, value *QVariant) []QModelIndex {
var _ma *C.struct_miqt_array = C.QAbstractItemModel_Match(this.h, start.cPointer(), (C.int)(role), value.cPointer())
var _ma C.struct_miqt_array = C.QAbstractItemModel_Match(this.h, start.cPointer(), (C.int)(role), value.cPointer())
_ret := make([]QModelIndex, int(_ma.len))
_outCast := (*[0xffff]*C.QModelIndex)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -571,7 +605,6 @@ func (this *QAbstractItemModel) Match(start *QModelIndex, role int, value *QVari
_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_lv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -582,6 +615,23 @@ func (this *QAbstractItemModel) Span(index *QModelIndex) *QSize {
return _goptr
}
func (this *QAbstractItemModel) RoleNames() map[int][]byte {
var _mm C.struct_miqt_map = C.QAbstractItemModel_RoleNames(this.h)
_ret := make(map[int][]byte, int(_mm.len))
_Keys := (*[0xffff]C.int)(unsafe.Pointer(_mm.keys))
_Values := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_mm.values))
for i := 0; i < int(_mm.len); i++ {
_entry_Key := (int)(_Keys[i])
var _hashval_bytearray C.struct_miqt_string = _Values[i]
_hashval_ret := C.GoBytes(unsafe.Pointer(_hashval_bytearray.data), C.int(int64(_hashval_bytearray.len)))
C.free(unsafe.Pointer(_hashval_bytearray.data))
_entry_Value := _hashval_ret
_ret[_entry_Key] = _entry_Value
}
return _ret
}
func (this *QAbstractItemModel) CheckIndex(index *QModelIndex) bool {
return (bool)(C.QAbstractItemModel_CheckIndex(this.h, index.cPointer()))
}
@ -799,7 +849,7 @@ func (this *QAbstractItemModel) Sort2(column int, order SortOrder) {
}
func (this *QAbstractItemModel) Match4(start *QModelIndex, role int, value *QVariant, hits int) []QModelIndex {
var _ma *C.struct_miqt_array = C.QAbstractItemModel_Match4(this.h, start.cPointer(), (C.int)(role), value.cPointer(), (C.int)(hits))
var _ma C.struct_miqt_array = C.QAbstractItemModel_Match4(this.h, start.cPointer(), (C.int)(role), value.cPointer(), (C.int)(hits))
_ret := make([]QModelIndex, int(_ma.len))
_outCast := (*[0xffff]*C.QModelIndex)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -808,12 +858,11 @@ func (this *QAbstractItemModel) Match4(start *QModelIndex, role int, value *QVar
_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_lv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func (this *QAbstractItemModel) Match5(start *QModelIndex, role int, value *QVariant, hits int, flags MatchFlag) []QModelIndex {
var _ma *C.struct_miqt_array = C.QAbstractItemModel_Match5(this.h, start.cPointer(), (C.int)(role), value.cPointer(), (C.int)(hits), (C.int)(flags))
var _ma C.struct_miqt_array = C.QAbstractItemModel_Match5(this.h, start.cPointer(), (C.int)(role), value.cPointer(), (C.int)(hits), (C.int)(flags))
_ret := make([]QModelIndex, int(_ma.len))
_outCast := (*[0xffff]*C.QModelIndex)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -822,7 +871,6 @@ func (this *QAbstractItemModel) Match5(start *QModelIndex, role int, value *QVar
_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_lv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -831,14 +879,12 @@ func (this *QAbstractItemModel) CheckIndex2(index *QModelIndex, options QAbstrac
}
func (this *QAbstractItemModel) DataChanged3(topLeft *QModelIndex, bottomRight *QModelIndex, roles []int) {
// For the C ABI, malloc a C array of raw pointers
roles_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(roles))))
defer C.free(unsafe.Pointer(roles_CArray))
for i := range roles {
roles_CArray[i] = (C.int)(roles[i])
}
roles_ma := &C.struct_miqt_array{len: C.size_t(len(roles)), data: unsafe.Pointer(roles_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(roles_ma))
roles_ma := C.struct_miqt_array{len: C.size_t(len(roles)), data: unsafe.Pointer(roles_CArray)}
C.QAbstractItemModel_DataChanged3(this.h, topLeft.cPointer(), bottomRight.cPointer(), roles_ma)
}
func (this *QAbstractItemModel) OnDataChanged3(slot func(topLeft *QModelIndex, bottomRight *QModelIndex, roles []int)) {
@ -846,7 +892,7 @@ func (this *QAbstractItemModel) OnDataChanged3(slot func(topLeft *QModelIndex, b
}
//export miqt_exec_callback_QAbstractItemModel_DataChanged3
func miqt_exec_callback_QAbstractItemModel_DataChanged3(cb C.intptr_t, topLeft *C.QModelIndex, bottomRight *C.QModelIndex, roles *C.struct_miqt_array) {
func miqt_exec_callback_QAbstractItemModel_DataChanged3(cb C.intptr_t, topLeft *C.QModelIndex, bottomRight *C.QModelIndex, roles C.struct_miqt_array) {
gofunc, ok := cgo.Handle(cb).Value().(func(topLeft *QModelIndex, bottomRight *QModelIndex, roles []int))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
@ -855,27 +901,24 @@ func miqt_exec_callback_QAbstractItemModel_DataChanged3(cb C.intptr_t, topLeft *
// Convert all CABI parameters to Go parameters
slotval1 := UnsafeNewQModelIndex(unsafe.Pointer(topLeft))
slotval2 := UnsafeNewQModelIndex(unsafe.Pointer(bottomRight))
var roles_ma *C.struct_miqt_array = roles
var roles_ma C.struct_miqt_array = roles
roles_ret := make([]int, int(roles_ma.len))
roles_outCast := (*[0xffff]C.int)(unsafe.Pointer(roles_ma.data)) // hey ya
for i := 0; i < int(roles_ma.len); i++ {
roles_ret[i] = (int)(roles_outCast[i])
}
C.free(unsafe.Pointer(roles_ma))
slotval3 := roles_ret
gofunc(slotval1, slotval2, slotval3)
}
func (this *QAbstractItemModel) LayoutChanged1(parents []QPersistentModelIndex) {
// For the C ABI, malloc a C array of raw pointers
parents_CArray := (*[0xffff]*C.QPersistentModelIndex)(C.malloc(C.size_t(8 * len(parents))))
defer C.free(unsafe.Pointer(parents_CArray))
for i := range parents {
parents_CArray[i] = parents[i].cPointer()
}
parents_ma := &C.struct_miqt_array{len: C.size_t(len(parents)), data: unsafe.Pointer(parents_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(parents_ma))
parents_ma := C.struct_miqt_array{len: C.size_t(len(parents)), data: unsafe.Pointer(parents_CArray)}
C.QAbstractItemModel_LayoutChanged1(this.h, parents_ma)
}
func (this *QAbstractItemModel) OnLayoutChanged1(slot func(parents []QPersistentModelIndex)) {
@ -883,14 +926,14 @@ func (this *QAbstractItemModel) OnLayoutChanged1(slot func(parents []QPersistent
}
//export miqt_exec_callback_QAbstractItemModel_LayoutChanged1
func miqt_exec_callback_QAbstractItemModel_LayoutChanged1(cb C.intptr_t, parents *C.struct_miqt_array) {
func miqt_exec_callback_QAbstractItemModel_LayoutChanged1(cb C.intptr_t, parents C.struct_miqt_array) {
gofunc, ok := cgo.Handle(cb).Value().(func(parents []QPersistentModelIndex))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
var parents_ma *C.struct_miqt_array = parents
var parents_ma C.struct_miqt_array = parents
parents_ret := make([]QPersistentModelIndex, int(parents_ma.len))
parents_outCast := (*[0xffff]*C.QPersistentModelIndex)(unsafe.Pointer(parents_ma.data)) // hey ya
for i := 0; i < int(parents_ma.len); i++ {
@ -899,21 +942,18 @@ func miqt_exec_callback_QAbstractItemModel_LayoutChanged1(cb C.intptr_t, parents
parents_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
parents_ret[i] = *parents_lv_goptr
}
C.free(unsafe.Pointer(parents_ma))
slotval1 := parents_ret
gofunc(slotval1)
}
func (this *QAbstractItemModel) LayoutChanged2(parents []QPersistentModelIndex, hint QAbstractItemModel__LayoutChangeHint) {
// For the C ABI, malloc a C array of raw pointers
parents_CArray := (*[0xffff]*C.QPersistentModelIndex)(C.malloc(C.size_t(8 * len(parents))))
defer C.free(unsafe.Pointer(parents_CArray))
for i := range parents {
parents_CArray[i] = parents[i].cPointer()
}
parents_ma := &C.struct_miqt_array{len: C.size_t(len(parents)), data: unsafe.Pointer(parents_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(parents_ma))
parents_ma := C.struct_miqt_array{len: C.size_t(len(parents)), data: unsafe.Pointer(parents_CArray)}
C.QAbstractItemModel_LayoutChanged2(this.h, parents_ma, (C.int)(hint))
}
func (this *QAbstractItemModel) OnLayoutChanged2(slot func(parents []QPersistentModelIndex, hint QAbstractItemModel__LayoutChangeHint)) {
@ -921,14 +961,14 @@ func (this *QAbstractItemModel) OnLayoutChanged2(slot func(parents []QPersistent
}
//export miqt_exec_callback_QAbstractItemModel_LayoutChanged2
func miqt_exec_callback_QAbstractItemModel_LayoutChanged2(cb C.intptr_t, parents *C.struct_miqt_array, hint C.int) {
func miqt_exec_callback_QAbstractItemModel_LayoutChanged2(cb C.intptr_t, parents C.struct_miqt_array, hint C.int) {
gofunc, ok := cgo.Handle(cb).Value().(func(parents []QPersistentModelIndex, hint QAbstractItemModel__LayoutChangeHint))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
var parents_ma *C.struct_miqt_array = parents
var parents_ma C.struct_miqt_array = parents
parents_ret := make([]QPersistentModelIndex, int(parents_ma.len))
parents_outCast := (*[0xffff]*C.QPersistentModelIndex)(unsafe.Pointer(parents_ma.data)) // hey ya
for i := 0; i < int(parents_ma.len); i++ {
@ -937,7 +977,6 @@ func miqt_exec_callback_QAbstractItemModel_LayoutChanged2(cb C.intptr_t, parents
parents_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
parents_ret[i] = *parents_lv_goptr
}
C.free(unsafe.Pointer(parents_ma))
slotval1 := parents_ret
slotval2 := (QAbstractItemModel__LayoutChangeHint)(hint)
@ -946,14 +985,12 @@ func miqt_exec_callback_QAbstractItemModel_LayoutChanged2(cb C.intptr_t, parents
}
func (this *QAbstractItemModel) LayoutAboutToBeChanged1(parents []QPersistentModelIndex) {
// For the C ABI, malloc a C array of raw pointers
parents_CArray := (*[0xffff]*C.QPersistentModelIndex)(C.malloc(C.size_t(8 * len(parents))))
defer C.free(unsafe.Pointer(parents_CArray))
for i := range parents {
parents_CArray[i] = parents[i].cPointer()
}
parents_ma := &C.struct_miqt_array{len: C.size_t(len(parents)), data: unsafe.Pointer(parents_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(parents_ma))
parents_ma := C.struct_miqt_array{len: C.size_t(len(parents)), data: unsafe.Pointer(parents_CArray)}
C.QAbstractItemModel_LayoutAboutToBeChanged1(this.h, parents_ma)
}
func (this *QAbstractItemModel) OnLayoutAboutToBeChanged1(slot func(parents []QPersistentModelIndex)) {
@ -961,14 +998,14 @@ func (this *QAbstractItemModel) OnLayoutAboutToBeChanged1(slot func(parents []QP
}
//export miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged1
func miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged1(cb C.intptr_t, parents *C.struct_miqt_array) {
func miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged1(cb C.intptr_t, parents C.struct_miqt_array) {
gofunc, ok := cgo.Handle(cb).Value().(func(parents []QPersistentModelIndex))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
var parents_ma *C.struct_miqt_array = parents
var parents_ma C.struct_miqt_array = parents
parents_ret := make([]QPersistentModelIndex, int(parents_ma.len))
parents_outCast := (*[0xffff]*C.QPersistentModelIndex)(unsafe.Pointer(parents_ma.data)) // hey ya
for i := 0; i < int(parents_ma.len); i++ {
@ -977,21 +1014,18 @@ func miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged1(cb C.intptr_t
parents_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
parents_ret[i] = *parents_lv_goptr
}
C.free(unsafe.Pointer(parents_ma))
slotval1 := parents_ret
gofunc(slotval1)
}
func (this *QAbstractItemModel) LayoutAboutToBeChanged2(parents []QPersistentModelIndex, hint QAbstractItemModel__LayoutChangeHint) {
// For the C ABI, malloc a C array of raw pointers
parents_CArray := (*[0xffff]*C.QPersistentModelIndex)(C.malloc(C.size_t(8 * len(parents))))
defer C.free(unsafe.Pointer(parents_CArray))
for i := range parents {
parents_CArray[i] = parents[i].cPointer()
}
parents_ma := &C.struct_miqt_array{len: C.size_t(len(parents)), data: unsafe.Pointer(parents_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(parents_ma))
parents_ma := C.struct_miqt_array{len: C.size_t(len(parents)), data: unsafe.Pointer(parents_CArray)}
C.QAbstractItemModel_LayoutAboutToBeChanged2(this.h, parents_ma, (C.int)(hint))
}
func (this *QAbstractItemModel) OnLayoutAboutToBeChanged2(slot func(parents []QPersistentModelIndex, hint QAbstractItemModel__LayoutChangeHint)) {
@ -999,14 +1033,14 @@ func (this *QAbstractItemModel) OnLayoutAboutToBeChanged2(slot func(parents []QP
}
//export miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged2
func miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged2(cb C.intptr_t, parents *C.struct_miqt_array, hint C.int) {
func miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged2(cb C.intptr_t, parents C.struct_miqt_array, hint C.int) {
gofunc, ok := cgo.Handle(cb).Value().(func(parents []QPersistentModelIndex, hint QAbstractItemModel__LayoutChangeHint))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
var parents_ma *C.struct_miqt_array = parents
var parents_ma C.struct_miqt_array = parents
parents_ret := make([]QPersistentModelIndex, int(parents_ma.len))
parents_outCast := (*[0xffff]*C.QPersistentModelIndex)(unsafe.Pointer(parents_ma.data)) // hey ya
for i := 0; i < int(parents_ma.len); i++ {
@ -1015,7 +1049,6 @@ func miqt_exec_callback_QAbstractItemModel_LayoutAboutToBeChanged2(cb C.intptr_t
parents_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
parents_ret[i] = *parents_lv_goptr
}
C.free(unsafe.Pointer(parents_ma))
slotval1 := parents_ret
slotval2 := (QAbstractItemModel__LayoutChangeHint)(hint)

View File

@ -17,6 +17,7 @@ extern "C" {
class QAbstractItemModel;
class QAbstractListModel;
class QAbstractTableModel;
class QByteArray;
class QMetaObject;
class QMimeData;
class QModelIndex;
@ -27,6 +28,7 @@ class QVariant;
typedef struct QAbstractItemModel QAbstractItemModel;
typedef struct QAbstractListModel QAbstractListModel;
typedef struct QAbstractTableModel QAbstractTableModel;
typedef struct QByteArray QByteArray;
typedef struct QMetaObject QMetaObject;
typedef struct QMimeData QMimeData;
typedef struct QModelIndex QModelIndex;
@ -96,8 +98,10 @@ QVariant* QAbstractItemModel_Data(const QAbstractItemModel* self, QModelIndex* i
bool QAbstractItemModel_SetData(QAbstractItemModel* self, QModelIndex* index, QVariant* value);
QVariant* QAbstractItemModel_HeaderData(const QAbstractItemModel* self, int section, int orientation);
bool QAbstractItemModel_SetHeaderData(QAbstractItemModel* self, int section, int orientation, QVariant* value);
struct miqt_array* QAbstractItemModel_MimeTypes(const QAbstractItemModel* self);
QMimeData* QAbstractItemModel_MimeData(const QAbstractItemModel* self, struct miqt_array* /* of QModelIndex* */ indexes);
struct miqt_map QAbstractItemModel_ItemData(const QAbstractItemModel* self, QModelIndex* index);
bool QAbstractItemModel_SetItemData(QAbstractItemModel* self, QModelIndex* index, struct miqt_map roles);
struct miqt_array QAbstractItemModel_MimeTypes(const QAbstractItemModel* self);
QMimeData* QAbstractItemModel_MimeData(const QAbstractItemModel* self, struct miqt_array /* of QModelIndex* */ indexes);
bool QAbstractItemModel_CanDropMimeData(const QAbstractItemModel* self, QMimeData* data, int action, int row, int column, QModelIndex* parent);
bool QAbstractItemModel_DropMimeData(QAbstractItemModel* self, QMimeData* data, int action, int row, int column, QModelIndex* parent);
int QAbstractItemModel_SupportedDropActions(const QAbstractItemModel* self);
@ -119,8 +123,9 @@ bool QAbstractItemModel_CanFetchMore(const QAbstractItemModel* self, QModelIndex
int QAbstractItemModel_Flags(const QAbstractItemModel* self, QModelIndex* index);
void QAbstractItemModel_Sort(QAbstractItemModel* self, int column);
QModelIndex* QAbstractItemModel_Buddy(const QAbstractItemModel* self, QModelIndex* index);
struct miqt_array* QAbstractItemModel_Match(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value);
struct miqt_array QAbstractItemModel_Match(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value);
QSize* QAbstractItemModel_Span(const QAbstractItemModel* self, QModelIndex* index);
struct miqt_map QAbstractItemModel_RoleNames(const QAbstractItemModel* self);
bool QAbstractItemModel_CheckIndex(const QAbstractItemModel* self, QModelIndex* index);
void QAbstractItemModel_DataChanged(QAbstractItemModel* self, QModelIndex* topLeft, QModelIndex* bottomRight);
void QAbstractItemModel_connect_DataChanged(QAbstractItemModel* self, intptr_t slot);
@ -154,18 +159,18 @@ bool QAbstractItemModel_InsertColumn2(QAbstractItemModel* self, int column, QMod
bool QAbstractItemModel_RemoveRow2(QAbstractItemModel* self, int row, QModelIndex* parent);
bool QAbstractItemModel_RemoveColumn2(QAbstractItemModel* self, int column, QModelIndex* parent);
void QAbstractItemModel_Sort2(QAbstractItemModel* self, int column, int order);
struct miqt_array* QAbstractItemModel_Match4(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value, int hits);
struct miqt_array* QAbstractItemModel_Match5(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value, int hits, int flags);
struct miqt_array QAbstractItemModel_Match4(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value, int hits);
struct miqt_array QAbstractItemModel_Match5(const QAbstractItemModel* self, QModelIndex* start, int role, QVariant* value, int hits, int flags);
bool QAbstractItemModel_CheckIndex2(const QAbstractItemModel* self, QModelIndex* index, int options);
void QAbstractItemModel_DataChanged3(QAbstractItemModel* self, QModelIndex* topLeft, QModelIndex* bottomRight, struct miqt_array* /* of int */ roles);
void QAbstractItemModel_DataChanged3(QAbstractItemModel* self, QModelIndex* topLeft, QModelIndex* bottomRight, struct miqt_array /* of int */ roles);
void QAbstractItemModel_connect_DataChanged3(QAbstractItemModel* self, intptr_t slot);
void QAbstractItemModel_LayoutChanged1(QAbstractItemModel* self, struct miqt_array* /* of QPersistentModelIndex* */ parents);
void QAbstractItemModel_LayoutChanged1(QAbstractItemModel* self, struct miqt_array /* of QPersistentModelIndex* */ parents);
void QAbstractItemModel_connect_LayoutChanged1(QAbstractItemModel* self, intptr_t slot);
void QAbstractItemModel_LayoutChanged2(QAbstractItemModel* self, struct miqt_array* /* of QPersistentModelIndex* */ parents, int hint);
void QAbstractItemModel_LayoutChanged2(QAbstractItemModel* self, struct miqt_array /* of QPersistentModelIndex* */ parents, int hint);
void QAbstractItemModel_connect_LayoutChanged2(QAbstractItemModel* self, intptr_t slot);
void QAbstractItemModel_LayoutAboutToBeChanged1(QAbstractItemModel* self, struct miqt_array* /* of QPersistentModelIndex* */ parents);
void QAbstractItemModel_LayoutAboutToBeChanged1(QAbstractItemModel* self, struct miqt_array /* of QPersistentModelIndex* */ parents);
void QAbstractItemModel_connect_LayoutAboutToBeChanged1(QAbstractItemModel* self, intptr_t slot);
void QAbstractItemModel_LayoutAboutToBeChanged2(QAbstractItemModel* self, struct miqt_array* /* of QPersistentModelIndex* */ parents, int hint);
void QAbstractItemModel_LayoutAboutToBeChanged2(QAbstractItemModel* self, struct miqt_array /* of QPersistentModelIndex* */ parents, int hint);
void QAbstractItemModel_connect_LayoutAboutToBeChanged2(QAbstractItemModel* self, intptr_t slot);
void QAbstractItemModel_Delete(QAbstractItemModel* self);

View File

@ -1,6 +1,7 @@
#include <QAbstractItemModel>
#include <QAbstractProxyModel>
#include <QList>
#include <QMap>
#include <QMetaObject>
#include <QMimeData>
#include <QModelIndex>
@ -75,6 +76,24 @@ QVariant* QAbstractProxyModel_HeaderData(const QAbstractProxyModel* self, int se
return new QVariant(self->headerData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation)));
}
struct miqt_map QAbstractProxyModel_ItemData(const QAbstractProxyModel* self, QModelIndex* index) {
QMap<int, QVariant> _ret = self->itemData(*index);
// Convert QMap<> from C++ memory to manually-managed C memory
int* _karr = static_cast<int*>(malloc(sizeof(int) * _ret.size()));
QVariant** _varr = static_cast<QVariant**>(malloc(sizeof(QVariant*) * _ret.size()));
int _ctr = 0;
for (auto _itr = _ret.keyValueBegin(); _itr != _ret.keyValueEnd(); ++_itr) {
_karr[_ctr] = _itr->first;
_varr[_ctr] = new QVariant(_itr->second);
_ctr++;
}
struct miqt_map _out;
_out.len = _ret.size();
_out.keys = static_cast<void*>(_karr);
_out.values = static_cast<void*>(_varr);
return _out;
}
int QAbstractProxyModel_Flags(const QAbstractProxyModel* self, QModelIndex* index) {
Qt::ItemFlags _ret = self->flags(*index);
return static_cast<int>(_ret);
@ -84,6 +103,16 @@ bool QAbstractProxyModel_SetData(QAbstractProxyModel* self, QModelIndex* index,
return self->setData(*index, *value);
}
bool QAbstractProxyModel_SetItemData(QAbstractProxyModel* self, QModelIndex* index, struct miqt_map roles) {
QMap<int, QVariant> roles_QMap;
int* roles_karr = static_cast<int*>(roles.keys);
QVariant** roles_varr = static_cast<QVariant**>(roles.values);
for(size_t i = 0; i < roles.len; ++i) {
roles_QMap[static_cast<int>(roles_karr[i])] = *(roles_varr[i]);
}
return self->setItemData(*index, roles_QMap);
}
bool QAbstractProxyModel_SetHeaderData(QAbstractProxyModel* self, int section, int orientation, QVariant* value) {
return self->setHeaderData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation), *value);
}
@ -116,11 +145,11 @@ QModelIndex* QAbstractProxyModel_Sibling(const QAbstractProxyModel* self, int ro
return new QModelIndex(self->sibling(static_cast<int>(row), static_cast<int>(column), *idx));
}
QMimeData* QAbstractProxyModel_MimeData(const QAbstractProxyModel* self, struct miqt_array* /* of QModelIndex* */ indexes) {
QMimeData* QAbstractProxyModel_MimeData(const QAbstractProxyModel* self, struct miqt_array /* of QModelIndex* */ indexes) {
QModelIndexList indexes_QList;
indexes_QList.reserve(indexes->len);
QModelIndex** indexes_arr = static_cast<QModelIndex**>(indexes->data);
for(size_t i = 0; i < indexes->len; ++i) {
indexes_QList.reserve(indexes.len);
QModelIndex** indexes_arr = static_cast<QModelIndex**>(indexes.data);
for(size_t i = 0; i < indexes.len; ++i) {
indexes_QList.push_back(*(indexes_arr[i]));
}
return self->mimeData(indexes_QList);
@ -134,7 +163,7 @@ bool QAbstractProxyModel_DropMimeData(QAbstractProxyModel* self, QMimeData* data
return self->dropMimeData(data, static_cast<Qt::DropAction>(action), static_cast<int>(row), static_cast<int>(column), *parent);
}
struct miqt_array* QAbstractProxyModel_MimeTypes(const QAbstractProxyModel* self) {
struct miqt_array QAbstractProxyModel_MimeTypes(const QAbstractProxyModel* self) {
QStringList _ret = self->mimeTypes();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -148,9 +177,9 @@ struct miqt_array* QAbstractProxyModel_MimeTypes(const QAbstractProxyModel* self
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -115,6 +115,24 @@ func (this *QAbstractProxyModel) HeaderData(section int, orientation Orientation
return _goptr
}
func (this *QAbstractProxyModel) ItemData(index *QModelIndex) map[int]QVariant {
var _mm C.struct_miqt_map = C.QAbstractProxyModel_ItemData(this.h, index.cPointer())
_ret := make(map[int]QVariant, int(_mm.len))
_Keys := (*[0xffff]C.int)(unsafe.Pointer(_mm.keys))
_Values := (*[0xffff]*C.QVariant)(unsafe.Pointer(_mm.values))
for i := 0; i < int(_mm.len); i++ {
_entry_Key := (int)(_Keys[i])
_mapval_ret := _Values[i]
_mapval_goptr := newQVariant(_mapval_ret)
_mapval_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_entry_Value := *_mapval_goptr
_ret[_entry_Key] = _entry_Value
}
return _ret
}
func (this *QAbstractProxyModel) Flags(index *QModelIndex) ItemFlag {
return (ItemFlag)(C.QAbstractProxyModel_Flags(this.h, index.cPointer()))
}
@ -123,6 +141,25 @@ func (this *QAbstractProxyModel) SetData(index *QModelIndex, value *QVariant) bo
return (bool)(C.QAbstractProxyModel_SetData(this.h, index.cPointer(), value.cPointer()))
}
func (this *QAbstractProxyModel) SetItemData(index *QModelIndex, roles map[int]QVariant) bool {
roles_Keys_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(roles))))
defer C.free(unsafe.Pointer(roles_Keys_CArray))
roles_Values_CArray := (*[0xffff]*C.QVariant)(C.malloc(C.size_t(8 * len(roles))))
defer C.free(unsafe.Pointer(roles_Values_CArray))
roles_ctr := 0
for roles_k, roles_v := range roles {
roles_Keys_CArray[roles_ctr] = (C.int)(roles_k)
roles_Values_CArray[roles_ctr] = roles_v.cPointer()
roles_ctr++
}
roles_mm := C.struct_miqt_map{
len: C.size_t(len(roles)),
keys: unsafe.Pointer(roles_Keys_CArray),
values: unsafe.Pointer(roles_Values_CArray),
}
return (bool)(C.QAbstractProxyModel_SetItemData(this.h, index.cPointer(), roles_mm))
}
func (this *QAbstractProxyModel) SetHeaderData(section int, orientation Orientation, value *QVariant) bool {
return (bool)(C.QAbstractProxyModel_SetHeaderData(this.h, (C.int)(section), (C.int)(orientation), value.cPointer()))
}
@ -165,14 +202,12 @@ func (this *QAbstractProxyModel) Sibling(row int, column int, idx *QModelIndex)
}
func (this *QAbstractProxyModel) MimeData(indexes []QModelIndex) *QMimeData {
// For the C ABI, malloc a C array of raw pointers
indexes_CArray := (*[0xffff]*C.QModelIndex)(C.malloc(C.size_t(8 * len(indexes))))
defer C.free(unsafe.Pointer(indexes_CArray))
for i := range indexes {
indexes_CArray[i] = indexes[i].cPointer()
}
indexes_ma := &C.struct_miqt_array{len: C.size_t(len(indexes)), data: unsafe.Pointer(indexes_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(indexes_ma))
indexes_ma := C.struct_miqt_array{len: C.size_t(len(indexes)), data: unsafe.Pointer(indexes_CArray)}
return UnsafeNewQMimeData(unsafe.Pointer(C.QAbstractProxyModel_MimeData(this.h, indexes_ma)))
}
@ -185,7 +220,7 @@ func (this *QAbstractProxyModel) DropMimeData(data *QMimeData, action DropAction
}
func (this *QAbstractProxyModel) MimeTypes() []string {
var _ma *C.struct_miqt_array = C.QAbstractProxyModel_MimeTypes(this.h)
var _ma C.struct_miqt_array = C.QAbstractProxyModel_MimeTypes(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -194,7 +229,6 @@ func (this *QAbstractProxyModel) MimeTypes() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -43,8 +43,10 @@ bool QAbstractProxyModel_Submit(QAbstractProxyModel* self);
void QAbstractProxyModel_Revert(QAbstractProxyModel* self);
QVariant* QAbstractProxyModel_Data(const QAbstractProxyModel* self, QModelIndex* proxyIndex);
QVariant* QAbstractProxyModel_HeaderData(const QAbstractProxyModel* self, int section, int orientation);
struct miqt_map QAbstractProxyModel_ItemData(const QAbstractProxyModel* self, QModelIndex* index);
int QAbstractProxyModel_Flags(const QAbstractProxyModel* self, QModelIndex* index);
bool QAbstractProxyModel_SetData(QAbstractProxyModel* self, QModelIndex* index, QVariant* value);
bool QAbstractProxyModel_SetItemData(QAbstractProxyModel* self, QModelIndex* index, struct miqt_map roles);
bool QAbstractProxyModel_SetHeaderData(QAbstractProxyModel* self, int section, int orientation, QVariant* value);
QModelIndex* QAbstractProxyModel_Buddy(const QAbstractProxyModel* self, QModelIndex* index);
bool QAbstractProxyModel_CanFetchMore(const QAbstractProxyModel* self, QModelIndex* parent);
@ -53,10 +55,10 @@ void QAbstractProxyModel_Sort(QAbstractProxyModel* self, int column);
QSize* QAbstractProxyModel_Span(const QAbstractProxyModel* self, QModelIndex* index);
bool QAbstractProxyModel_HasChildren(const QAbstractProxyModel* self);
QModelIndex* QAbstractProxyModel_Sibling(const QAbstractProxyModel* self, int row, int column, QModelIndex* idx);
QMimeData* QAbstractProxyModel_MimeData(const QAbstractProxyModel* self, struct miqt_array* /* of QModelIndex* */ indexes);
QMimeData* QAbstractProxyModel_MimeData(const QAbstractProxyModel* self, struct miqt_array /* of QModelIndex* */ indexes);
bool QAbstractProxyModel_CanDropMimeData(const QAbstractProxyModel* self, QMimeData* data, int action, int row, int column, QModelIndex* parent);
bool QAbstractProxyModel_DropMimeData(QAbstractProxyModel* self, QMimeData* data, int action, int row, int column, QModelIndex* parent);
struct miqt_array* QAbstractProxyModel_MimeTypes(const QAbstractProxyModel* self);
struct miqt_array QAbstractProxyModel_MimeTypes(const QAbstractProxyModel* self);
int QAbstractProxyModel_SupportedDragActions(const QAbstractProxyModel* self);
int QAbstractProxyModel_SupportedDropActions(const QAbstractProxyModel* self);
struct miqt_string QAbstractProxyModel_Tr2(const char* s, const char* c);

View File

@ -95,16 +95,16 @@ void QAbstractScrollArea_AddScrollBarWidget(QAbstractScrollArea* self, QWidget*
self->addScrollBarWidget(widget, static_cast<Qt::Alignment>(alignment));
}
struct miqt_array* QAbstractScrollArea_ScrollBarWidgets(QAbstractScrollArea* self, int alignment) {
struct miqt_array QAbstractScrollArea_ScrollBarWidgets(QAbstractScrollArea* self, int alignment) {
QWidgetList _ret = self->scrollBarWidgets(static_cast<Qt::Alignment>(alignment));
// Convert QList<> from C++ memory to manually-managed C memory
QWidget** _arr = static_cast<QWidget**>(malloc(sizeof(QWidget*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -136,13 +136,12 @@ func (this *QAbstractScrollArea) AddScrollBarWidget(widget *QWidget, alignment A
}
func (this *QAbstractScrollArea) ScrollBarWidgets(alignment AlignmentFlag) []*QWidget {
var _ma *C.struct_miqt_array = C.QAbstractScrollArea_ScrollBarWidgets(this.h, (C.int)(alignment))
var _ma C.struct_miqt_array = C.QAbstractScrollArea_ScrollBarWidgets(this.h, (C.int)(alignment))
_ret := make([]*QWidget, int(_ma.len))
_outCast := (*[0xffff]*C.QWidget)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQWidget(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -44,7 +44,7 @@ void QAbstractScrollArea_SetHorizontalScrollBar(QAbstractScrollArea* self, QScro
QWidget* QAbstractScrollArea_CornerWidget(const QAbstractScrollArea* self);
void QAbstractScrollArea_SetCornerWidget(QAbstractScrollArea* self, QWidget* widget);
void QAbstractScrollArea_AddScrollBarWidget(QAbstractScrollArea* self, QWidget* widget, int alignment);
struct miqt_array* QAbstractScrollArea_ScrollBarWidgets(QAbstractScrollArea* self, int alignment);
struct miqt_array QAbstractScrollArea_ScrollBarWidgets(QAbstractScrollArea* self, int alignment);
QWidget* QAbstractScrollArea_Viewport(const QAbstractScrollArea* self);
void QAbstractScrollArea_SetViewport(QAbstractScrollArea* self, QWidget* widget);
QSize* QAbstractScrollArea_MaximumViewportSize(const QAbstractScrollArea* self);

View File

@ -54,24 +54,24 @@ void QAbstractTransition_SetTargetState(QAbstractTransition* self, QAbstractStat
self->setTargetState(target);
}
struct miqt_array* QAbstractTransition_TargetStates(const QAbstractTransition* self) {
struct miqt_array QAbstractTransition_TargetStates(const QAbstractTransition* self) {
QList<QAbstractState *> _ret = self->targetStates();
// Convert QList<> from C++ memory to manually-managed C memory
QAbstractState** _arr = static_cast<QAbstractState**>(malloc(sizeof(QAbstractState*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
void QAbstractTransition_SetTargetStates(QAbstractTransition* self, struct miqt_array* /* of QAbstractState* */ targets) {
void QAbstractTransition_SetTargetStates(QAbstractTransition* self, struct miqt_array /* of QAbstractState* */ targets) {
QList<QAbstractState *> targets_QList;
targets_QList.reserve(targets->len);
QAbstractState** targets_arr = static_cast<QAbstractState**>(targets->data);
for(size_t i = 0; i < targets->len; ++i) {
targets_QList.reserve(targets.len);
QAbstractState** targets_arr = static_cast<QAbstractState**>(targets.data);
for(size_t i = 0; i < targets.len; ++i) {
targets_QList.push_back(targets_arr[i]);
}
self->setTargetStates(targets_QList);
@ -98,16 +98,16 @@ void QAbstractTransition_RemoveAnimation(QAbstractTransition* self, QAbstractAni
self->removeAnimation(animation);
}
struct miqt_array* QAbstractTransition_Animations(const QAbstractTransition* self) {
struct miqt_array QAbstractTransition_Animations(const QAbstractTransition* self) {
QList<QAbstractAnimation *> _ret = self->animations();
// Convert QList<> from C++ memory to manually-managed C memory
QAbstractAnimation** _arr = static_cast<QAbstractAnimation**>(malloc(sizeof(QAbstractAnimation*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -91,25 +91,22 @@ func (this *QAbstractTransition) SetTargetState(target *QAbstractState) {
}
func (this *QAbstractTransition) TargetStates() []*QAbstractState {
var _ma *C.struct_miqt_array = C.QAbstractTransition_TargetStates(this.h)
var _ma C.struct_miqt_array = C.QAbstractTransition_TargetStates(this.h)
_ret := make([]*QAbstractState, int(_ma.len))
_outCast := (*[0xffff]*C.QAbstractState)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQAbstractState(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func (this *QAbstractTransition) SetTargetStates(targets []*QAbstractState) {
// For the C ABI, malloc a C array of raw pointers
targets_CArray := (*[0xffff]*C.QAbstractState)(C.malloc(C.size_t(8 * len(targets))))
defer C.free(unsafe.Pointer(targets_CArray))
for i := range targets {
targets_CArray[i] = targets[i].cPointer()
}
targets_ma := &C.struct_miqt_array{len: C.size_t(len(targets)), data: unsafe.Pointer(targets_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(targets_ma))
targets_ma := C.struct_miqt_array{len: C.size_t(len(targets)), data: unsafe.Pointer(targets_CArray)}
C.QAbstractTransition_SetTargetStates(this.h, targets_ma)
}
@ -134,13 +131,12 @@ func (this *QAbstractTransition) RemoveAnimation(animation *QAbstractAnimation)
}
func (this *QAbstractTransition) Animations() []*QAbstractAnimation {
var _ma *C.struct_miqt_array = C.QAbstractTransition_Animations(this.h)
var _ma C.struct_miqt_array = C.QAbstractTransition_Animations(this.h)
_ret := make([]*QAbstractAnimation, int(_ma.len))
_outCast := (*[0xffff]*C.QAbstractAnimation)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQAbstractAnimation(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -36,14 +36,14 @@ struct miqt_string QAbstractTransition_TrUtf8(const char* s);
QState* QAbstractTransition_SourceState(const QAbstractTransition* self);
QAbstractState* QAbstractTransition_TargetState(const QAbstractTransition* self);
void QAbstractTransition_SetTargetState(QAbstractTransition* self, QAbstractState* target);
struct miqt_array* QAbstractTransition_TargetStates(const QAbstractTransition* self);
void QAbstractTransition_SetTargetStates(QAbstractTransition* self, struct miqt_array* /* of QAbstractState* */ targets);
struct miqt_array QAbstractTransition_TargetStates(const QAbstractTransition* self);
void QAbstractTransition_SetTargetStates(QAbstractTransition* self, struct miqt_array /* of QAbstractState* */ targets);
int QAbstractTransition_TransitionType(const QAbstractTransition* self);
void QAbstractTransition_SetTransitionType(QAbstractTransition* self, int typeVal);
QStateMachine* QAbstractTransition_Machine(const QAbstractTransition* self);
void QAbstractTransition_AddAnimation(QAbstractTransition* self, QAbstractAnimation* animation);
void QAbstractTransition_RemoveAnimation(QAbstractTransition* self, QAbstractAnimation* animation);
struct miqt_array* QAbstractTransition_Animations(const QAbstractTransition* self);
struct miqt_array QAbstractTransition_Animations(const QAbstractTransition* self);
struct miqt_string QAbstractTransition_Tr2(const char* s, const char* c);
struct miqt_string QAbstractTransition_Tr3(const char* s, const char* c, int n);
struct miqt_string QAbstractTransition_TrUtf82(const char* s, const char* c);

View File

@ -357,29 +357,29 @@ bool QAccessibleTableCellInterface_IsSelected(const QAccessibleTableCellInterfac
return self->isSelected();
}
struct miqt_array* QAccessibleTableCellInterface_ColumnHeaderCells(const QAccessibleTableCellInterface* self) {
struct miqt_array QAccessibleTableCellInterface_ColumnHeaderCells(const QAccessibleTableCellInterface* self) {
QList<QAccessibleInterface *> _ret = self->columnHeaderCells();
// Convert QList<> from C++ memory to manually-managed C memory
QAccessibleInterface** _arr = static_cast<QAccessibleInterface**>(malloc(sizeof(QAccessibleInterface*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
struct miqt_array* QAccessibleTableCellInterface_RowHeaderCells(const QAccessibleTableCellInterface* self) {
struct miqt_array QAccessibleTableCellInterface_RowHeaderCells(const QAccessibleTableCellInterface* self) {
QList<QAccessibleInterface *> _ret = self->rowHeaderCells();
// Convert QList<> from C++ memory to manually-managed C memory
QAccessibleInterface** _arr = static_cast<QAccessibleInterface**>(malloc(sizeof(QAccessibleInterface*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -427,16 +427,16 @@ int QAccessibleTableInterface_SelectedCellCount(const QAccessibleTableInterface*
return self->selectedCellCount();
}
struct miqt_array* QAccessibleTableInterface_SelectedCells(const QAccessibleTableInterface* self) {
struct miqt_array QAccessibleTableInterface_SelectedCells(const QAccessibleTableInterface* self) {
QList<QAccessibleInterface *> _ret = self->selectedCells();
// Convert QList<> from C++ memory to manually-managed C memory
QAccessibleInterface** _arr = static_cast<QAccessibleInterface**>(malloc(sizeof(QAccessibleInterface*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -478,29 +478,29 @@ int QAccessibleTableInterface_RowCount(const QAccessibleTableInterface* self) {
return self->rowCount();
}
struct miqt_array* QAccessibleTableInterface_SelectedColumns(const QAccessibleTableInterface* self) {
struct miqt_array QAccessibleTableInterface_SelectedColumns(const QAccessibleTableInterface* self) {
QList<int> _ret = self->selectedColumns();
// Convert QList<> from C++ memory to manually-managed C memory
int* _arr = static_cast<int*>(malloc(sizeof(int) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
struct miqt_array* QAccessibleTableInterface_SelectedRows(const QAccessibleTableInterface* self) {
struct miqt_array QAccessibleTableInterface_SelectedRows(const QAccessibleTableInterface* self) {
QList<int> _ret = self->selectedRows();
// Convert QList<> from C++ memory to manually-managed C memory
int* _arr = static_cast<int*>(malloc(sizeof(int) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -558,7 +558,7 @@ struct miqt_string QAccessibleActionInterface_TrUtf8(const char* sourceText) {
return _ms;
}
struct miqt_array* QAccessibleActionInterface_ActionNames(const QAccessibleActionInterface* self) {
struct miqt_array QAccessibleActionInterface_ActionNames(const QAccessibleActionInterface* self) {
QStringList _ret = self->actionNames();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -572,9 +572,9 @@ struct miqt_array* QAccessibleActionInterface_ActionNames(const QAccessibleActio
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -607,7 +607,7 @@ void QAccessibleActionInterface_DoAction(QAccessibleActionInterface* self, struc
self->doAction(actionName_QString);
}
struct miqt_array* QAccessibleActionInterface_KeyBindingsForAction(const QAccessibleActionInterface* self, struct miqt_string actionName) {
struct miqt_array QAccessibleActionInterface_KeyBindingsForAction(const QAccessibleActionInterface* self, struct miqt_string actionName) {
QString actionName_QString = QString::fromUtf8(actionName.data, actionName.len);
QStringList _ret = self->keyBindingsForAction(actionName_QString);
// Convert QList<> from C++ memory to manually-managed C memory
@ -622,9 +622,9 @@ struct miqt_array* QAccessibleActionInterface_KeyBindingsForAction(const QAccess
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -773,24 +773,22 @@ func (this *QAccessibleTableCellInterface) IsSelected() bool {
}
func (this *QAccessibleTableCellInterface) ColumnHeaderCells() []*QAccessibleInterface {
var _ma *C.struct_miqt_array = C.QAccessibleTableCellInterface_ColumnHeaderCells(this.h)
var _ma C.struct_miqt_array = C.QAccessibleTableCellInterface_ColumnHeaderCells(this.h)
_ret := make([]*QAccessibleInterface, int(_ma.len))
_outCast := (*[0xffff]*C.QAccessibleInterface)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQAccessibleInterface(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func (this *QAccessibleTableCellInterface) RowHeaderCells() []*QAccessibleInterface {
var _ma *C.struct_miqt_array = C.QAccessibleTableCellInterface_RowHeaderCells(this.h)
var _ma C.struct_miqt_array = C.QAccessibleTableCellInterface_RowHeaderCells(this.h)
_ret := make([]*QAccessibleInterface, int(_ma.len))
_outCast := (*[0xffff]*C.QAccessibleInterface)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQAccessibleInterface(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -878,13 +876,12 @@ func (this *QAccessibleTableInterface) SelectedCellCount() int {
}
func (this *QAccessibleTableInterface) SelectedCells() []*QAccessibleInterface {
var _ma *C.struct_miqt_array = C.QAccessibleTableInterface_SelectedCells(this.h)
var _ma C.struct_miqt_array = C.QAccessibleTableInterface_SelectedCells(this.h)
_ret := make([]*QAccessibleInterface, int(_ma.len))
_outCast := (*[0xffff]*C.QAccessibleInterface)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQAccessibleInterface(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -919,24 +916,22 @@ func (this *QAccessibleTableInterface) RowCount() int {
}
func (this *QAccessibleTableInterface) SelectedColumns() []int {
var _ma *C.struct_miqt_array = C.QAccessibleTableInterface_SelectedColumns(this.h)
var _ma C.struct_miqt_array = C.QAccessibleTableInterface_SelectedColumns(this.h)
_ret := make([]int, int(_ma.len))
_outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = (int)(_outCast[i])
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func (this *QAccessibleTableInterface) SelectedRows() []int {
var _ma *C.struct_miqt_array = C.QAccessibleTableInterface_SelectedRows(this.h)
var _ma C.struct_miqt_array = C.QAccessibleTableInterface_SelectedRows(this.h)
_ret := make([]int, int(_ma.len))
_outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = (int)(_outCast[i])
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -1030,7 +1025,7 @@ func QAccessibleActionInterface_TrUtf8(sourceText string) string {
}
func (this *QAccessibleActionInterface) ActionNames() []string {
var _ma *C.struct_miqt_array = C.QAccessibleActionInterface_ActionNames(this.h)
var _ma C.struct_miqt_array = C.QAccessibleActionInterface_ActionNames(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -1039,7 +1034,6 @@ func (this *QAccessibleActionInterface) ActionNames() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -1078,7 +1072,7 @@ func (this *QAccessibleActionInterface) KeyBindingsForAction(actionName string)
actionName_ms.data = C.CString(actionName)
actionName_ms.len = C.size_t(len(actionName))
defer C.free(unsafe.Pointer(actionName_ms.data))
var _ma *C.struct_miqt_array = C.QAccessibleActionInterface_KeyBindingsForAction(this.h, actionName_ms)
var _ma C.struct_miqt_array = C.QAccessibleActionInterface_KeyBindingsForAction(this.h, actionName_ms)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -1087,7 +1081,6 @@ func (this *QAccessibleActionInterface) KeyBindingsForAction(actionName string)
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -153,8 +153,8 @@ void QAccessibleValueInterface_OperatorAssign(QAccessibleValueInterface* self, Q
void QAccessibleValueInterface_Delete(QAccessibleValueInterface* self);
bool QAccessibleTableCellInterface_IsSelected(const QAccessibleTableCellInterface* self);
struct miqt_array* QAccessibleTableCellInterface_ColumnHeaderCells(const QAccessibleTableCellInterface* self);
struct miqt_array* QAccessibleTableCellInterface_RowHeaderCells(const QAccessibleTableCellInterface* self);
struct miqt_array QAccessibleTableCellInterface_ColumnHeaderCells(const QAccessibleTableCellInterface* self);
struct miqt_array QAccessibleTableCellInterface_RowHeaderCells(const QAccessibleTableCellInterface* self);
int QAccessibleTableCellInterface_ColumnIndex(const QAccessibleTableCellInterface* self);
int QAccessibleTableCellInterface_RowIndex(const QAccessibleTableCellInterface* self);
int QAccessibleTableCellInterface_ColumnExtent(const QAccessibleTableCellInterface* self);
@ -167,15 +167,15 @@ QAccessibleInterface* QAccessibleTableInterface_Caption(const QAccessibleTableIn
QAccessibleInterface* QAccessibleTableInterface_Summary(const QAccessibleTableInterface* self);
QAccessibleInterface* QAccessibleTableInterface_CellAt(const QAccessibleTableInterface* self, int row, int column);
int QAccessibleTableInterface_SelectedCellCount(const QAccessibleTableInterface* self);
struct miqt_array* QAccessibleTableInterface_SelectedCells(const QAccessibleTableInterface* self);
struct miqt_array QAccessibleTableInterface_SelectedCells(const QAccessibleTableInterface* self);
struct miqt_string QAccessibleTableInterface_ColumnDescription(const QAccessibleTableInterface* self, int column);
struct miqt_string QAccessibleTableInterface_RowDescription(const QAccessibleTableInterface* self, int row);
int QAccessibleTableInterface_SelectedColumnCount(const QAccessibleTableInterface* self);
int QAccessibleTableInterface_SelectedRowCount(const QAccessibleTableInterface* self);
int QAccessibleTableInterface_ColumnCount(const QAccessibleTableInterface* self);
int QAccessibleTableInterface_RowCount(const QAccessibleTableInterface* self);
struct miqt_array* QAccessibleTableInterface_SelectedColumns(const QAccessibleTableInterface* self);
struct miqt_array* QAccessibleTableInterface_SelectedRows(const QAccessibleTableInterface* self);
struct miqt_array QAccessibleTableInterface_SelectedColumns(const QAccessibleTableInterface* self);
struct miqt_array QAccessibleTableInterface_SelectedRows(const QAccessibleTableInterface* self);
bool QAccessibleTableInterface_IsColumnSelected(const QAccessibleTableInterface* self, int column);
bool QAccessibleTableInterface_IsRowSelected(const QAccessibleTableInterface* self, int row);
bool QAccessibleTableInterface_SelectRow(QAccessibleTableInterface* self, int row);
@ -187,11 +187,11 @@ void QAccessibleTableInterface_Delete(QAccessibleTableInterface* self);
struct miqt_string QAccessibleActionInterface_Tr(const char* sourceText);
struct miqt_string QAccessibleActionInterface_TrUtf8(const char* sourceText);
struct miqt_array* QAccessibleActionInterface_ActionNames(const QAccessibleActionInterface* self);
struct miqt_array QAccessibleActionInterface_ActionNames(const QAccessibleActionInterface* self);
struct miqt_string QAccessibleActionInterface_LocalizedActionName(const QAccessibleActionInterface* self, struct miqt_string name);
struct miqt_string QAccessibleActionInterface_LocalizedActionDescription(const QAccessibleActionInterface* self, struct miqt_string name);
void QAccessibleActionInterface_DoAction(QAccessibleActionInterface* self, struct miqt_string actionName);
struct miqt_array* QAccessibleActionInterface_KeyBindingsForAction(const QAccessibleActionInterface* self, struct miqt_string actionName);
struct miqt_array QAccessibleActionInterface_KeyBindingsForAction(const QAccessibleActionInterface* self, struct miqt_string actionName);
struct miqt_string QAccessibleActionInterface_PressAction();
struct miqt_string QAccessibleActionInterface_IncreaseAction();
struct miqt_string QAccessibleActionInterface_DecreaseAction();

View File

@ -90,7 +90,7 @@ void* QAccessibleWidget_InterfaceCast(QAccessibleWidget* self, int t) {
return self->interface_cast(static_cast<QAccessible::InterfaceType>(t));
}
struct miqt_array* QAccessibleWidget_ActionNames(const QAccessibleWidget* self) {
struct miqt_array QAccessibleWidget_ActionNames(const QAccessibleWidget* self) {
QStringList _ret = self->actionNames();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -104,9 +104,9 @@ struct miqt_array* QAccessibleWidget_ActionNames(const QAccessibleWidget* self)
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -115,7 +115,7 @@ void QAccessibleWidget_DoAction(QAccessibleWidget* self, struct miqt_string acti
self->doAction(actionName_QString);
}
struct miqt_array* QAccessibleWidget_KeyBindingsForAction(const QAccessibleWidget* self, struct miqt_string actionName) {
struct miqt_array QAccessibleWidget_KeyBindingsForAction(const QAccessibleWidget* self, struct miqt_string actionName) {
QString actionName_QString = QString::fromUtf8(actionName.data, actionName.len);
QStringList _ret = self->keyBindingsForAction(actionName_QString);
// Convert QList<> from C++ memory to manually-managed C memory
@ -130,9 +130,9 @@ struct miqt_array* QAccessibleWidget_KeyBindingsForAction(const QAccessibleWidge
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -137,7 +137,7 @@ func (this *QAccessibleWidget) InterfaceCast(t QAccessible__InterfaceType) unsaf
}
func (this *QAccessibleWidget) ActionNames() []string {
var _ma *C.struct_miqt_array = C.QAccessibleWidget_ActionNames(this.h)
var _ma C.struct_miqt_array = C.QAccessibleWidget_ActionNames(this.h)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -146,7 +146,6 @@ func (this *QAccessibleWidget) ActionNames() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -163,7 +162,7 @@ func (this *QAccessibleWidget) KeyBindingsForAction(actionName string) []string
actionName_ms.data = C.CString(actionName)
actionName_ms.len = C.size_t(len(actionName))
defer C.free(unsafe.Pointer(actionName_ms.data))
var _ma *C.struct_miqt_array = C.QAccessibleWidget_KeyBindingsForAction(this.h, actionName_ms)
var _ma C.struct_miqt_array = C.QAccessibleWidget_KeyBindingsForAction(this.h, actionName_ms)
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -172,6 +171,5 @@ func (this *QAccessibleWidget) KeyBindingsForAction(actionName string) []string
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -52,9 +52,9 @@ QAccessible__State* QAccessibleWidget_State(const QAccessibleWidget* self);
QColor* QAccessibleWidget_ForegroundColor(const QAccessibleWidget* self);
QColor* QAccessibleWidget_BackgroundColor(const QAccessibleWidget* self);
void* QAccessibleWidget_InterfaceCast(QAccessibleWidget* self, int t);
struct miqt_array* QAccessibleWidget_ActionNames(const QAccessibleWidget* self);
struct miqt_array QAccessibleWidget_ActionNames(const QAccessibleWidget* self);
void QAccessibleWidget_DoAction(QAccessibleWidget* self, struct miqt_string actionName);
struct miqt_array* QAccessibleWidget_KeyBindingsForAction(const QAccessibleWidget* self, struct miqt_string actionName);
struct miqt_array QAccessibleWidget_KeyBindingsForAction(const QAccessibleWidget* self, struct miqt_string actionName);
#ifdef __cplusplus
} /* extern C */

View File

@ -204,11 +204,11 @@ QKeySequence* QAction_Shortcut(const QAction* self) {
return new QKeySequence(self->shortcut());
}
void QAction_SetShortcuts(QAction* self, struct miqt_array* /* of QKeySequence* */ shortcuts) {
void QAction_SetShortcuts(QAction* self, struct miqt_array /* of QKeySequence* */ shortcuts) {
QList<QKeySequence> shortcuts_QList;
shortcuts_QList.reserve(shortcuts->len);
QKeySequence** shortcuts_arr = static_cast<QKeySequence**>(shortcuts->data);
for(size_t i = 0; i < shortcuts->len; ++i) {
shortcuts_QList.reserve(shortcuts.len);
QKeySequence** shortcuts_arr = static_cast<QKeySequence**>(shortcuts.data);
for(size_t i = 0; i < shortcuts.len; ++i) {
shortcuts_QList.push_back(*(shortcuts_arr[i]));
}
self->setShortcuts(shortcuts_QList);
@ -218,16 +218,16 @@ void QAction_SetShortcutsWithShortcuts(QAction* self, int shortcuts) {
self->setShortcuts(static_cast<QKeySequence::StandardKey>(shortcuts));
}
struct miqt_array* QAction_Shortcuts(const QAction* self) {
struct miqt_array QAction_Shortcuts(const QAction* self) {
QList<QKeySequence> _ret = self->shortcuts();
// Convert QList<> from C++ memory to manually-managed C memory
QKeySequence** _arr = static_cast<QKeySequence**>(malloc(sizeof(QKeySequence*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QKeySequence(_ret[i]);
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -321,29 +321,29 @@ QWidget* QAction_ParentWidget(const QAction* self) {
return self->parentWidget();
}
struct miqt_array* QAction_AssociatedWidgets(const QAction* self) {
struct miqt_array QAction_AssociatedWidgets(const QAction* self) {
QList<QWidget *> _ret = self->associatedWidgets();
// Convert QList<> from C++ memory to manually-managed C memory
QWidget** _arr = static_cast<QWidget**>(malloc(sizeof(QWidget*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
struct miqt_array* QAction_AssociatedGraphicsWidgets(const QAction* self) {
struct miqt_array QAction_AssociatedGraphicsWidgets(const QAction* self) {
QList<QGraphicsWidget *> _ret = self->associatedGraphicsWidgets();
// Convert QList<> from C++ memory to manually-managed C memory
QGraphicsWidget** _arr = static_cast<QGraphicsWidget**>(malloc(sizeof(QGraphicsWidget*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -281,14 +281,12 @@ func (this *QAction) Shortcut() *QKeySequence {
}
func (this *QAction) SetShortcuts(shortcuts []QKeySequence) {
// For the C ABI, malloc a C array of raw pointers
shortcuts_CArray := (*[0xffff]*C.QKeySequence)(C.malloc(C.size_t(8 * len(shortcuts))))
defer C.free(unsafe.Pointer(shortcuts_CArray))
for i := range shortcuts {
shortcuts_CArray[i] = shortcuts[i].cPointer()
}
shortcuts_ma := &C.struct_miqt_array{len: C.size_t(len(shortcuts)), data: unsafe.Pointer(shortcuts_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(shortcuts_ma))
shortcuts_ma := C.struct_miqt_array{len: C.size_t(len(shortcuts)), data: unsafe.Pointer(shortcuts_CArray)}
C.QAction_SetShortcuts(this.h, shortcuts_ma)
}
@ -297,7 +295,7 @@ func (this *QAction) SetShortcutsWithShortcuts(shortcuts QKeySequence__StandardK
}
func (this *QAction) Shortcuts() []QKeySequence {
var _ma *C.struct_miqt_array = C.QAction_Shortcuts(this.h)
var _ma C.struct_miqt_array = C.QAction_Shortcuts(this.h)
_ret := make([]QKeySequence, int(_ma.len))
_outCast := (*[0xffff]*C.QKeySequence)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -306,7 +304,6 @@ func (this *QAction) Shortcuts() []QKeySequence {
_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_lv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -405,24 +402,22 @@ func (this *QAction) ParentWidget() *QWidget {
}
func (this *QAction) AssociatedWidgets() []*QWidget {
var _ma *C.struct_miqt_array = C.QAction_AssociatedWidgets(this.h)
var _ma C.struct_miqt_array = C.QAction_AssociatedWidgets(this.h)
_ret := make([]*QWidget, int(_ma.len))
_outCast := (*[0xffff]*C.QWidget)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQWidget(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func (this *QAction) AssociatedGraphicsWidgets() []*QGraphicsWidget {
var _ma *C.struct_miqt_array = C.QAction_AssociatedGraphicsWidgets(this.h)
var _ma C.struct_miqt_array = C.QAction_AssociatedGraphicsWidgets(this.h)
_ret := make([]*QGraphicsWidget, int(_ma.len))
_outCast := (*[0xffff]*C.QGraphicsWidget)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQGraphicsWidget(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -71,9 +71,9 @@ void QAction_SetSeparator(QAction* self, bool b);
bool QAction_IsSeparator(const QAction* self);
void QAction_SetShortcut(QAction* self, QKeySequence* shortcut);
QKeySequence* QAction_Shortcut(const QAction* self);
void QAction_SetShortcuts(QAction* self, struct miqt_array* /* of QKeySequence* */ shortcuts);
void QAction_SetShortcuts(QAction* self, struct miqt_array /* of QKeySequence* */ shortcuts);
void QAction_SetShortcutsWithShortcuts(QAction* self, int shortcuts);
struct miqt_array* QAction_Shortcuts(const QAction* self);
struct miqt_array QAction_Shortcuts(const QAction* self);
void QAction_SetShortcutContext(QAction* self, int context);
int QAction_ShortcutContext(const QAction* self);
void QAction_SetAutoRepeat(QAction* self, bool autoRepeat);
@ -96,8 +96,8 @@ bool QAction_IsIconVisibleInMenu(const QAction* self);
void QAction_SetShortcutVisibleInContextMenu(QAction* self, bool show);
bool QAction_IsShortcutVisibleInContextMenu(const QAction* self);
QWidget* QAction_ParentWidget(const QAction* self);
struct miqt_array* QAction_AssociatedWidgets(const QAction* self);
struct miqt_array* QAction_AssociatedGraphicsWidgets(const QAction* self);
struct miqt_array QAction_AssociatedWidgets(const QAction* self);
struct miqt_array QAction_AssociatedGraphicsWidgets(const QAction* self);
void QAction_Trigger(QAction* self);
void QAction_Hover(QAction* self);
void QAction_SetChecked(QAction* self, bool checked);

View File

@ -63,16 +63,16 @@ void QActionGroup_RemoveAction(QActionGroup* self, QAction* a) {
self->removeAction(a);
}
struct miqt_array* QActionGroup_Actions(const QActionGroup* self) {
struct miqt_array QActionGroup_Actions(const QActionGroup* self) {
QList<QAction *> _ret = self->actions();
// Convert QList<> from C++ memory to manually-managed C memory
QAction** _arr = static_cast<QAction**>(malloc(sizeof(QAction*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -111,13 +111,12 @@ func (this *QActionGroup) RemoveAction(a *QAction) {
}
func (this *QActionGroup) Actions() []*QAction {
var _ma *C.struct_miqt_array = C.QActionGroup_Actions(this.h)
var _ma C.struct_miqt_array = C.QActionGroup_Actions(this.h)
_ret := make([]*QAction, int(_ma.len))
_outCast := (*[0xffff]*C.QAction)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQAction(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -36,7 +36,7 @@ QAction* QActionGroup_AddAction(QActionGroup* self, QAction* a);
QAction* QActionGroup_AddActionWithText(QActionGroup* self, struct miqt_string text);
QAction* QActionGroup_AddAction2(QActionGroup* self, QIcon* icon, struct miqt_string text);
void QActionGroup_RemoveAction(QActionGroup* self, QAction* a);
struct miqt_array* QActionGroup_Actions(const QActionGroup* self);
struct miqt_array QActionGroup_Actions(const QActionGroup* self);
QAction* QActionGroup_CheckedAction(const QActionGroup* self);
bool QActionGroup_IsExclusive(const QActionGroup* self);
bool QActionGroup_IsEnabled(const QActionGroup* self);

View File

@ -118,29 +118,29 @@ QIcon* QApplication_WindowIcon() {
return new QIcon(QApplication::windowIcon());
}
struct miqt_array* QApplication_AllWidgets() {
struct miqt_array QApplication_AllWidgets() {
QWidgetList _ret = QApplication::allWidgets();
// Convert QList<> from C++ memory to manually-managed C memory
QWidget** _arr = static_cast<QWidget**>(malloc(sizeof(QWidget*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
struct miqt_array* QApplication_TopLevelWidgets() {
struct miqt_array QApplication_TopLevelWidgets() {
QWidgetList _ret = QApplication::topLevelWidgets();
// Convert QList<> from C++ memory to manually-managed C memory
QWidget** _arr = static_cast<QWidget**>(malloc(sizeof(QWidget*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -196,24 +196,22 @@ func QApplication_WindowIcon() *QIcon {
}
func QApplication_AllWidgets() []*QWidget {
var _ma *C.struct_miqt_array = C.QApplication_AllWidgets()
var _ma C.struct_miqt_array = C.QApplication_AllWidgets()
_ret := make([]*QWidget, int(_ma.len))
_outCast := (*[0xffff]*C.QWidget)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQWidget(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}
func QApplication_TopLevelWidgets() []*QWidget {
var _ma *C.struct_miqt_array = C.QApplication_TopLevelWidgets()
var _ma C.struct_miqt_array = C.QApplication_TopLevelWidgets()
_ret := make([]*QWidget, int(_ma.len))
_outCast := (*[0xffff]*C.QWidget)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQWidget(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -64,8 +64,8 @@ void QApplication_SetFont(QFont* param1);
QFontMetrics* QApplication_FontMetrics();
void QApplication_SetWindowIcon(QIcon* icon);
QIcon* QApplication_WindowIcon();
struct miqt_array* QApplication_AllWidgets();
struct miqt_array* QApplication_TopLevelWidgets();
struct miqt_array QApplication_AllWidgets();
struct miqt_array QApplication_TopLevelWidgets();
QDesktopWidget* QApplication_Desktop();
QWidget* QApplication_ActivePopupWidget();
QWidget* QApplication_ActiveModalWidget();

View File

@ -64,16 +64,16 @@ void QButtonGroup_RemoveButton(QButtonGroup* self, QAbstractButton* param1) {
self->removeButton(param1);
}
struct miqt_array* QButtonGroup_Buttons(const QButtonGroup* self) {
struct miqt_array QButtonGroup_Buttons(const QButtonGroup* self) {
QList<QAbstractButton *> _ret = self->buttons();
// Convert QList<> from C++ memory to manually-managed C memory
QAbstractButton** _arr = static_cast<QAbstractButton**>(malloc(sizeof(QAbstractButton*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -101,13 +101,12 @@ func (this *QButtonGroup) RemoveButton(param1 *QAbstractButton) {
}
func (this *QButtonGroup) Buttons() []*QAbstractButton {
var _ma *C.struct_miqt_array = C.QButtonGroup_Buttons(this.h)
var _ma C.struct_miqt_array = C.QButtonGroup_Buttons(this.h)
_ret := make([]*QAbstractButton, int(_ma.len))
_outCast := (*[0xffff]*C.QAbstractButton)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = UnsafeNewQAbstractButton(unsafe.Pointer(_outCast[i]))
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -35,7 +35,7 @@ void QButtonGroup_SetExclusive(QButtonGroup* self, bool exclusive);
bool QButtonGroup_Exclusive(const QButtonGroup* self);
void QButtonGroup_AddButton(QButtonGroup* self, QAbstractButton* param1);
void QButtonGroup_RemoveButton(QButtonGroup* self, QAbstractButton* param1);
struct miqt_array* QButtonGroup_Buttons(const QButtonGroup* self);
struct miqt_array QButtonGroup_Buttons(const QButtonGroup* self);
QAbstractButton* QButtonGroup_CheckedButton(const QButtonGroup* self);
QAbstractButton* QButtonGroup_Button(const QButtonGroup* self, int id);
void QButtonGroup_SetId(QButtonGroup* self, QAbstractButton* button, int id);

View File

@ -149,7 +149,7 @@ struct miqt_string QCalendar_StandaloneWeekDayName(const QCalendar* self, QLocal
return _ms;
}
struct miqt_array* QCalendar_AvailableCalendars() {
struct miqt_array QCalendar_AvailableCalendars() {
QStringList _ret = QCalendar::availableCalendars();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -163,9 +163,9 @@ struct miqt_array* QCalendar_AvailableCalendars() {
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -193,7 +193,7 @@ func (this *QCalendar) StandaloneWeekDayName(locale *QLocale, day int) string {
}
func QCalendar_AvailableCalendars() []string {
var _ma *C.struct_miqt_array = C.QCalendar_AvailableCalendars()
var _ma C.struct_miqt_array = C.QCalendar_AvailableCalendars()
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -202,7 +202,6 @@ func QCalendar_AvailableCalendars() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -55,7 +55,7 @@ struct miqt_string QCalendar_MonthName(const QCalendar* self, QLocale* locale, i
struct miqt_string QCalendar_StandaloneMonthName(const QCalendar* self, QLocale* locale, int month);
struct miqt_string QCalendar_WeekDayName(const QCalendar* self, QLocale* locale, int day);
struct miqt_string QCalendar_StandaloneWeekDayName(const QCalendar* self, QLocale* locale, int day);
struct miqt_array* QCalendar_AvailableCalendars();
struct miqt_array QCalendar_AvailableCalendars();
int QCalendar_DaysInMonth2(const QCalendar* self, int month, int year);
struct miqt_string QCalendar_MonthName3(const QCalendar* self, QLocale* locale, int month, int year);
struct miqt_string QCalendar_MonthName4(const QCalendar* self, QLocale* locale, int month, int year, int format);

View File

@ -1,6 +1,7 @@
#include <QCalendar>
#include <QCalendarWidget>
#include <QDate>
#include <QMap>
#include <QMetaObject>
#include <QSize>
#include <QString>
@ -154,6 +155,24 @@ void QCalendarWidget_SetWeekdayTextFormat(QCalendarWidget* self, int dayOfWeek,
self->setWeekdayTextFormat(static_cast<Qt::DayOfWeek>(dayOfWeek), *format);
}
struct miqt_map QCalendarWidget_DateTextFormat(const QCalendarWidget* self) {
QMap<QDate, QTextCharFormat> _ret = self->dateTextFormat();
// Convert QMap<> from C++ memory to manually-managed C memory
QDate** _karr = static_cast<QDate**>(malloc(sizeof(QDate*) * _ret.size()));
QTextCharFormat** _varr = static_cast<QTextCharFormat**>(malloc(sizeof(QTextCharFormat*) * _ret.size()));
int _ctr = 0;
for (auto _itr = _ret.keyValueBegin(); _itr != _ret.keyValueEnd(); ++_itr) {
_karr[_ctr] = new QDate(_itr->first);
_varr[_ctr] = new QTextCharFormat(_itr->second);
_ctr++;
}
struct miqt_map _out;
_out.len = _ret.size();
_out.keys = static_cast<void*>(_karr);
_out.values = static_cast<void*>(_varr);
return _out;
}
QTextCharFormat* QCalendarWidget_DateTextFormatWithDate(const QCalendarWidget* self, QDate* date) {
return new QTextCharFormat(self->dateTextFormat(*date));
}

View File

@ -231,6 +231,27 @@ func (this *QCalendarWidget) SetWeekdayTextFormat(dayOfWeek DayOfWeek, format *Q
C.QCalendarWidget_SetWeekdayTextFormat(this.h, (C.int)(dayOfWeek), format.cPointer())
}
func (this *QCalendarWidget) DateTextFormat() map[QDate]QTextCharFormat {
var _mm C.struct_miqt_map = C.QCalendarWidget_DateTextFormat(this.h)
_ret := make(map[QDate]QTextCharFormat, int(_mm.len))
_Keys := (*[0xffff]*C.QDate)(unsafe.Pointer(_mm.keys))
_Values := (*[0xffff]*C.QTextCharFormat)(unsafe.Pointer(_mm.values))
for i := 0; i < int(_mm.len); i++ {
_mapkey_ret := _Keys[i]
_mapkey_goptr := newQDate(_mapkey_ret)
_mapkey_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_entry_Key := *_mapkey_goptr
_mapval_ret := _Values[i]
_mapval_goptr := newQTextCharFormat(_mapval_ret)
_mapval_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_entry_Value := *_mapval_goptr
_ret[_entry_Key] = _entry_Value
}
return _ret
}
func (this *QCalendarWidget) DateTextFormatWithDate(date *QDate) *QTextCharFormat {
_ret := C.QCalendarWidget_DateTextFormatWithDate(this.h, date.cPointer())
_goptr := newQTextCharFormat(_ret)

View File

@ -62,6 +62,7 @@ QTextCharFormat* QCalendarWidget_HeaderTextFormat(const QCalendarWidget* self);
void QCalendarWidget_SetHeaderTextFormat(QCalendarWidget* self, QTextCharFormat* format);
QTextCharFormat* QCalendarWidget_WeekdayTextFormat(const QCalendarWidget* self, int dayOfWeek);
void QCalendarWidget_SetWeekdayTextFormat(QCalendarWidget* self, int dayOfWeek, QTextCharFormat* format);
struct miqt_map QCalendarWidget_DateTextFormat(const QCalendarWidget* self);
QTextCharFormat* QCalendarWidget_DateTextFormatWithDate(const QCalendarWidget* self, QDate* date);
void QCalendarWidget_SetDateTextFormat(QCalendarWidget* self, QDate* date, QTextCharFormat* format);
bool QCalendarWidget_IsDateEditEnabled(const QCalendarWidget* self);

View File

@ -221,11 +221,11 @@ QCborArray* QCborArray_OperatorShiftLeft(QCborArray* self, QCborValue* v) {
return &_ret;
}
QCborArray* QCborArray_FromStringList(struct miqt_array* /* of struct miqt_string */ list) {
QCborArray* QCborArray_FromStringList(struct miqt_array /* of struct miqt_string */ list) {
QStringList list_QList;
list_QList.reserve(list->len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list->data);
for(size_t i = 0; i < list->len; ++i) {
list_QList.reserve(list.len);
struct miqt_string* list_arr = static_cast<struct miqt_string*>(list.data);
for(size_t i = 0; i < list.len; ++i) {
QString list_arr_i_QString = QString::fromUtf8(list_arr[i].data, list_arr[i].len);
list_QList.push_back(list_arr_i_QString);
}

View File

@ -329,7 +329,6 @@ func (this *QCborArray) OperatorShiftLeft(v *QCborValue) *QCborArray {
}
func QCborArray_FromStringList(list []string) *QCborArray {
// For the C ABI, malloc a C array of structs
list_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(list))))
defer C.free(unsafe.Pointer(list_CArray))
for i := range list {
@ -339,8 +338,7 @@ func QCborArray_FromStringList(list []string) *QCborArray {
defer C.free(unsafe.Pointer(list_i_ms.data))
list_CArray[i] = list_i_ms
}
list_ma := &C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(list_ma))
list_ma := C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
_ret := C.QCborArray_FromStringList(list_ma)
_goptr := newQCborArray(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer

View File

@ -88,7 +88,7 @@ bool QCborArray_Empty(const QCborArray* self);
QCborArray* QCborArray_OperatorPlus(const QCborArray* self, QCborValue* v);
QCborArray* QCborArray_OperatorPlusAssign(QCborArray* self, QCborValue* v);
QCborArray* QCborArray_OperatorShiftLeft(QCborArray* self, QCborValue* v);
QCborArray* QCborArray_FromStringList(struct miqt_array* /* of struct miqt_string */ list);
QCborArray* QCborArray_FromStringList(struct miqt_array /* of struct miqt_string */ list);
QCborArray* QCborArray_FromJsonArray(QJsonArray* array);
QJsonArray* QCborArray_ToJsonArray(const QCborArray* self);
void QCborArray_Delete(QCborArray* self);

View File

@ -5,9 +5,11 @@
#include <QCborValueRef>
#include <QJsonObject>
#include <QList>
#include <QMap>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <QVariant>
#include <qcbormap.h>
#include "gen_qcbormap.h"
#include "_cgo_export.h"
@ -45,16 +47,16 @@ void QCborMap_Clear(QCborMap* self) {
self->clear();
}
struct miqt_array* QCborMap_Keys(const QCborMap* self) {
struct miqt_array QCborMap_Keys(const QCborMap* self) {
QVector<QCborValue> _ret = self->keys();
// Convert QList<> from C++ memory to manually-managed C memory
QCborValue** _arr = static_cast<QCborValue**>(malloc(sizeof(QCborValue*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QCborValue(_ret[i]);
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
@ -256,10 +258,83 @@ QCborMap__Iterator* QCborMap_Insert4(QCborMap* self, QCborValue* key, QCborValue
return new QCborMap::Iterator(self->insert(*key, *value_));
}
QCborMap* QCborMap_FromVariantMap(struct miqt_map mapVal) {
QVariantMap mapVal_QMap;
struct miqt_string* mapVal_karr = static_cast<struct miqt_string*>(mapVal.keys);
QVariant** mapVal_varr = static_cast<QVariant**>(mapVal.values);
for(size_t i = 0; i < mapVal.len; ++i) {
QString mapVal_karr_i_QString = QString::fromUtf8(mapVal_karr[i].data, mapVal_karr[i].len);
mapVal_QMap[mapVal_karr_i_QString] = *(mapVal_varr[i]);
}
return new QCborMap(QCborMap::fromVariantMap(mapVal_QMap));
}
QCborMap* QCborMap_FromVariantHash(struct miqt_map hash) {
QVariantHash hash_QMap;
hash_QMap.reserve(hash.len);
struct miqt_string* hash_karr = static_cast<struct miqt_string*>(hash.keys);
QVariant** hash_varr = static_cast<QVariant**>(hash.values);
for(size_t i = 0; i < hash.len; ++i) {
QString hash_karr_i_QString = QString::fromUtf8(hash_karr[i].data, hash_karr[i].len);
hash_QMap[hash_karr_i_QString] = *(hash_varr[i]);
}
return new QCborMap(QCborMap::fromVariantHash(hash_QMap));
}
QCborMap* QCborMap_FromJsonObject(QJsonObject* o) {
return new QCborMap(QCborMap::fromJsonObject(*o));
}
struct miqt_map QCborMap_ToVariantMap(const QCborMap* self) {
QVariantMap _ret = self->toVariantMap();
// Convert QMap<> from C++ memory to manually-managed C memory
struct miqt_string* _karr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.size()));
QVariant** _varr = static_cast<QVariant**>(malloc(sizeof(QVariant*) * _ret.size()));
int _ctr = 0;
for (auto _itr = _ret.keyValueBegin(); _itr != _ret.keyValueEnd(); ++_itr) {
QString _mapkey_ret = _itr->first;
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _mapkey_b = _mapkey_ret.toUtf8();
struct miqt_string _mapkey_ms;
_mapkey_ms.len = _mapkey_b.length();
_mapkey_ms.data = static_cast<char*>(malloc(_mapkey_ms.len));
memcpy(_mapkey_ms.data, _mapkey_b.data(), _mapkey_ms.len);
_karr[_ctr] = _mapkey_ms;
_varr[_ctr] = new QVariant(_itr->second);
_ctr++;
}
struct miqt_map _out;
_out.len = _ret.size();
_out.keys = static_cast<void*>(_karr);
_out.values = static_cast<void*>(_varr);
return _out;
}
struct miqt_map QCborMap_ToVariantHash(const QCborMap* self) {
QVariantHash _ret = self->toVariantHash();
// Convert QMap<> from C++ memory to manually-managed C memory
struct miqt_string* _karr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.size()));
QVariant** _varr = static_cast<QVariant**>(malloc(sizeof(QVariant*) * _ret.size()));
int _ctr = 0;
for (auto _itr = _ret.keyValueBegin(); _itr != _ret.keyValueEnd(); ++_itr) {
QString _hashkey_ret = _itr->first;
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _hashkey_b = _hashkey_ret.toUtf8();
struct miqt_string _hashkey_ms;
_hashkey_ms.len = _hashkey_b.length();
_hashkey_ms.data = static_cast<char*>(malloc(_hashkey_ms.len));
memcpy(_hashkey_ms.data, _hashkey_b.data(), _hashkey_ms.len);
_karr[_ctr] = _hashkey_ms;
_varr[_ctr] = new QVariant(_itr->second);
_ctr++;
}
struct miqt_map _out;
_out.len = _ret.size();
_out.keys = static_cast<void*>(_karr);
_out.values = static_cast<void*>(_varr);
return _out;
}
QJsonObject* QCborMap_ToJsonObject(const QCborMap* self) {
return new QJsonObject(self->toJsonObject());
}

View File

@ -82,7 +82,7 @@ func (this *QCborMap) Clear() {
}
func (this *QCborMap) Keys() []QCborValue {
var _ma *C.struct_miqt_array = C.QCborMap_Keys(this.h)
var _ma C.struct_miqt_array = C.QCborMap_Keys(this.h)
_ret := make([]QCborValue, int(_ma.len))
_outCast := (*[0xffff]*C.QCborValue)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -91,7 +91,6 @@ func (this *QCborMap) Keys() []QCborValue {
_vv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_vv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}
@ -431,6 +430,58 @@ func (this *QCborMap) Insert4(key *QCborValue, value_ *QCborValue) *QCborMap__It
return _goptr
}
func QCborMap_FromVariantMap(mapVal map[string]QVariant) *QCborMap {
mapVal_Keys_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(mapVal))))
defer C.free(unsafe.Pointer(mapVal_Keys_CArray))
mapVal_Values_CArray := (*[0xffff]*C.QVariant)(C.malloc(C.size_t(8 * len(mapVal))))
defer C.free(unsafe.Pointer(mapVal_Values_CArray))
mapVal_ctr := 0
for mapVal_k, mapVal_v := range mapVal {
mapVal_k_ms := C.struct_miqt_string{}
mapVal_k_ms.data = C.CString(mapVal_k)
mapVal_k_ms.len = C.size_t(len(mapVal_k))
defer C.free(unsafe.Pointer(mapVal_k_ms.data))
mapVal_Keys_CArray[mapVal_ctr] = mapVal_k_ms
mapVal_Values_CArray[mapVal_ctr] = mapVal_v.cPointer()
mapVal_ctr++
}
mapVal_mm := C.struct_miqt_map{
len: C.size_t(len(mapVal)),
keys: unsafe.Pointer(mapVal_Keys_CArray),
values: unsafe.Pointer(mapVal_Values_CArray),
}
_ret := C.QCborMap_FromVariantMap(mapVal_mm)
_goptr := newQCborMap(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QCborMap_FromVariantHash(hash map[string]QVariant) *QCborMap {
hash_Keys_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(hash))))
defer C.free(unsafe.Pointer(hash_Keys_CArray))
hash_Values_CArray := (*[0xffff]*C.QVariant)(C.malloc(C.size_t(8 * len(hash))))
defer C.free(unsafe.Pointer(hash_Values_CArray))
hash_ctr := 0
for hash_k, hash_v := range hash {
hash_k_ms := C.struct_miqt_string{}
hash_k_ms.data = C.CString(hash_k)
hash_k_ms.len = C.size_t(len(hash_k))
defer C.free(unsafe.Pointer(hash_k_ms.data))
hash_Keys_CArray[hash_ctr] = hash_k_ms
hash_Values_CArray[hash_ctr] = hash_v.cPointer()
hash_ctr++
}
hash_mm := C.struct_miqt_map{
len: C.size_t(len(hash)),
keys: unsafe.Pointer(hash_Keys_CArray),
values: unsafe.Pointer(hash_Values_CArray),
}
_ret := C.QCborMap_FromVariantHash(hash_mm)
_goptr := newQCborMap(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QCborMap_FromJsonObject(o *QJsonObject) *QCborMap {
_ret := C.QCborMap_FromJsonObject(o.cPointer())
_goptr := newQCborMap(_ret)
@ -438,6 +489,46 @@ func QCborMap_FromJsonObject(o *QJsonObject) *QCborMap {
return _goptr
}
func (this *QCborMap) ToVariantMap() map[string]QVariant {
var _mm C.struct_miqt_map = C.QCborMap_ToVariantMap(this.h)
_ret := make(map[string]QVariant, int(_mm.len))
_Keys := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_mm.keys))
_Values := (*[0xffff]*C.QVariant)(unsafe.Pointer(_mm.values))
for i := 0; i < int(_mm.len); i++ {
var _mapkey_ms C.struct_miqt_string = _Keys[i]
_mapkey_ret := C.GoStringN(_mapkey_ms.data, C.int(int64(_mapkey_ms.len)))
C.free(unsafe.Pointer(_mapkey_ms.data))
_entry_Key := _mapkey_ret
_mapval_ret := _Values[i]
_mapval_goptr := newQVariant(_mapval_ret)
_mapval_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_entry_Value := *_mapval_goptr
_ret[_entry_Key] = _entry_Value
}
return _ret
}
func (this *QCborMap) ToVariantHash() map[string]QVariant {
var _mm C.struct_miqt_map = C.QCborMap_ToVariantHash(this.h)
_ret := make(map[string]QVariant, int(_mm.len))
_Keys := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_mm.keys))
_Values := (*[0xffff]*C.QVariant)(unsafe.Pointer(_mm.values))
for i := 0; i < int(_mm.len); i++ {
var _hashkey_ms C.struct_miqt_string = _Keys[i]
_hashkey_ret := C.GoStringN(_hashkey_ms.data, C.int(int64(_hashkey_ms.len)))
C.free(unsafe.Pointer(_hashkey_ms.data))
_entry_Key := _hashkey_ret
_hashval_ret := _Values[i]
_hashval_goptr := newQVariant(_hashval_ret)
_hashval_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_entry_Value := *_hashval_goptr
_ret[_entry_Key] = _entry_Value
}
return _ret
}
func (this *QCborMap) ToJsonObject() *QJsonObject {
_ret := C.QCborMap_ToJsonObject(this.h)
_goptr := newQJsonObject(_ret)

View File

@ -28,6 +28,7 @@ class QCborMap__Iterator;
class QCborValue;
class QCborValueRef;
class QJsonObject;
class QVariant;
#else
typedef struct QCborMap QCborMap;
typedef struct QCborMap__ConstIterator QCborMap__ConstIterator;
@ -35,6 +36,7 @@ typedef struct QCborMap__Iterator QCborMap__Iterator;
typedef struct QCborValue QCborValue;
typedef struct QCborValueRef QCborValueRef;
typedef struct QJsonObject QJsonObject;
typedef struct QVariant QVariant;
#endif
QCborMap* QCborMap_new();
@ -45,7 +47,7 @@ QCborValue* QCborMap_ToCborValue(const QCborMap* self);
ptrdiff_t QCborMap_Size(const QCborMap* self);
bool QCborMap_IsEmpty(const QCborMap* self);
void QCborMap_Clear(QCborMap* self);
struct miqt_array* QCborMap_Keys(const QCborMap* self);
struct miqt_array QCborMap_Keys(const QCborMap* self);
QCborValue* QCborMap_Value(const QCborMap* self, long long key);
QCborValue* QCborMap_Value2(const QCborMap* self, struct miqt_string key);
QCborValue* QCborMap_Value3(const QCborMap* self, QCborValue* key);
@ -93,7 +95,11 @@ QCborMap__ConstIterator* QCborMap_Find7(const QCborMap* self, QCborValue* key);
QCborMap__Iterator* QCborMap_Insert(QCborMap* self, long long key, QCborValue* value_);
QCborMap__Iterator* QCborMap_Insert3(QCborMap* self, struct miqt_string key, QCborValue* value_);
QCborMap__Iterator* QCborMap_Insert4(QCborMap* self, QCborValue* key, QCborValue* value_);
QCborMap* QCborMap_FromVariantMap(struct miqt_map mapVal);
QCborMap* QCborMap_FromVariantHash(struct miqt_map hash);
QCborMap* QCborMap_FromJsonObject(QJsonObject* o);
struct miqt_map QCborMap_ToVariantMap(const QCborMap* self);
struct miqt_map QCborMap_ToVariantHash(const QCborMap* self);
QJsonObject* QCborMap_ToJsonObject(const QCborMap* self);
void QCborMap_Delete(QCborMap* self);

View File

@ -96,7 +96,7 @@ void QColor_SetNamedColor(QColor* self, struct miqt_string name) {
self->setNamedColor(name_QString);
}
struct miqt_array* QColor_ColorNames() {
struct miqt_array QColor_ColorNames() {
QStringList _ret = QColor::colorNames();
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
@ -110,9 +110,9 @@ struct miqt_array* QColor_ColorNames() {
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
_arr[i] = _lv_ms;
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -173,7 +173,7 @@ func (this *QColor) SetNamedColor(name string) {
}
func QColor_ColorNames() []string {
var _ma *C.struct_miqt_array = C.QColor_ColorNames()
var _ma C.struct_miqt_array = C.QColor_ColorNames()
_ret := make([]string, int(_ma.len))
_outCast := (*[0xffff]C.struct_miqt_string)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -182,7 +182,6 @@ func QColor_ColorNames() []string {
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -39,7 +39,7 @@ bool QColor_IsValid(const QColor* self);
struct miqt_string QColor_Name(const QColor* self);
struct miqt_string QColor_NameWithFormat(const QColor* self, int format);
void QColor_SetNamedColor(QColor* self, struct miqt_string name);
struct miqt_array* QColor_ColorNames();
struct miqt_array QColor_ColorNames();
int QColor_Spec(const QColor* self);
int QColor_Alpha(const QColor* self);
void QColor_SetAlpha(QColor* self, int alpha);

View File

@ -47,16 +47,16 @@ QColor* QColormap_ColorAt(const QColormap* self, unsigned int pixel) {
return new QColor(self->colorAt(static_cast<uint>(pixel)));
}
struct miqt_array* QColormap_Colormap(const QColormap* self) {
struct miqt_array QColormap_Colormap(const QColormap* self) {
const QVector<QColor> _ret = self->colormap();
// Convert QList<> from C++ memory to manually-managed C memory
QColor** _arr = static_cast<QColor**>(malloc(sizeof(QColor*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QColor(_ret[i]);
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -99,7 +99,7 @@ func (this *QColormap) ColorAt(pixel uint) *QColor {
}
func (this *QColormap) Colormap() []QColor {
var _ma *C.struct_miqt_array = C.QColormap_Colormap(this.h)
var _ma C.struct_miqt_array = C.QColormap_Colormap(this.h)
_ret := make([]QColor, int(_ma.len))
_outCast := (*[0xffff]*C.QColor)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
@ -108,7 +108,6 @@ func (this *QColormap) Colormap() []QColor {
_vv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
_ret[i] = *_vv_goptr
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -31,7 +31,7 @@ int QColormap_Depth(const QColormap* self);
int QColormap_Size(const QColormap* self);
unsigned int QColormap_Pixel(const QColormap* self, QColor* color);
QColor* QColormap_ColorAt(const QColormap* self, unsigned int pixel);
struct miqt_array* QColormap_Colormap(const QColormap* self);
struct miqt_array QColormap_Colormap(const QColormap* self);
QColormap* QColormap_Instance1(int screen);
void QColormap_Delete(QColormap* self);

View File

@ -114,26 +114,26 @@ void QColumnView_SetPreviewWidget(QColumnView* self, QWidget* widget) {
self->setPreviewWidget(widget);
}
void QColumnView_SetColumnWidths(QColumnView* self, struct miqt_array* /* of int */ list) {
void QColumnView_SetColumnWidths(QColumnView* self, struct miqt_array /* of int */ list) {
QList<int> list_QList;
list_QList.reserve(list->len);
int* list_arr = static_cast<int*>(list->data);
for(size_t i = 0; i < list->len; ++i) {
list_QList.reserve(list.len);
int* list_arr = static_cast<int*>(list.data);
for(size_t i = 0; i < list.len; ++i) {
list_QList.push_back(static_cast<int>(list_arr[i]));
}
self->setColumnWidths(list_QList);
}
struct miqt_array* QColumnView_ColumnWidths(const QColumnView* self) {
struct miqt_array QColumnView_ColumnWidths(const QColumnView* self) {
QList<int> _ret = self->columnWidths();
// Convert QList<> from C++ memory to manually-managed C memory
int* _arr = static_cast<int*>(malloc(sizeof(int) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = _ret[i];
}
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
_out->len = _ret.length();
_out->data = static_cast<void*>(_arr);
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}

View File

@ -162,25 +162,22 @@ func (this *QColumnView) SetPreviewWidget(widget *QWidget) {
}
func (this *QColumnView) SetColumnWidths(list []int) {
// For the C ABI, malloc a C array of raw pointers
list_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(list))))
defer C.free(unsafe.Pointer(list_CArray))
for i := range list {
list_CArray[i] = (C.int)(list[i])
}
list_ma := &C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
defer runtime.KeepAlive(unsafe.Pointer(list_ma))
list_ma := C.struct_miqt_array{len: C.size_t(len(list)), data: unsafe.Pointer(list_CArray)}
C.QColumnView_SetColumnWidths(this.h, list_ma)
}
func (this *QColumnView) ColumnWidths() []int {
var _ma *C.struct_miqt_array = C.QColumnView_ColumnWidths(this.h)
var _ma C.struct_miqt_array = C.QColumnView_ColumnWidths(this.h)
_ret := make([]int, int(_ma.len))
_outCast := (*[0xffff]C.int)(unsafe.Pointer(_ma.data)) // hey ya
for i := 0; i < int(_ma.len); i++ {
_ret[i] = (int)(_outCast[i])
}
C.free(unsafe.Pointer(_ma))
return _ret
}

View File

@ -55,8 +55,8 @@ void QColumnView_SetResizeGripsVisible(QColumnView* self, bool visible);
bool QColumnView_ResizeGripsVisible(const QColumnView* self);
QWidget* QColumnView_PreviewWidget(const QColumnView* self);
void QColumnView_SetPreviewWidget(QColumnView* self, QWidget* widget);
void QColumnView_SetColumnWidths(QColumnView* self, struct miqt_array* /* of int */ list);
struct miqt_array* QColumnView_ColumnWidths(const QColumnView* self);
void QColumnView_SetColumnWidths(QColumnView* self, struct miqt_array /* of int */ list);
struct miqt_array QColumnView_ColumnWidths(const QColumnView* self);
struct miqt_string QColumnView_Tr2(const char* s, const char* c);
struct miqt_string QColumnView_Tr3(const char* s, const char* c, int n);
struct miqt_string QColumnView_TrUtf82(const char* s, const char* c);

Some files were not shown because too many files have changed in this diff Show More