miqt/qt6/gen_qstringlistmodel.go

285 lines
10 KiB
Go
Raw Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qstringlistmodel.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QStringListModel struct {
h *C.QStringListModel
*QAbstractListModel
}
func (this *QStringListModel) cPointer() *C.QStringListModel {
if this == nil {
return nil
}
return this.h
}
func (this *QStringListModel) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
func newQStringListModel(h *C.QStringListModel) *QStringListModel {
if h == nil {
return nil
}
return &QStringListModel{h: h, QAbstractListModel: UnsafeNewQAbstractListModel(unsafe.Pointer(h))}
}
func UnsafeNewQStringListModel(h unsafe.Pointer) *QStringListModel {
return newQStringListModel((*C.QStringListModel)(h))
}
// NewQStringListModel constructs a new QStringListModel object.
func NewQStringListModel() *QStringListModel {
ret := C.QStringListModel_new()
return newQStringListModel(ret)
}
// NewQStringListModel2 constructs a new QStringListModel object.
func NewQStringListModel2(strings []string) *QStringListModel {
strings_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(strings))))
defer C.free(unsafe.Pointer(strings_CArray))
for i := range strings {
strings_i_ms := C.struct_miqt_string{}
strings_i_ms.data = C.CString(strings[i])
strings_i_ms.len = C.size_t(len(strings[i]))
defer C.free(unsafe.Pointer(strings_i_ms.data))
strings_CArray[i] = strings_i_ms
}
strings_ma := C.struct_miqt_array{len: C.size_t(len(strings)), data: unsafe.Pointer(strings_CArray)}
2024-10-20 05:21:03 +00:00
ret := C.QStringListModel_new2(strings_ma)
return newQStringListModel(ret)
}
// NewQStringListModel3 constructs a new QStringListModel object.
func NewQStringListModel3(parent *QObject) *QStringListModel {
ret := C.QStringListModel_new3(parent.cPointer())
return newQStringListModel(ret)
}
// NewQStringListModel4 constructs a new QStringListModel object.
func NewQStringListModel4(strings []string, parent *QObject) *QStringListModel {
strings_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(strings))))
defer C.free(unsafe.Pointer(strings_CArray))
for i := range strings {
strings_i_ms := C.struct_miqt_string{}
strings_i_ms.data = C.CString(strings[i])
strings_i_ms.len = C.size_t(len(strings[i]))
defer C.free(unsafe.Pointer(strings_i_ms.data))
strings_CArray[i] = strings_i_ms
}
strings_ma := C.struct_miqt_array{len: C.size_t(len(strings)), data: unsafe.Pointer(strings_CArray)}
2024-10-20 05:21:03 +00:00
ret := C.QStringListModel_new4(strings_ma, parent.cPointer())
return newQStringListModel(ret)
}
func (this *QStringListModel) MetaObject() *QMetaObject {
return UnsafeNewQMetaObject(unsafe.Pointer(C.QStringListModel_MetaObject(this.h)))
}
func (this *QStringListModel) Metacast(param1 string) unsafe.Pointer {
param1_Cstring := C.CString(param1)
defer C.free(unsafe.Pointer(param1_Cstring))
return (unsafe.Pointer)(C.QStringListModel_Metacast(this.h, param1_Cstring))
}
func QStringListModel_Tr(s string) string {
s_Cstring := C.CString(s)
defer C.free(unsafe.Pointer(s_Cstring))
var _ms C.struct_miqt_string = C.QStringListModel_Tr(s_Cstring)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QStringListModel) RowCount() int {
return (int)(C.QStringListModel_RowCount(this.h))
}
func (this *QStringListModel) Sibling(row int, column int, idx *QModelIndex) *QModelIndex {
_ret := C.QStringListModel_Sibling(this.h, (C.int)(row), (C.int)(column), idx.cPointer())
_goptr := newQModelIndex(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QStringListModel) Data(index *QModelIndex) *QVariant {
_ret := C.QStringListModel_Data(this.h, index.cPointer())
_goptr := newQVariant(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QStringListModel) SetData(index *QModelIndex, value *QVariant) bool {
return (bool)(C.QStringListModel_SetData(this.h, index.cPointer(), value.cPointer()))
}
func (this *QStringListModel) ClearItemData(index *QModelIndex) bool {
return (bool)(C.QStringListModel_ClearItemData(this.h, index.cPointer()))
}
func (this *QStringListModel) Flags(index *QModelIndex) ItemFlag {
return (ItemFlag)(C.QStringListModel_Flags(this.h, index.cPointer()))
}
func (this *QStringListModel) InsertRows(row int, count int) bool {
return (bool)(C.QStringListModel_InsertRows(this.h, (C.int)(row), (C.int)(count)))
}
func (this *QStringListModel) RemoveRows(row int, count int) bool {
return (bool)(C.QStringListModel_RemoveRows(this.h, (C.int)(row), (C.int)(count)))
}
func (this *QStringListModel) MoveRows(sourceParent *QModelIndex, sourceRow int, count int, destinationParent *QModelIndex, destinationChild int) bool {
return (bool)(C.QStringListModel_MoveRows(this.h, sourceParent.cPointer(), (C.int)(sourceRow), (C.int)(count), destinationParent.cPointer(), (C.int)(destinationChild)))
}
func (this *QStringListModel) ItemData(index *QModelIndex) map[int]QVariant {
var _mm C.struct_miqt_map = C.QStringListModel_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 *QStringListModel) 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.QStringListModel_SetItemData(this.h, index.cPointer(), roles_mm))
}
2024-10-20 05:21:03 +00:00
func (this *QStringListModel) Sort(column int) {
C.QStringListModel_Sort(this.h, (C.int)(column))
}
func (this *QStringListModel) StringList() []string {
var _ma C.struct_miqt_array = C.QStringListModel_StringList(this.h)
2024-10-20 05:21:03 +00:00
_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++ {
var _lv_ms C.struct_miqt_string = _outCast[i]
_lv_ret := C.GoStringN(_lv_ms.data, C.int(int64(_lv_ms.len)))
C.free(unsafe.Pointer(_lv_ms.data))
_ret[i] = _lv_ret
}
return _ret
}
func (this *QStringListModel) SetStringList(strings []string) {
strings_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(strings))))
defer C.free(unsafe.Pointer(strings_CArray))
for i := range strings {
strings_i_ms := C.struct_miqt_string{}
strings_i_ms.data = C.CString(strings[i])
strings_i_ms.len = C.size_t(len(strings[i]))
defer C.free(unsafe.Pointer(strings_i_ms.data))
strings_CArray[i] = strings_i_ms
}
strings_ma := C.struct_miqt_array{len: C.size_t(len(strings)), data: unsafe.Pointer(strings_CArray)}
2024-10-20 05:21:03 +00:00
C.QStringListModel_SetStringList(this.h, strings_ma)
}
func (this *QStringListModel) SupportedDropActions() DropAction {
return (DropAction)(C.QStringListModel_SupportedDropActions(this.h))
}
func QStringListModel_Tr2(s string, c string) string {
s_Cstring := C.CString(s)
defer C.free(unsafe.Pointer(s_Cstring))
c_Cstring := C.CString(c)
defer C.free(unsafe.Pointer(c_Cstring))
var _ms C.struct_miqt_string = C.QStringListModel_Tr2(s_Cstring, c_Cstring)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func QStringListModel_Tr3(s string, c string, n int) string {
s_Cstring := C.CString(s)
defer C.free(unsafe.Pointer(s_Cstring))
c_Cstring := C.CString(c)
defer C.free(unsafe.Pointer(c_Cstring))
var _ms C.struct_miqt_string = C.QStringListModel_Tr3(s_Cstring, c_Cstring, (C.int)(n))
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QStringListModel) RowCount1(parent *QModelIndex) int {
return (int)(C.QStringListModel_RowCount1(this.h, parent.cPointer()))
}
func (this *QStringListModel) Data2(index *QModelIndex, role int) *QVariant {
_ret := C.QStringListModel_Data2(this.h, index.cPointer(), (C.int)(role))
_goptr := newQVariant(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QStringListModel) SetData3(index *QModelIndex, value *QVariant, role int) bool {
return (bool)(C.QStringListModel_SetData3(this.h, index.cPointer(), value.cPointer(), (C.int)(role)))
}
func (this *QStringListModel) InsertRows3(row int, count int, parent *QModelIndex) bool {
return (bool)(C.QStringListModel_InsertRows3(this.h, (C.int)(row), (C.int)(count), parent.cPointer()))
}
func (this *QStringListModel) RemoveRows3(row int, count int, parent *QModelIndex) bool {
return (bool)(C.QStringListModel_RemoveRows3(this.h, (C.int)(row), (C.int)(count), parent.cPointer()))
}
func (this *QStringListModel) Sort2(column int, order SortOrder) {
C.QStringListModel_Sort2(this.h, (C.int)(column), (C.int)(order))
}
// Delete this object from C++ memory.
func (this *QStringListModel) Delete() {
C.QStringListModel_Delete(this.h)
}
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
// from C++ memory once it is unreachable from Go memory.
func (this *QStringListModel) GoGC() {
runtime.SetFinalizer(this, func(this *QStringListModel) {
this.Delete()
runtime.KeepAlive(this.h)
})
}