2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#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 newQStringListModel(h *C.QStringListModel) *QStringListModel {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QStringListModel{h: h, QAbstractListModel: newQAbstractListModel_U(unsafe.Pointer(h))}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQStringListModel_U(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 {
|
2024-09-17 07:30:27 +00:00
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-14 22:29:05 +00:00
|
|
|
strings_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(strings))))
|
2024-08-25 04:08:24 +00:00
|
|
|
defer C.free(unsafe.Pointer(strings_CArray))
|
|
|
|
for i := range strings {
|
2024-09-17 07:30:27 +00:00
|
|
|
strings_i_ms := miqt_strdupg(strings[i])
|
|
|
|
defer C.free(strings_i_ms)
|
|
|
|
strings_CArray[i] = (*C.struct_miqt_string)(strings_i_ms)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
strings_ma := &C.struct_miqt_array{len: C.size_t(len(strings)), data: unsafe.Pointer(strings_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(strings_ma))
|
|
|
|
ret := C.QStringListModel_new2(strings_ma)
|
2024-08-25 04:08:24 +00:00
|
|
|
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 {
|
2024-09-17 07:30:27 +00:00
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-14 22:29:05 +00:00
|
|
|
strings_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(strings))))
|
2024-08-25 04:08:24 +00:00
|
|
|
defer C.free(unsafe.Pointer(strings_CArray))
|
|
|
|
for i := range strings {
|
2024-09-17 07:30:27 +00:00
|
|
|
strings_i_ms := miqt_strdupg(strings[i])
|
|
|
|
defer C.free(strings_i_ms)
|
|
|
|
strings_CArray[i] = (*C.struct_miqt_string)(strings_i_ms)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
strings_ma := &C.struct_miqt_array{len: C.size_t(len(strings)), data: unsafe.Pointer(strings_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(strings_ma))
|
|
|
|
ret := C.QStringListModel_new4(strings_ma, parent.cPointer())
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQStringListModel(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) MetaObject() *QMetaObject {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQMetaObject_U(unsafe.Pointer(C.QStringListModel_MetaObject(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QStringListModel_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
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))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QStringListModel_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QStringListModel_TrUtf8(s_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) RowCount() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QStringListModel_RowCount(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) Sibling(row int, column int, idx *QModelIndex) *QModelIndex {
|
2024-09-14 22:29:05 +00:00
|
|
|
_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
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) Data(index *QModelIndex) *QVariant {
|
2024-09-14 22:29:05 +00:00
|
|
|
_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
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) SetData(index *QModelIndex, value *QVariant) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStringListModel_SetData(this.h, index.cPointer(), value.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
func (this *QStringListModel) Flags(index *QModelIndex) int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QStringListModel_Flags(this.h, index.cPointer()))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QStringListModel) InsertRows(row int, count int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStringListModel_InsertRows(this.h, (C.int)(row), (C.int)(count)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) RemoveRows(row int, count int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStringListModel_RemoveRows(this.h, (C.int)(row), (C.int)(count)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) MoveRows(sourceParent *QModelIndex, sourceRow int, count int, destinationParent *QModelIndex, destinationChild int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStringListModel_MoveRows(this.h, sourceParent.cPointer(), (C.int)(sourceRow), (C.int)(count), destinationParent.cPointer(), (C.int)(destinationChild)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
func (this *QStringListModel) Sort(column int) {
|
|
|
|
C.QStringListModel_Sort(this.h, (C.int)(column))
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QStringListModel) StringList() []string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ma *C.struct_miqt_array = C.QStringListModel_StringList(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++ {
|
2024-09-17 07:30:27 +00:00
|
|
|
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))
|
|
|
|
_ret[i] = _lv_ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
C.free(unsafe.Pointer(_ma))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) SetStringList(strings []string) {
|
2024-09-17 07:30:27 +00:00
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-14 22:29:05 +00:00
|
|
|
strings_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(strings))))
|
2024-08-25 04:08:24 +00:00
|
|
|
defer C.free(unsafe.Pointer(strings_CArray))
|
|
|
|
for i := range strings {
|
2024-09-17 07:30:27 +00:00
|
|
|
strings_i_ms := miqt_strdupg(strings[i])
|
|
|
|
defer C.free(strings_i_ms)
|
|
|
|
strings_CArray[i] = (*C.struct_miqt_string)(strings_i_ms)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
strings_ma := &C.struct_miqt_array{len: C.size_t(len(strings)), data: unsafe.Pointer(strings_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(strings_ma))
|
|
|
|
C.QStringListModel_SetStringList(this.h, strings_ma)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
func (this *QStringListModel) SupportedDropActions() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QStringListModel_SupportedDropActions(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
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))
|
2024-09-14 22:29:05 +00:00
|
|
|
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))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
2024-09-14 22:29:05 +00:00
|
|
|
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))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QStringListModel_TrUtf82(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))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QStringListModel_TrUtf82(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QStringListModel_TrUtf83(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))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QStringListModel_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) RowCount1(parent *QModelIndex) int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QStringListModel_RowCount1(this.h, parent.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) Data2(index *QModelIndex, role int) *QVariant {
|
2024-09-14 22:29:05 +00:00
|
|
|
_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
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) SetData3(index *QModelIndex, value *QVariant, role int) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStringListModel_SetData3(this.h, index.cPointer(), value.cPointer(), (C.int)(role)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) InsertRows3(row int, count int, parent *QModelIndex) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStringListModel_InsertRows3(this.h, (C.int)(row), (C.int)(count), parent.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStringListModel) RemoveRows3(row int, count int, parent *QModelIndex) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStringListModel_RemoveRows3(this.h, (C.int)(row), (C.int)(count), parent.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QStringListModel) Sort2(column int, order SortOrder) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QStringListModel_Sort2(this.h, (C.int)(column), (C.int)(order))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QStringListModel) Delete() {
|
|
|
|
C.QStringListModel_Delete(this.h)
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
// 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)
|
|
|
|
})
|
|
|
|
}
|