mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
qt: rebuild (add qmap/qhash support, impacts QVariant ctor ordering)
This commit is contained in:
parent
a009008525
commit
7ea5a250bb
@ -1,7 +1,9 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractListModel>
|
||||
#include <QAbstractTableModel>
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
@ -269,6 +271,34 @@ bool QAbstractItemModel_SetHeaderData(QAbstractItemModel* self, int section, int
|
||||
return self->setHeaderData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation), *value);
|
||||
}
|
||||
|
||||
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
|
||||
@ -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);
|
||||
}
|
||||
|
@ -448,6 +448,43 @@ 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)
|
||||
_ret := make([]string, int(_ma.len))
|
||||
@ -578,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()))
|
||||
}
|
||||
|
@ -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,6 +98,8 @@ 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_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);
|
||||
@ -121,6 +125,7 @@ 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);
|
||||
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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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()))
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
@ -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());
|
||||
}
|
||||
|
@ -430,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)
|
||||
@ -437,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)
|
||||
|
@ -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();
|
||||
@ -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);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QConcatenateTablesProxyModel>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
@ -89,6 +90,34 @@ bool QConcatenateTablesProxyModel_SetData(QConcatenateTablesProxyModel* self, QM
|
||||
return self->setData(*index, *value);
|
||||
}
|
||||
|
||||
struct miqt_map QConcatenateTablesProxyModel_ItemData(const QConcatenateTablesProxyModel* self, QModelIndex* proxyIndex) {
|
||||
QMap<int, QVariant> _ret = self->itemData(*proxyIndex);
|
||||
// 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 QConcatenateTablesProxyModel_SetItemData(QConcatenateTablesProxyModel* 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);
|
||||
}
|
||||
|
||||
int QConcatenateTablesProxyModel_Flags(const QConcatenateTablesProxyModel* self, QModelIndex* index) {
|
||||
Qt::ItemFlags _ret = self->flags(*index);
|
||||
return static_cast<int>(_ret);
|
||||
|
@ -126,6 +126,43 @@ func (this *QConcatenateTablesProxyModel) SetData(index *QModelIndex, value *QVa
|
||||
return (bool)(C.QConcatenateTablesProxyModel_SetData(this.h, index.cPointer(), value.cPointer()))
|
||||
}
|
||||
|
||||
func (this *QConcatenateTablesProxyModel) ItemData(proxyIndex *QModelIndex) map[int]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QConcatenateTablesProxyModel_ItemData(this.h, proxyIndex.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 *QConcatenateTablesProxyModel) 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.QConcatenateTablesProxyModel_SetItemData(this.h, index.cPointer(), roles_mm))
|
||||
}
|
||||
|
||||
func (this *QConcatenateTablesProxyModel) Flags(index *QModelIndex) ItemFlag {
|
||||
return (ItemFlag)(C.QConcatenateTablesProxyModel_Flags(this.h, index.cPointer()))
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ QModelIndex* QConcatenateTablesProxyModel_MapFromSource(const QConcatenateTables
|
||||
QModelIndex* QConcatenateTablesProxyModel_MapToSource(const QConcatenateTablesProxyModel* self, QModelIndex* proxyIndex);
|
||||
QVariant* QConcatenateTablesProxyModel_Data(const QConcatenateTablesProxyModel* self, QModelIndex* index);
|
||||
bool QConcatenateTablesProxyModel_SetData(QConcatenateTablesProxyModel* self, QModelIndex* index, QVariant* value);
|
||||
struct miqt_map QConcatenateTablesProxyModel_ItemData(const QConcatenateTablesProxyModel* self, QModelIndex* proxyIndex);
|
||||
bool QConcatenateTablesProxyModel_SetItemData(QConcatenateTablesProxyModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
int QConcatenateTablesProxyModel_Flags(const QConcatenateTablesProxyModel* self, QModelIndex* index);
|
||||
QModelIndex* QConcatenateTablesProxyModel_Index(const QConcatenateTablesProxyModel* self, int row, int column);
|
||||
QModelIndex* QConcatenateTablesProxyModel_Parent(const QConcatenateTablesProxyModel* self, QModelIndex* index);
|
||||
|
@ -1,59 +0,0 @@
|
||||
#include <QHashData>
|
||||
#define WORKAROUND_INNER_CLASS_DEFINITION_QHashData__Node
|
||||
#include <QHashDummyValue>
|
||||
#include <qhash.h>
|
||||
#include "gen_qhash.h"
|
||||
#include "_cgo_export.h"
|
||||
|
||||
void* QHashData_AllocateNode(QHashData* self, int nodeAlign) {
|
||||
return self->allocateNode(static_cast<int>(nodeAlign));
|
||||
}
|
||||
|
||||
void QHashData_FreeNode(QHashData* self, void* node) {
|
||||
self->freeNode(node);
|
||||
}
|
||||
|
||||
bool QHashData_WillGrow(QHashData* self) {
|
||||
return self->willGrow();
|
||||
}
|
||||
|
||||
void QHashData_HasShrunk(QHashData* self) {
|
||||
self->hasShrunk();
|
||||
}
|
||||
|
||||
void QHashData_Rehash(QHashData* self, int hint) {
|
||||
self->rehash(static_cast<int>(hint));
|
||||
}
|
||||
|
||||
QHashData__Node* QHashData_FirstNode(QHashData* self) {
|
||||
return self->firstNode();
|
||||
}
|
||||
|
||||
QHashData__Node* QHashData_NextNode(QHashData__Node* node) {
|
||||
return QHashData::nextNode(node);
|
||||
}
|
||||
|
||||
QHashData__Node* QHashData_PreviousNode(QHashData__Node* node) {
|
||||
return QHashData::previousNode(node);
|
||||
}
|
||||
|
||||
void QHashData_Delete(QHashData* self) {
|
||||
delete self;
|
||||
}
|
||||
|
||||
QHashDummyValue* QHashDummyValue_new() {
|
||||
return new QHashDummyValue();
|
||||
}
|
||||
|
||||
QHashDummyValue* QHashDummyValue_new2(QHashDummyValue* param1) {
|
||||
return new QHashDummyValue(*param1);
|
||||
}
|
||||
|
||||
void QHashDummyValue_Delete(QHashDummyValue* self) {
|
||||
delete self;
|
||||
}
|
||||
|
||||
void QHashData__Node_Delete(QHashData__Node* self) {
|
||||
delete self;
|
||||
}
|
||||
|
187
qt/gen_qhash.go
187
qt/gen_qhash.go
@ -1,187 +0,0 @@
|
||||
package qt
|
||||
|
||||
/*
|
||||
|
||||
#include "gen_qhash.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type QHashData struct {
|
||||
h *C.QHashData
|
||||
}
|
||||
|
||||
func (this *QHashData) cPointer() *C.QHashData {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return this.h
|
||||
}
|
||||
|
||||
func (this *QHashData) UnsafePointer() unsafe.Pointer {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(this.h)
|
||||
}
|
||||
|
||||
func newQHashData(h *C.QHashData) *QHashData {
|
||||
if h == nil {
|
||||
return nil
|
||||
}
|
||||
return &QHashData{h: h}
|
||||
}
|
||||
|
||||
func UnsafeNewQHashData(h unsafe.Pointer) *QHashData {
|
||||
return newQHashData((*C.QHashData)(h))
|
||||
}
|
||||
|
||||
func (this *QHashData) AllocateNode(nodeAlign int) unsafe.Pointer {
|
||||
return (unsafe.Pointer)(C.QHashData_AllocateNode(this.h, (C.int)(nodeAlign)))
|
||||
}
|
||||
|
||||
func (this *QHashData) FreeNode(node unsafe.Pointer) {
|
||||
C.QHashData_FreeNode(this.h, node)
|
||||
}
|
||||
|
||||
func (this *QHashData) WillGrow() bool {
|
||||
return (bool)(C.QHashData_WillGrow(this.h))
|
||||
}
|
||||
|
||||
func (this *QHashData) HasShrunk() {
|
||||
C.QHashData_HasShrunk(this.h)
|
||||
}
|
||||
|
||||
func (this *QHashData) Rehash(hint int) {
|
||||
C.QHashData_Rehash(this.h, (C.int)(hint))
|
||||
}
|
||||
|
||||
func (this *QHashData) FirstNode() *QHashData__Node {
|
||||
return UnsafeNewQHashData__Node(unsafe.Pointer(C.QHashData_FirstNode(this.h)))
|
||||
}
|
||||
|
||||
func QHashData_NextNode(node *QHashData__Node) *QHashData__Node {
|
||||
return UnsafeNewQHashData__Node(unsafe.Pointer(C.QHashData_NextNode(node.cPointer())))
|
||||
}
|
||||
|
||||
func QHashData_PreviousNode(node *QHashData__Node) *QHashData__Node {
|
||||
return UnsafeNewQHashData__Node(unsafe.Pointer(C.QHashData_PreviousNode(node.cPointer())))
|
||||
}
|
||||
|
||||
// Delete this object from C++ memory.
|
||||
func (this *QHashData) Delete() {
|
||||
C.QHashData_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 *QHashData) GoGC() {
|
||||
runtime.SetFinalizer(this, func(this *QHashData) {
|
||||
this.Delete()
|
||||
runtime.KeepAlive(this.h)
|
||||
})
|
||||
}
|
||||
|
||||
type QHashDummyValue struct {
|
||||
h *C.QHashDummyValue
|
||||
}
|
||||
|
||||
func (this *QHashDummyValue) cPointer() *C.QHashDummyValue {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return this.h
|
||||
}
|
||||
|
||||
func (this *QHashDummyValue) UnsafePointer() unsafe.Pointer {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(this.h)
|
||||
}
|
||||
|
||||
func newQHashDummyValue(h *C.QHashDummyValue) *QHashDummyValue {
|
||||
if h == nil {
|
||||
return nil
|
||||
}
|
||||
return &QHashDummyValue{h: h}
|
||||
}
|
||||
|
||||
func UnsafeNewQHashDummyValue(h unsafe.Pointer) *QHashDummyValue {
|
||||
return newQHashDummyValue((*C.QHashDummyValue)(h))
|
||||
}
|
||||
|
||||
// NewQHashDummyValue constructs a new QHashDummyValue object.
|
||||
func NewQHashDummyValue() *QHashDummyValue {
|
||||
ret := C.QHashDummyValue_new()
|
||||
return newQHashDummyValue(ret)
|
||||
}
|
||||
|
||||
// NewQHashDummyValue2 constructs a new QHashDummyValue object.
|
||||
func NewQHashDummyValue2(param1 *QHashDummyValue) *QHashDummyValue {
|
||||
ret := C.QHashDummyValue_new2(param1.cPointer())
|
||||
return newQHashDummyValue(ret)
|
||||
}
|
||||
|
||||
// Delete this object from C++ memory.
|
||||
func (this *QHashDummyValue) Delete() {
|
||||
C.QHashDummyValue_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 *QHashDummyValue) GoGC() {
|
||||
runtime.SetFinalizer(this, func(this *QHashDummyValue) {
|
||||
this.Delete()
|
||||
runtime.KeepAlive(this.h)
|
||||
})
|
||||
}
|
||||
|
||||
type QHashData__Node struct {
|
||||
h *C.QHashData__Node
|
||||
}
|
||||
|
||||
func (this *QHashData__Node) cPointer() *C.QHashData__Node {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return this.h
|
||||
}
|
||||
|
||||
func (this *QHashData__Node) UnsafePointer() unsafe.Pointer {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(this.h)
|
||||
}
|
||||
|
||||
func newQHashData__Node(h *C.QHashData__Node) *QHashData__Node {
|
||||
if h == nil {
|
||||
return nil
|
||||
}
|
||||
return &QHashData__Node{h: h}
|
||||
}
|
||||
|
||||
func UnsafeNewQHashData__Node(h unsafe.Pointer) *QHashData__Node {
|
||||
return newQHashData__Node((*C.QHashData__Node)(h))
|
||||
}
|
||||
|
||||
// Delete this object from C++ memory.
|
||||
func (this *QHashData__Node) Delete() {
|
||||
C.QHashData__Node_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 *QHashData__Node) GoGC() {
|
||||
runtime.SetFinalizer(this, func(this *QHashData__Node) {
|
||||
this.Delete()
|
||||
runtime.KeepAlive(this.h)
|
||||
})
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
#ifndef GEN_QHASH_H
|
||||
#define GEN_QHASH_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#include "../libmiqt/libmiqt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
class QHashData;
|
||||
#if defined(WORKAROUND_INNER_CLASS_DEFINITION_QHashData__Node)
|
||||
typedef QHashData::Node QHashData__Node;
|
||||
#else
|
||||
class QHashData__Node;
|
||||
#endif
|
||||
class QHashDummyValue;
|
||||
#else
|
||||
typedef struct QHashData QHashData;
|
||||
typedef struct QHashData__Node QHashData__Node;
|
||||
typedef struct QHashDummyValue QHashDummyValue;
|
||||
#endif
|
||||
|
||||
void* QHashData_AllocateNode(QHashData* self, int nodeAlign);
|
||||
void QHashData_FreeNode(QHashData* self, void* node);
|
||||
bool QHashData_WillGrow(QHashData* self);
|
||||
void QHashData_HasShrunk(QHashData* self);
|
||||
void QHashData_Rehash(QHashData* self, int hint);
|
||||
QHashData__Node* QHashData_FirstNode(QHashData* self);
|
||||
QHashData__Node* QHashData_NextNode(QHashData__Node* node);
|
||||
QHashData__Node* QHashData_PreviousNode(QHashData__Node* node);
|
||||
void QHashData_Delete(QHashData* self);
|
||||
|
||||
QHashDummyValue* QHashDummyValue_new();
|
||||
QHashDummyValue* QHashDummyValue_new2(QHashDummyValue* param1);
|
||||
void QHashDummyValue_Delete(QHashDummyValue* self);
|
||||
|
||||
void QHashData__Node_Delete(QHashData__Node* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
||||
#endif
|
@ -6,9 +6,11 @@
|
||||
#include <QJsonValueRef>
|
||||
#include <QJsonValueRefPtr>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <cstring>
|
||||
#include <QVariant>
|
||||
#include <qjsonobject.h>
|
||||
#include "gen_qjsonobject.h"
|
||||
#include "_cgo_export.h"
|
||||
@ -29,6 +31,79 @@ void QJsonObject_Swap(QJsonObject* self, QJsonObject* other) {
|
||||
self->swap(*other);
|
||||
}
|
||||
|
||||
QJsonObject* QJsonObject_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 QJsonObject(QJsonObject::fromVariantMap(mapVal_QMap));
|
||||
}
|
||||
|
||||
struct miqt_map QJsonObject_ToVariantMap(const QJsonObject* 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;
|
||||
}
|
||||
|
||||
QJsonObject* QJsonObject_FromVariantHash(struct miqt_map mapVal) {
|
||||
QVariantHash mapVal_QMap;
|
||||
mapVal_QMap.reserve(mapVal.len);
|
||||
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 QJsonObject(QJsonObject::fromVariantHash(mapVal_QMap));
|
||||
}
|
||||
|
||||
struct miqt_map QJsonObject_ToVariantHash(const QJsonObject* 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;
|
||||
}
|
||||
|
||||
struct miqt_array QJsonObject_Keys(const QJsonObject* self) {
|
||||
QStringList _ret = self->keys();
|
||||
// Convert QList<> from C++ memory to manually-managed C memory
|
||||
|
@ -62,6 +62,98 @@ func (this *QJsonObject) Swap(other *QJsonObject) {
|
||||
C.QJsonObject_Swap(this.h, other.cPointer())
|
||||
}
|
||||
|
||||
func QJsonObject_FromVariantMap(mapVal map[string]QVariant) *QJsonObject {
|
||||
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.QJsonObject_FromVariantMap(mapVal_mm)
|
||||
_goptr := newQJsonObject(_ret)
|
||||
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||||
return _goptr
|
||||
}
|
||||
|
||||
func (this *QJsonObject) ToVariantMap() map[string]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QJsonObject_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 QJsonObject_FromVariantHash(mapVal map[string]QVariant) *QJsonObject {
|
||||
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.QJsonObject_FromVariantHash(mapVal_mm)
|
||||
_goptr := newQJsonObject(_ret)
|
||||
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||||
return _goptr
|
||||
}
|
||||
|
||||
func (this *QJsonObject) ToVariantHash() map[string]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QJsonObject_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 *QJsonObject) Keys() []string {
|
||||
var _ma C.struct_miqt_array = C.QJsonObject_Keys(this.h)
|
||||
_ret := make([]string, int(_ma.len))
|
||||
|
@ -29,6 +29,7 @@ class QJsonValue;
|
||||
class QJsonValuePtr;
|
||||
class QJsonValueRef;
|
||||
class QJsonValueRefPtr;
|
||||
class QVariant;
|
||||
#else
|
||||
typedef struct QJsonObject QJsonObject;
|
||||
typedef struct QJsonObject__const_iterator QJsonObject__const_iterator;
|
||||
@ -37,12 +38,17 @@ typedef struct QJsonValue QJsonValue;
|
||||
typedef struct QJsonValuePtr QJsonValuePtr;
|
||||
typedef struct QJsonValueRef QJsonValueRef;
|
||||
typedef struct QJsonValueRefPtr QJsonValueRefPtr;
|
||||
typedef struct QVariant QVariant;
|
||||
#endif
|
||||
|
||||
QJsonObject* QJsonObject_new();
|
||||
QJsonObject* QJsonObject_new2(QJsonObject* other);
|
||||
void QJsonObject_OperatorAssign(QJsonObject* self, QJsonObject* other);
|
||||
void QJsonObject_Swap(QJsonObject* self, QJsonObject* other);
|
||||
QJsonObject* QJsonObject_FromVariantMap(struct miqt_map mapVal);
|
||||
struct miqt_map QJsonObject_ToVariantMap(const QJsonObject* self);
|
||||
QJsonObject* QJsonObject_FromVariantHash(struct miqt_map mapVal);
|
||||
struct miqt_map QJsonObject_ToVariantHash(const QJsonObject* self);
|
||||
struct miqt_array QJsonObject_Keys(const QJsonObject* self);
|
||||
int QJsonObject_Size(const QJsonObject* self);
|
||||
int QJsonObject_Count(const QJsonObject* self);
|
||||
|
@ -1,91 +0,0 @@
|
||||
#include <QMapDataBase>
|
||||
#include <QMapNodeBase>
|
||||
#include <qmap.h>
|
||||
#include "gen_qmap.h"
|
||||
#include "_cgo_export.h"
|
||||
|
||||
QMapNodeBase* QMapNodeBase_new(QMapNodeBase* param1) {
|
||||
return new QMapNodeBase(*param1);
|
||||
}
|
||||
|
||||
QMapNodeBase* QMapNodeBase_NextNode(const QMapNodeBase* self) {
|
||||
return (QMapNodeBase*) self->nextNode();
|
||||
}
|
||||
|
||||
QMapNodeBase* QMapNodeBase_NextNode2(QMapNodeBase* self) {
|
||||
return self->nextNode();
|
||||
}
|
||||
|
||||
QMapNodeBase* QMapNodeBase_PreviousNode(const QMapNodeBase* self) {
|
||||
return (QMapNodeBase*) self->previousNode();
|
||||
}
|
||||
|
||||
QMapNodeBase* QMapNodeBase_PreviousNode2(QMapNodeBase* self) {
|
||||
return self->previousNode();
|
||||
}
|
||||
|
||||
int QMapNodeBase_Color(const QMapNodeBase* self) {
|
||||
QMapNodeBase::Color _ret = self->color();
|
||||
return static_cast<int>(_ret);
|
||||
}
|
||||
|
||||
void QMapNodeBase_SetColor(QMapNodeBase* self, int c) {
|
||||
self->setColor(static_cast<QMapNodeBase::Color>(c));
|
||||
}
|
||||
|
||||
QMapNodeBase* QMapNodeBase_Parent(const QMapNodeBase* self) {
|
||||
return self->parent();
|
||||
}
|
||||
|
||||
void QMapNodeBase_SetParent(QMapNodeBase* self, QMapNodeBase* pp) {
|
||||
self->setParent(pp);
|
||||
}
|
||||
|
||||
void QMapNodeBase_OperatorAssign(QMapNodeBase* self, QMapNodeBase* param1) {
|
||||
self->operator=(*param1);
|
||||
}
|
||||
|
||||
void QMapNodeBase_Delete(QMapNodeBase* self) {
|
||||
delete self;
|
||||
}
|
||||
|
||||
void QMapDataBase_RotateLeft(QMapDataBase* self, QMapNodeBase* x) {
|
||||
self->rotateLeft(x);
|
||||
}
|
||||
|
||||
void QMapDataBase_RotateRight(QMapDataBase* self, QMapNodeBase* x) {
|
||||
self->rotateRight(x);
|
||||
}
|
||||
|
||||
void QMapDataBase_Rebalance(QMapDataBase* self, QMapNodeBase* x) {
|
||||
self->rebalance(x);
|
||||
}
|
||||
|
||||
void QMapDataBase_FreeNodeAndRebalance(QMapDataBase* self, QMapNodeBase* z) {
|
||||
self->freeNodeAndRebalance(z);
|
||||
}
|
||||
|
||||
void QMapDataBase_RecalcMostLeftNode(QMapDataBase* self) {
|
||||
self->recalcMostLeftNode();
|
||||
}
|
||||
|
||||
QMapNodeBase* QMapDataBase_CreateNode(QMapDataBase* self, int size, int alignment, QMapNodeBase* parent, bool left) {
|
||||
return self->createNode(static_cast<int>(size), static_cast<int>(alignment), parent, left);
|
||||
}
|
||||
|
||||
void QMapDataBase_FreeTree(QMapDataBase* self, QMapNodeBase* root, int alignment) {
|
||||
self->freeTree(root, static_cast<int>(alignment));
|
||||
}
|
||||
|
||||
QMapDataBase* QMapDataBase_CreateData() {
|
||||
return QMapDataBase::createData();
|
||||
}
|
||||
|
||||
void QMapDataBase_FreeData(QMapDataBase* d) {
|
||||
QMapDataBase::freeData(d);
|
||||
}
|
||||
|
||||
void QMapDataBase_Delete(QMapDataBase* self) {
|
||||
delete self;
|
||||
}
|
||||
|
191
qt/gen_qmap.go
191
qt/gen_qmap.go
@ -1,191 +0,0 @@
|
||||
package qt
|
||||
|
||||
/*
|
||||
|
||||
#include "gen_qmap.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type QMapNodeBase__Color int
|
||||
|
||||
const (
|
||||
QMapNodeBase__Red QMapNodeBase__Color = 0
|
||||
QMapNodeBase__Black QMapNodeBase__Color = 1
|
||||
)
|
||||
|
||||
type QMapNodeBase__ int
|
||||
|
||||
const (
|
||||
QMapNodeBase__Mask QMapNodeBase__ = 3
|
||||
)
|
||||
|
||||
type QMapNodeBase struct {
|
||||
h *C.QMapNodeBase
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) cPointer() *C.QMapNodeBase {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return this.h
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) UnsafePointer() unsafe.Pointer {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(this.h)
|
||||
}
|
||||
|
||||
func newQMapNodeBase(h *C.QMapNodeBase) *QMapNodeBase {
|
||||
if h == nil {
|
||||
return nil
|
||||
}
|
||||
return &QMapNodeBase{h: h}
|
||||
}
|
||||
|
||||
func UnsafeNewQMapNodeBase(h unsafe.Pointer) *QMapNodeBase {
|
||||
return newQMapNodeBase((*C.QMapNodeBase)(h))
|
||||
}
|
||||
|
||||
// NewQMapNodeBase constructs a new QMapNodeBase object.
|
||||
func NewQMapNodeBase(param1 *QMapNodeBase) *QMapNodeBase {
|
||||
ret := C.QMapNodeBase_new(param1.cPointer())
|
||||
return newQMapNodeBase(ret)
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) NextNode() *QMapNodeBase {
|
||||
return UnsafeNewQMapNodeBase(unsafe.Pointer(C.QMapNodeBase_NextNode(this.h)))
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) NextNode2() *QMapNodeBase {
|
||||
return UnsafeNewQMapNodeBase(unsafe.Pointer(C.QMapNodeBase_NextNode2(this.h)))
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) PreviousNode() *QMapNodeBase {
|
||||
return UnsafeNewQMapNodeBase(unsafe.Pointer(C.QMapNodeBase_PreviousNode(this.h)))
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) PreviousNode2() *QMapNodeBase {
|
||||
return UnsafeNewQMapNodeBase(unsafe.Pointer(C.QMapNodeBase_PreviousNode2(this.h)))
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) Color() QMapNodeBase__Color {
|
||||
return (QMapNodeBase__Color)(C.QMapNodeBase_Color(this.h))
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) SetColor(c QMapNodeBase__Color) {
|
||||
C.QMapNodeBase_SetColor(this.h, (C.int)(c))
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) Parent() *QMapNodeBase {
|
||||
return UnsafeNewQMapNodeBase(unsafe.Pointer(C.QMapNodeBase_Parent(this.h)))
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) SetParent(pp *QMapNodeBase) {
|
||||
C.QMapNodeBase_SetParent(this.h, pp.cPointer())
|
||||
}
|
||||
|
||||
func (this *QMapNodeBase) OperatorAssign(param1 *QMapNodeBase) {
|
||||
C.QMapNodeBase_OperatorAssign(this.h, param1.cPointer())
|
||||
}
|
||||
|
||||
// Delete this object from C++ memory.
|
||||
func (this *QMapNodeBase) Delete() {
|
||||
C.QMapNodeBase_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 *QMapNodeBase) GoGC() {
|
||||
runtime.SetFinalizer(this, func(this *QMapNodeBase) {
|
||||
this.Delete()
|
||||
runtime.KeepAlive(this.h)
|
||||
})
|
||||
}
|
||||
|
||||
type QMapDataBase struct {
|
||||
h *C.QMapDataBase
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) cPointer() *C.QMapDataBase {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return this.h
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) UnsafePointer() unsafe.Pointer {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(this.h)
|
||||
}
|
||||
|
||||
func newQMapDataBase(h *C.QMapDataBase) *QMapDataBase {
|
||||
if h == nil {
|
||||
return nil
|
||||
}
|
||||
return &QMapDataBase{h: h}
|
||||
}
|
||||
|
||||
func UnsafeNewQMapDataBase(h unsafe.Pointer) *QMapDataBase {
|
||||
return newQMapDataBase((*C.QMapDataBase)(h))
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) RotateLeft(x *QMapNodeBase) {
|
||||
C.QMapDataBase_RotateLeft(this.h, x.cPointer())
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) RotateRight(x *QMapNodeBase) {
|
||||
C.QMapDataBase_RotateRight(this.h, x.cPointer())
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) Rebalance(x *QMapNodeBase) {
|
||||
C.QMapDataBase_Rebalance(this.h, x.cPointer())
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) FreeNodeAndRebalance(z *QMapNodeBase) {
|
||||
C.QMapDataBase_FreeNodeAndRebalance(this.h, z.cPointer())
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) RecalcMostLeftNode() {
|
||||
C.QMapDataBase_RecalcMostLeftNode(this.h)
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) CreateNode(size int, alignment int, parent *QMapNodeBase, left bool) *QMapNodeBase {
|
||||
return UnsafeNewQMapNodeBase(unsafe.Pointer(C.QMapDataBase_CreateNode(this.h, (C.int)(size), (C.int)(alignment), parent.cPointer(), (C.bool)(left))))
|
||||
}
|
||||
|
||||
func (this *QMapDataBase) FreeTree(root *QMapNodeBase, alignment int) {
|
||||
C.QMapDataBase_FreeTree(this.h, root.cPointer(), (C.int)(alignment))
|
||||
}
|
||||
|
||||
func QMapDataBase_CreateData() *QMapDataBase {
|
||||
return UnsafeNewQMapDataBase(unsafe.Pointer(C.QMapDataBase_CreateData()))
|
||||
}
|
||||
|
||||
func QMapDataBase_FreeData(d *QMapDataBase) {
|
||||
C.QMapDataBase_FreeData(d.cPointer())
|
||||
}
|
||||
|
||||
// Delete this object from C++ memory.
|
||||
func (this *QMapDataBase) Delete() {
|
||||
C.QMapDataBase_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 *QMapDataBase) GoGC() {
|
||||
runtime.SetFinalizer(this, func(this *QMapDataBase) {
|
||||
this.Delete()
|
||||
runtime.KeepAlive(this.h)
|
||||
})
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
#ifndef GEN_QMAP_H
|
||||
#define GEN_QMAP_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#include "../libmiqt/libmiqt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
class QMapDataBase;
|
||||
class QMapNodeBase;
|
||||
#else
|
||||
typedef struct QMapDataBase QMapDataBase;
|
||||
typedef struct QMapNodeBase QMapNodeBase;
|
||||
#endif
|
||||
|
||||
QMapNodeBase* QMapNodeBase_new(QMapNodeBase* param1);
|
||||
QMapNodeBase* QMapNodeBase_NextNode(const QMapNodeBase* self);
|
||||
QMapNodeBase* QMapNodeBase_NextNode2(QMapNodeBase* self);
|
||||
QMapNodeBase* QMapNodeBase_PreviousNode(const QMapNodeBase* self);
|
||||
QMapNodeBase* QMapNodeBase_PreviousNode2(QMapNodeBase* self);
|
||||
int QMapNodeBase_Color(const QMapNodeBase* self);
|
||||
void QMapNodeBase_SetColor(QMapNodeBase* self, int c);
|
||||
QMapNodeBase* QMapNodeBase_Parent(const QMapNodeBase* self);
|
||||
void QMapNodeBase_SetParent(QMapNodeBase* self, QMapNodeBase* pp);
|
||||
void QMapNodeBase_OperatorAssign(QMapNodeBase* self, QMapNodeBase* param1);
|
||||
void QMapNodeBase_Delete(QMapNodeBase* self);
|
||||
|
||||
void QMapDataBase_RotateLeft(QMapDataBase* self, QMapNodeBase* x);
|
||||
void QMapDataBase_RotateRight(QMapDataBase* self, QMapNodeBase* x);
|
||||
void QMapDataBase_Rebalance(QMapDataBase* self, QMapNodeBase* x);
|
||||
void QMapDataBase_FreeNodeAndRebalance(QMapDataBase* self, QMapNodeBase* z);
|
||||
void QMapDataBase_RecalcMostLeftNode(QMapDataBase* self);
|
||||
QMapNodeBase* QMapDataBase_CreateNode(QMapDataBase* self, int size, int alignment, QMapNodeBase* parent, bool left);
|
||||
void QMapDataBase_FreeTree(QMapDataBase* self, QMapNodeBase* root, int alignment);
|
||||
QMapDataBase* QMapDataBase_CreateData();
|
||||
void QMapDataBase_FreeData(QMapDataBase* d);
|
||||
void QMapDataBase_Delete(QMapDataBase* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,8 +1,10 @@
|
||||
#include <QBrush>
|
||||
#include <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QFont>
|
||||
#include <QIcon>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
@ -555,6 +557,18 @@ struct miqt_string QStandardItemModel_TrUtf8(const char* s) {
|
||||
return _ms;
|
||||
}
|
||||
|
||||
void QStandardItemModel_SetItemRoleNames(QStandardItemModel* self, struct miqt_map roleNames) {
|
||||
QHash<int, QByteArray> roleNames_QMap;
|
||||
roleNames_QMap.reserve(roleNames.len);
|
||||
int* roleNames_karr = static_cast<int*>(roleNames.keys);
|
||||
struct miqt_string* roleNames_varr = static_cast<struct miqt_string*>(roleNames.values);
|
||||
for(size_t i = 0; i < roleNames.len; ++i) {
|
||||
QByteArray roleNames_varr_i_QByteArray(roleNames_varr[i].data, roleNames_varr[i].len);
|
||||
roleNames_QMap[static_cast<int>(roleNames_karr[i])] = roleNames_varr_i_QByteArray;
|
||||
}
|
||||
self->setItemRoleNames(roleNames_QMap);
|
||||
}
|
||||
|
||||
QModelIndex* QStandardItemModel_Index(const QStandardItemModel* self, int row, int column) {
|
||||
return new QModelIndex(self->index(static_cast<int>(row), static_cast<int>(column)));
|
||||
}
|
||||
@ -625,6 +639,34 @@ int QStandardItemModel_SupportedDropActions(const QStandardItemModel* self) {
|
||||
return static_cast<int>(_ret);
|
||||
}
|
||||
|
||||
struct miqt_map QStandardItemModel_ItemData(const QStandardItemModel* 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 QStandardItemModel_SetItemData(QStandardItemModel* 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);
|
||||
}
|
||||
|
||||
void QStandardItemModel_Clear(QStandardItemModel* self) {
|
||||
self->clear();
|
||||
}
|
||||
|
@ -658,6 +658,28 @@ func QStandardItemModel_TrUtf8(s string) string {
|
||||
return _ret
|
||||
}
|
||||
|
||||
func (this *QStandardItemModel) SetItemRoleNames(roleNames map[int][]byte) {
|
||||
roleNames_Keys_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(roleNames))))
|
||||
defer C.free(unsafe.Pointer(roleNames_Keys_CArray))
|
||||
roleNames_Values_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(roleNames))))
|
||||
defer C.free(unsafe.Pointer(roleNames_Values_CArray))
|
||||
roleNames_ctr := 0
|
||||
for roleNames_k, roleNames_v := range roleNames {
|
||||
roleNames_Keys_CArray[roleNames_ctr] = (C.int)(roleNames_k)
|
||||
roleNames_v_alias := C.struct_miqt_string{}
|
||||
roleNames_v_alias.data = (*C.char)(unsafe.Pointer(&roleNames_v[0]))
|
||||
roleNames_v_alias.len = C.size_t(len(roleNames_v))
|
||||
roleNames_Values_CArray[roleNames_ctr] = roleNames_v_alias
|
||||
roleNames_ctr++
|
||||
}
|
||||
roleNames_mm := C.struct_miqt_map{
|
||||
len: C.size_t(len(roleNames)),
|
||||
keys: unsafe.Pointer(roleNames_Keys_CArray),
|
||||
values: unsafe.Pointer(roleNames_Values_CArray),
|
||||
}
|
||||
C.QStandardItemModel_SetItemRoleNames(this.h, roleNames_mm)
|
||||
}
|
||||
|
||||
func (this *QStandardItemModel) Index(row int, column int) *QModelIndex {
|
||||
_ret := C.QStandardItemModel_Index(this.h, (C.int)(row), (C.int)(column))
|
||||
_goptr := newQModelIndex(_ret)
|
||||
@ -741,6 +763,43 @@ func (this *QStandardItemModel) SupportedDropActions() DropAction {
|
||||
return (DropAction)(C.QStandardItemModel_SupportedDropActions(this.h))
|
||||
}
|
||||
|
||||
func (this *QStandardItemModel) ItemData(index *QModelIndex) map[int]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QStandardItemModel_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 *QStandardItemModel) 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.QStandardItemModel_SetItemData(this.h, index.cPointer(), roles_mm))
|
||||
}
|
||||
|
||||
func (this *QStandardItemModel) Clear() {
|
||||
C.QStandardItemModel_Clear(this.h)
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ extern "C" {
|
||||
|
||||
#ifdef __cplusplus
|
||||
class QBrush;
|
||||
class QByteArray;
|
||||
class QDataStream;
|
||||
class QFont;
|
||||
class QIcon;
|
||||
@ -28,6 +29,7 @@ class QStandardItemModel;
|
||||
class QVariant;
|
||||
#else
|
||||
typedef struct QBrush QBrush;
|
||||
typedef struct QByteArray QByteArray;
|
||||
typedef struct QDataStream QDataStream;
|
||||
typedef struct QFont QFont;
|
||||
typedef struct QIcon QIcon;
|
||||
@ -146,6 +148,7 @@ QMetaObject* QStandardItemModel_MetaObject(const QStandardItemModel* self);
|
||||
void* QStandardItemModel_Metacast(QStandardItemModel* self, const char* param1);
|
||||
struct miqt_string QStandardItemModel_Tr(const char* s);
|
||||
struct miqt_string QStandardItemModel_TrUtf8(const char* s);
|
||||
void QStandardItemModel_SetItemRoleNames(QStandardItemModel* self, struct miqt_map roleNames);
|
||||
QModelIndex* QStandardItemModel_Index(const QStandardItemModel* self, int row, int column);
|
||||
QModelIndex* QStandardItemModel_Parent(const QStandardItemModel* self, QModelIndex* child);
|
||||
int QStandardItemModel_RowCount(const QStandardItemModel* self);
|
||||
@ -163,6 +166,8 @@ bool QStandardItemModel_RemoveRows(QStandardItemModel* self, int row, int count)
|
||||
bool QStandardItemModel_RemoveColumns(QStandardItemModel* self, int column, int count);
|
||||
int QStandardItemModel_Flags(const QStandardItemModel* self, QModelIndex* index);
|
||||
int QStandardItemModel_SupportedDropActions(const QStandardItemModel* self);
|
||||
struct miqt_map QStandardItemModel_ItemData(const QStandardItemModel* self, QModelIndex* index);
|
||||
bool QStandardItemModel_SetItemData(QStandardItemModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
void QStandardItemModel_Clear(QStandardItemModel* self);
|
||||
void QStandardItemModel_Sort(QStandardItemModel* self, int column);
|
||||
QStandardItem* QStandardItemModel_ItemFromIndex(const QStandardItemModel* self, QModelIndex* index);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QModelIndex>
|
||||
#include <QObject>
|
||||
@ -104,6 +105,34 @@ bool QStringListModel_MoveRows(QStringListModel* self, QModelIndex* sourceParent
|
||||
return self->moveRows(*sourceParent, static_cast<int>(sourceRow), static_cast<int>(count), *destinationParent, static_cast<int>(destinationChild));
|
||||
}
|
||||
|
||||
struct miqt_map QStringListModel_ItemData(const QStringListModel* 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 QStringListModel_SetItemData(QStringListModel* 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);
|
||||
}
|
||||
|
||||
void QStringListModel_Sort(QStringListModel* self, int column) {
|
||||
self->sort(static_cast<int>(column));
|
||||
}
|
||||
|
@ -153,6 +153,43 @@ func (this *QStringListModel) MoveRows(sourceParent *QModelIndex, sourceRow int,
|
||||
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))
|
||||
}
|
||||
|
||||
func (this *QStringListModel) Sort(column int) {
|
||||
C.QStringListModel_Sort(this.h, (C.int)(column))
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ int QStringListModel_Flags(const QStringListModel* self, QModelIndex* index);
|
||||
bool QStringListModel_InsertRows(QStringListModel* self, int row, int count);
|
||||
bool QStringListModel_RemoveRows(QStringListModel* self, int row, int count);
|
||||
bool QStringListModel_MoveRows(QStringListModel* self, QModelIndex* sourceParent, int sourceRow, int count, QModelIndex* destinationParent, int destinationChild);
|
||||
struct miqt_map QStringListModel_ItemData(const QStringListModel* self, QModelIndex* index);
|
||||
bool QStringListModel_SetItemData(QStringListModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
void QStringListModel_Sort(QStringListModel* self, int column);
|
||||
struct miqt_array QStringListModel_StringList(const QStringListModel* self);
|
||||
void QStringListModel_SetStringList(QStringListModel* self, struct miqt_array /* of struct miqt_string */ strings);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QPen>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
@ -183,6 +184,24 @@ void QTextFormat_SetProperty2(QTextFormat* self, int propertyId, struct miqt_arr
|
||||
self->setProperty(static_cast<int>(propertyId), lengths_QList);
|
||||
}
|
||||
|
||||
struct miqt_map QTextFormat_Properties(const QTextFormat* self) {
|
||||
QMap<int, QVariant> _ret = self->properties();
|
||||
// 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 QTextFormat_PropertyCount(const QTextFormat* self) {
|
||||
return self->propertyCount();
|
||||
}
|
||||
|
@ -498,6 +498,24 @@ func (this *QTextFormat) SetProperty2(propertyId int, lengths []QTextLength) {
|
||||
C.QTextFormat_SetProperty2(this.h, (C.int)(propertyId), lengths_ma)
|
||||
}
|
||||
|
||||
func (this *QTextFormat) Properties() map[int]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QTextFormat_Properties(this.h)
|
||||
_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 *QTextFormat) PropertyCount() int {
|
||||
return (int)(C.QTextFormat_PropertyCount(this.h))
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ QBrush* QTextFormat_BrushProperty(const QTextFormat* self, int propertyId);
|
||||
QTextLength* QTextFormat_LengthProperty(const QTextFormat* self, int propertyId);
|
||||
struct miqt_array QTextFormat_LengthVectorProperty(const QTextFormat* self, int propertyId);
|
||||
void QTextFormat_SetProperty2(QTextFormat* self, int propertyId, struct miqt_array /* of QTextLength* */ lengths);
|
||||
struct miqt_map QTextFormat_Properties(const QTextFormat* self);
|
||||
int QTextFormat_PropertyCount(const QTextFormat* self);
|
||||
void QTextFormat_SetObjectType(QTextFormat* self, int typeVal);
|
||||
int QTextFormat_ObjectType(const QTextFormat* self);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QModelIndex>
|
||||
#include <QObject>
|
||||
@ -70,10 +71,38 @@ bool QTransposeProxyModel_SetHeaderData(QTransposeProxyModel* self, int section,
|
||||
return self->setHeaderData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation), *value);
|
||||
}
|
||||
|
||||
bool QTransposeProxyModel_SetItemData(QTransposeProxyModel* 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);
|
||||
}
|
||||
|
||||
QSize* QTransposeProxyModel_Span(const QTransposeProxyModel* self, QModelIndex* index) {
|
||||
return new QSize(self->span(*index));
|
||||
}
|
||||
|
||||
struct miqt_map QTransposeProxyModel_ItemData(const QTransposeProxyModel* 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;
|
||||
}
|
||||
|
||||
QModelIndex* QTransposeProxyModel_MapFromSource(const QTransposeProxyModel* self, QModelIndex* sourceIndex) {
|
||||
return new QModelIndex(self->mapFromSource(*sourceIndex));
|
||||
}
|
||||
|
@ -106,6 +106,25 @@ func (this *QTransposeProxyModel) SetHeaderData(section int, orientation Orienta
|
||||
return (bool)(C.QTransposeProxyModel_SetHeaderData(this.h, (C.int)(section), (C.int)(orientation), value.cPointer()))
|
||||
}
|
||||
|
||||
func (this *QTransposeProxyModel) 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.QTransposeProxyModel_SetItemData(this.h, index.cPointer(), roles_mm))
|
||||
}
|
||||
|
||||
func (this *QTransposeProxyModel) Span(index *QModelIndex) *QSize {
|
||||
_ret := C.QTransposeProxyModel_Span(this.h, index.cPointer())
|
||||
_goptr := newQSize(_ret)
|
||||
@ -113,6 +132,24 @@ func (this *QTransposeProxyModel) Span(index *QModelIndex) *QSize {
|
||||
return _goptr
|
||||
}
|
||||
|
||||
func (this *QTransposeProxyModel) ItemData(index *QModelIndex) map[int]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QTransposeProxyModel_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 *QTransposeProxyModel) MapFromSource(sourceIndex *QModelIndex) *QModelIndex {
|
||||
_ret := C.QTransposeProxyModel_MapFromSource(this.h, sourceIndex.cPointer())
|
||||
_goptr := newQModelIndex(_ret)
|
||||
|
@ -42,7 +42,9 @@ int QTransposeProxyModel_RowCount(const QTransposeProxyModel* self);
|
||||
int QTransposeProxyModel_ColumnCount(const QTransposeProxyModel* self);
|
||||
QVariant* QTransposeProxyModel_HeaderData(const QTransposeProxyModel* self, int section, int orientation);
|
||||
bool QTransposeProxyModel_SetHeaderData(QTransposeProxyModel* self, int section, int orientation, QVariant* value);
|
||||
bool QTransposeProxyModel_SetItemData(QTransposeProxyModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
QSize* QTransposeProxyModel_Span(const QTransposeProxyModel* self, QModelIndex* index);
|
||||
struct miqt_map QTransposeProxyModel_ItemData(const QTransposeProxyModel* self, QModelIndex* index);
|
||||
QModelIndex* QTransposeProxyModel_MapFromSource(const QTransposeProxyModel* self, QModelIndex* sourceIndex);
|
||||
QModelIndex* QTransposeProxyModel_MapToSource(const QTransposeProxyModel* self, QModelIndex* proxyIndex);
|
||||
QModelIndex* QTransposeProxyModel_Parent(const QTransposeProxyModel* self, QModelIndex* index);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <QLineF>
|
||||
#include <QList>
|
||||
#include <QLocale>
|
||||
#include <QMap>
|
||||
#include <QModelIndex>
|
||||
#include <QPersistentModelIndex>
|
||||
#include <QPoint>
|
||||
@ -136,83 +137,106 @@ QVariant* QVariant_new22(QDateTime* datetime) {
|
||||
return new QVariant(*datetime);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new23(QSize* size) {
|
||||
QVariant* QVariant_new23(struct miqt_map mapVal) {
|
||||
QMap<QString, QVariant> 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 QVariant(mapVal_QMap);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new24(struct miqt_map hash) {
|
||||
QHash<QString, QVariant> 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 QVariant(hash_QMap);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new25(QSize* size) {
|
||||
return new QVariant(*size);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new24(QSizeF* size) {
|
||||
QVariant* QVariant_new26(QSizeF* size) {
|
||||
return new QVariant(*size);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new25(QPoint* pt) {
|
||||
QVariant* QVariant_new27(QPoint* pt) {
|
||||
return new QVariant(*pt);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new26(QPointF* pt) {
|
||||
QVariant* QVariant_new28(QPointF* pt) {
|
||||
return new QVariant(*pt);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new27(QLine* line) {
|
||||
QVariant* QVariant_new29(QLine* line) {
|
||||
return new QVariant(*line);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new28(QLineF* line) {
|
||||
QVariant* QVariant_new30(QLineF* line) {
|
||||
return new QVariant(*line);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new29(QRect* rect) {
|
||||
QVariant* QVariant_new31(QRect* rect) {
|
||||
return new QVariant(*rect);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new30(QRectF* rect) {
|
||||
QVariant* QVariant_new32(QRectF* rect) {
|
||||
return new QVariant(*rect);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new31(QLocale* locale) {
|
||||
QVariant* QVariant_new33(QLocale* locale) {
|
||||
return new QVariant(*locale);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new32(QRegExp* regExp) {
|
||||
QVariant* QVariant_new34(QRegExp* regExp) {
|
||||
return new QVariant(*regExp);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new33(QRegularExpression* re) {
|
||||
QVariant* QVariant_new35(QRegularExpression* re) {
|
||||
return new QVariant(*re);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new34(QEasingCurve* easing) {
|
||||
QVariant* QVariant_new36(QEasingCurve* easing) {
|
||||
return new QVariant(*easing);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new35(QUuid* uuid) {
|
||||
QVariant* QVariant_new37(QUuid* uuid) {
|
||||
return new QVariant(*uuid);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new36(QUrl* url) {
|
||||
QVariant* QVariant_new38(QUrl* url) {
|
||||
return new QVariant(*url);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new37(QJsonValue* jsonValue) {
|
||||
QVariant* QVariant_new39(QJsonValue* jsonValue) {
|
||||
return new QVariant(*jsonValue);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new38(QJsonObject* jsonObject) {
|
||||
QVariant* QVariant_new40(QJsonObject* jsonObject) {
|
||||
return new QVariant(*jsonObject);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new39(QJsonArray* jsonArray) {
|
||||
QVariant* QVariant_new41(QJsonArray* jsonArray) {
|
||||
return new QVariant(*jsonArray);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new40(QJsonDocument* jsonDocument) {
|
||||
QVariant* QVariant_new42(QJsonDocument* jsonDocument) {
|
||||
return new QVariant(*jsonDocument);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new41(QModelIndex* modelIndex) {
|
||||
QVariant* QVariant_new43(QModelIndex* modelIndex) {
|
||||
return new QVariant(*modelIndex);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new42(QPersistentModelIndex* modelIndex) {
|
||||
QVariant* QVariant_new44(QPersistentModelIndex* modelIndex) {
|
||||
return new QVariant(*modelIndex);
|
||||
}
|
||||
|
||||
@ -361,6 +385,56 @@ QDateTime* QVariant_ToDateTime(const QVariant* self) {
|
||||
return new QDateTime(self->toDateTime());
|
||||
}
|
||||
|
||||
struct miqt_map QVariant_ToMap(const QVariant* self) {
|
||||
QMap<QString, QVariant> _ret = self->toMap();
|
||||
// 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 QVariant_ToHash(const QVariant* self) {
|
||||
QHash<QString, QVariant> _ret = self->toHash();
|
||||
// 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;
|
||||
}
|
||||
|
||||
QPoint* QVariant_ToPoint(const QVariant* self) {
|
||||
return new QPoint(self->toPoint());
|
||||
}
|
||||
|
@ -261,122 +261,172 @@ func NewQVariant22(datetime *QDateTime) *QVariant {
|
||||
}
|
||||
|
||||
// NewQVariant23 constructs a new QVariant object.
|
||||
func NewQVariant23(size *QSize) *QVariant {
|
||||
ret := C.QVariant_new23(size.cPointer())
|
||||
func NewQVariant23(mapVal map[string]QVariant) *QVariant {
|
||||
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.QVariant_new23(mapVal_mm)
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant24 constructs a new QVariant object.
|
||||
func NewQVariant24(size *QSizeF) *QVariant {
|
||||
ret := C.QVariant_new24(size.cPointer())
|
||||
func NewQVariant24(hash map[string]QVariant) *QVariant {
|
||||
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.QVariant_new24(hash_mm)
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant25 constructs a new QVariant object.
|
||||
func NewQVariant25(pt *QPoint) *QVariant {
|
||||
ret := C.QVariant_new25(pt.cPointer())
|
||||
func NewQVariant25(size *QSize) *QVariant {
|
||||
ret := C.QVariant_new25(size.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant26 constructs a new QVariant object.
|
||||
func NewQVariant26(pt *QPointF) *QVariant {
|
||||
ret := C.QVariant_new26(pt.cPointer())
|
||||
func NewQVariant26(size *QSizeF) *QVariant {
|
||||
ret := C.QVariant_new26(size.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant27 constructs a new QVariant object.
|
||||
func NewQVariant27(line *QLine) *QVariant {
|
||||
ret := C.QVariant_new27(line.cPointer())
|
||||
func NewQVariant27(pt *QPoint) *QVariant {
|
||||
ret := C.QVariant_new27(pt.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant28 constructs a new QVariant object.
|
||||
func NewQVariant28(line *QLineF) *QVariant {
|
||||
ret := C.QVariant_new28(line.cPointer())
|
||||
func NewQVariant28(pt *QPointF) *QVariant {
|
||||
ret := C.QVariant_new28(pt.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant29 constructs a new QVariant object.
|
||||
func NewQVariant29(rect *QRect) *QVariant {
|
||||
ret := C.QVariant_new29(rect.cPointer())
|
||||
func NewQVariant29(line *QLine) *QVariant {
|
||||
ret := C.QVariant_new29(line.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant30 constructs a new QVariant object.
|
||||
func NewQVariant30(rect *QRectF) *QVariant {
|
||||
ret := C.QVariant_new30(rect.cPointer())
|
||||
func NewQVariant30(line *QLineF) *QVariant {
|
||||
ret := C.QVariant_new30(line.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant31 constructs a new QVariant object.
|
||||
func NewQVariant31(locale *QLocale) *QVariant {
|
||||
ret := C.QVariant_new31(locale.cPointer())
|
||||
func NewQVariant31(rect *QRect) *QVariant {
|
||||
ret := C.QVariant_new31(rect.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant32 constructs a new QVariant object.
|
||||
func NewQVariant32(regExp *QRegExp) *QVariant {
|
||||
ret := C.QVariant_new32(regExp.cPointer())
|
||||
func NewQVariant32(rect *QRectF) *QVariant {
|
||||
ret := C.QVariant_new32(rect.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant33 constructs a new QVariant object.
|
||||
func NewQVariant33(re *QRegularExpression) *QVariant {
|
||||
ret := C.QVariant_new33(re.cPointer())
|
||||
func NewQVariant33(locale *QLocale) *QVariant {
|
||||
ret := C.QVariant_new33(locale.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant34 constructs a new QVariant object.
|
||||
func NewQVariant34(easing *QEasingCurve) *QVariant {
|
||||
ret := C.QVariant_new34(easing.cPointer())
|
||||
func NewQVariant34(regExp *QRegExp) *QVariant {
|
||||
ret := C.QVariant_new34(regExp.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant35 constructs a new QVariant object.
|
||||
func NewQVariant35(uuid *QUuid) *QVariant {
|
||||
ret := C.QVariant_new35(uuid.cPointer())
|
||||
func NewQVariant35(re *QRegularExpression) *QVariant {
|
||||
ret := C.QVariant_new35(re.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant36 constructs a new QVariant object.
|
||||
func NewQVariant36(url *QUrl) *QVariant {
|
||||
ret := C.QVariant_new36(url.cPointer())
|
||||
func NewQVariant36(easing *QEasingCurve) *QVariant {
|
||||
ret := C.QVariant_new36(easing.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant37 constructs a new QVariant object.
|
||||
func NewQVariant37(jsonValue *QJsonValue) *QVariant {
|
||||
ret := C.QVariant_new37(jsonValue.cPointer())
|
||||
func NewQVariant37(uuid *QUuid) *QVariant {
|
||||
ret := C.QVariant_new37(uuid.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant38 constructs a new QVariant object.
|
||||
func NewQVariant38(jsonObject *QJsonObject) *QVariant {
|
||||
ret := C.QVariant_new38(jsonObject.cPointer())
|
||||
func NewQVariant38(url *QUrl) *QVariant {
|
||||
ret := C.QVariant_new38(url.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant39 constructs a new QVariant object.
|
||||
func NewQVariant39(jsonArray *QJsonArray) *QVariant {
|
||||
ret := C.QVariant_new39(jsonArray.cPointer())
|
||||
func NewQVariant39(jsonValue *QJsonValue) *QVariant {
|
||||
ret := C.QVariant_new39(jsonValue.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant40 constructs a new QVariant object.
|
||||
func NewQVariant40(jsonDocument *QJsonDocument) *QVariant {
|
||||
ret := C.QVariant_new40(jsonDocument.cPointer())
|
||||
func NewQVariant40(jsonObject *QJsonObject) *QVariant {
|
||||
ret := C.QVariant_new40(jsonObject.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant41 constructs a new QVariant object.
|
||||
func NewQVariant41(modelIndex *QModelIndex) *QVariant {
|
||||
ret := C.QVariant_new41(modelIndex.cPointer())
|
||||
func NewQVariant41(jsonArray *QJsonArray) *QVariant {
|
||||
ret := C.QVariant_new41(jsonArray.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant42 constructs a new QVariant object.
|
||||
func NewQVariant42(modelIndex *QPersistentModelIndex) *QVariant {
|
||||
ret := C.QVariant_new42(modelIndex.cPointer())
|
||||
func NewQVariant42(jsonDocument *QJsonDocument) *QVariant {
|
||||
ret := C.QVariant_new42(jsonDocument.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant43 constructs a new QVariant object.
|
||||
func NewQVariant43(modelIndex *QModelIndex) *QVariant {
|
||||
ret := C.QVariant_new43(modelIndex.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant44 constructs a new QVariant object.
|
||||
func NewQVariant44(modelIndex *QPersistentModelIndex) *QVariant {
|
||||
ret := C.QVariant_new44(modelIndex.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
@ -523,6 +573,46 @@ func (this *QVariant) ToDateTime() *QDateTime {
|
||||
return _goptr
|
||||
}
|
||||
|
||||
func (this *QVariant) ToMap() map[string]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QVariant_ToMap(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 *QVariant) ToHash() map[string]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QVariant_ToHash(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 *QVariant) ToPoint() *QPoint {
|
||||
_ret := C.QVariant_ToPoint(this.h)
|
||||
_goptr := newQPoint(_ret)
|
||||
|
@ -121,26 +121,28 @@ QVariant* QVariant_new19(QChar* qchar);
|
||||
QVariant* QVariant_new20(QDate* date);
|
||||
QVariant* QVariant_new21(QTime* time);
|
||||
QVariant* QVariant_new22(QDateTime* datetime);
|
||||
QVariant* QVariant_new23(QSize* size);
|
||||
QVariant* QVariant_new24(QSizeF* size);
|
||||
QVariant* QVariant_new25(QPoint* pt);
|
||||
QVariant* QVariant_new26(QPointF* pt);
|
||||
QVariant* QVariant_new27(QLine* line);
|
||||
QVariant* QVariant_new28(QLineF* line);
|
||||
QVariant* QVariant_new29(QRect* rect);
|
||||
QVariant* QVariant_new30(QRectF* rect);
|
||||
QVariant* QVariant_new31(QLocale* locale);
|
||||
QVariant* QVariant_new32(QRegExp* regExp);
|
||||
QVariant* QVariant_new33(QRegularExpression* re);
|
||||
QVariant* QVariant_new34(QEasingCurve* easing);
|
||||
QVariant* QVariant_new35(QUuid* uuid);
|
||||
QVariant* QVariant_new36(QUrl* url);
|
||||
QVariant* QVariant_new37(QJsonValue* jsonValue);
|
||||
QVariant* QVariant_new38(QJsonObject* jsonObject);
|
||||
QVariant* QVariant_new39(QJsonArray* jsonArray);
|
||||
QVariant* QVariant_new40(QJsonDocument* jsonDocument);
|
||||
QVariant* QVariant_new41(QModelIndex* modelIndex);
|
||||
QVariant* QVariant_new42(QPersistentModelIndex* modelIndex);
|
||||
QVariant* QVariant_new23(struct miqt_map mapVal);
|
||||
QVariant* QVariant_new24(struct miqt_map hash);
|
||||
QVariant* QVariant_new25(QSize* size);
|
||||
QVariant* QVariant_new26(QSizeF* size);
|
||||
QVariant* QVariant_new27(QPoint* pt);
|
||||
QVariant* QVariant_new28(QPointF* pt);
|
||||
QVariant* QVariant_new29(QLine* line);
|
||||
QVariant* QVariant_new30(QLineF* line);
|
||||
QVariant* QVariant_new31(QRect* rect);
|
||||
QVariant* QVariant_new32(QRectF* rect);
|
||||
QVariant* QVariant_new33(QLocale* locale);
|
||||
QVariant* QVariant_new34(QRegExp* regExp);
|
||||
QVariant* QVariant_new35(QRegularExpression* re);
|
||||
QVariant* QVariant_new36(QEasingCurve* easing);
|
||||
QVariant* QVariant_new37(QUuid* uuid);
|
||||
QVariant* QVariant_new38(QUrl* url);
|
||||
QVariant* QVariant_new39(QJsonValue* jsonValue);
|
||||
QVariant* QVariant_new40(QJsonObject* jsonObject);
|
||||
QVariant* QVariant_new41(QJsonArray* jsonArray);
|
||||
QVariant* QVariant_new42(QJsonDocument* jsonDocument);
|
||||
QVariant* QVariant_new43(QModelIndex* modelIndex);
|
||||
QVariant* QVariant_new44(QPersistentModelIndex* modelIndex);
|
||||
void QVariant_OperatorAssign(QVariant* self, QVariant* other);
|
||||
void QVariant_Swap(QVariant* self, QVariant* other);
|
||||
int QVariant_Type(const QVariant* self);
|
||||
@ -169,6 +171,8 @@ QChar* QVariant_ToChar(const QVariant* self);
|
||||
QDate* QVariant_ToDate(const QVariant* self);
|
||||
QTime* QVariant_ToTime(const QVariant* self);
|
||||
QDateTime* QVariant_ToDateTime(const QVariant* self);
|
||||
struct miqt_map QVariant_ToMap(const QVariant* self);
|
||||
struct miqt_map QVariant_ToHash(const QVariant* self);
|
||||
QPoint* QVariant_ToPoint(const QVariant* self);
|
||||
QPointF* QVariant_ToPointF(const QVariant* self);
|
||||
QRect* QVariant_ToRect(const QVariant* self);
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractListModel>
|
||||
#include <QAbstractTableModel>
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
@ -356,6 +358,34 @@ bool QAbstractItemModel_SetHeaderData(QAbstractItemModel* self, int section, int
|
||||
return self->setHeaderData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation), *value);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
bool QAbstractItemModel_ClearItemData(QAbstractItemModel* self, QModelIndex* index) {
|
||||
return self->clearItemData(*index);
|
||||
}
|
||||
@ -494,6 +524,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);
|
||||
}
|
||||
|
@ -611,6 +611,43 @@ 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) ClearItemData(index *QModelIndex) bool {
|
||||
return (bool)(C.QAbstractItemModel_ClearItemData(this.h, index.cPointer()))
|
||||
}
|
||||
@ -745,6 +782,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()))
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ extern "C" {
|
||||
class QAbstractItemModel;
|
||||
class QAbstractListModel;
|
||||
class QAbstractTableModel;
|
||||
class QByteArray;
|
||||
class QMetaObject;
|
||||
class QMimeData;
|
||||
class QModelIndex;
|
||||
@ -29,6 +30,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;
|
||||
@ -123,6 +125,8 @@ 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_map QAbstractItemModel_ItemData(const QAbstractItemModel* self, QModelIndex* index);
|
||||
bool QAbstractItemModel_SetItemData(QAbstractItemModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
bool QAbstractItemModel_ClearItemData(QAbstractItemModel* self, QModelIndex* index);
|
||||
struct miqt_array QAbstractItemModel_MimeTypes(const QAbstractItemModel* self);
|
||||
QMimeData* QAbstractItemModel_MimeData(const QAbstractItemModel* self, struct miqt_array /* of QModelIndex* */ indexes);
|
||||
@ -149,6 +153,7 @@ 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);
|
||||
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_MultiData(const QAbstractItemModel* self, QModelIndex* index, QModelRoleDataSpan* roleDataSpan);
|
||||
void QAbstractItemModel_DataChanged(QAbstractItemModel* self, QModelIndex* topLeft, QModelIndex* bottomRight);
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractProxyModel>
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
@ -64,6 +66,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);
|
||||
@ -73,6 +93,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);
|
||||
}
|
||||
@ -157,6 +187,29 @@ int QAbstractProxyModel_SupportedDropActions(const QAbstractProxyModel* self) {
|
||||
return static_cast<int>(_ret);
|
||||
}
|
||||
|
||||
struct miqt_map QAbstractProxyModel_RoleNames(const QAbstractProxyModel* 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;
|
||||
}
|
||||
|
||||
struct miqt_string QAbstractProxyModel_Tr2(const char* s, const char* c) {
|
||||
QString _ret = QAbstractProxyModel::tr(s, c);
|
||||
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
||||
|
@ -106,6 +106,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()))
|
||||
}
|
||||
@ -114,6 +132,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()))
|
||||
}
|
||||
@ -198,6 +235,23 @@ func (this *QAbstractProxyModel) SupportedDropActions() DropAction {
|
||||
return (DropAction)(C.QAbstractProxyModel_SupportedDropActions(this.h))
|
||||
}
|
||||
|
||||
func (this *QAbstractProxyModel) RoleNames() map[int][]byte {
|
||||
var _mm C.struct_miqt_map = C.QAbstractProxyModel_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 QAbstractProxyModel_Tr2(s string, c string) string {
|
||||
s_Cstring := C.CString(s)
|
||||
defer C.free(unsafe.Pointer(s_Cstring))
|
||||
|
@ -16,6 +16,7 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
class QAbstractItemModel;
|
||||
class QAbstractProxyModel;
|
||||
class QByteArray;
|
||||
class QMetaObject;
|
||||
class QMimeData;
|
||||
class QModelIndex;
|
||||
@ -24,6 +25,7 @@ class QVariant;
|
||||
#else
|
||||
typedef struct QAbstractItemModel QAbstractItemModel;
|
||||
typedef struct QAbstractProxyModel QAbstractProxyModel;
|
||||
typedef struct QByteArray QByteArray;
|
||||
typedef struct QMetaObject QMetaObject;
|
||||
typedef struct QMimeData QMimeData;
|
||||
typedef struct QModelIndex QModelIndex;
|
||||
@ -42,8 +44,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);
|
||||
bool QAbstractProxyModel_ClearItemData(QAbstractProxyModel* self, QModelIndex* index);
|
||||
QModelIndex* QAbstractProxyModel_Buddy(const QAbstractProxyModel* self, QModelIndex* index);
|
||||
@ -59,6 +63,7 @@ bool QAbstractProxyModel_DropMimeData(QAbstractProxyModel* self, QMimeData* data
|
||||
struct miqt_array QAbstractProxyModel_MimeTypes(const QAbstractProxyModel* self);
|
||||
int QAbstractProxyModel_SupportedDragActions(const QAbstractProxyModel* self);
|
||||
int QAbstractProxyModel_SupportedDropActions(const QAbstractProxyModel* self);
|
||||
struct miqt_map QAbstractProxyModel_RoleNames(const QAbstractProxyModel* self);
|
||||
struct miqt_string QAbstractProxyModel_Tr2(const char* s, const char* c);
|
||||
struct miqt_string QAbstractProxyModel_Tr3(const char* s, const char* c, int n);
|
||||
QVariant* QAbstractProxyModel_Data2(const QAbstractProxyModel* self, QModelIndex* proxyIndex, int role);
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <QCalendar>
|
||||
#include <QCalendarWidget>
|
||||
#include <QDate>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
@ -143,6 +144,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));
|
||||
}
|
||||
|
@ -222,6 +222,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)
|
||||
|
@ -61,6 +61,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);
|
||||
|
@ -6,9 +6,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"
|
||||
@ -257,10 +259,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());
|
||||
}
|
||||
|
@ -430,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)
|
||||
@ -437,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)
|
||||
|
@ -29,6 +29,7 @@ class QCborValue;
|
||||
class QCborValueConstRef;
|
||||
class QCborValueRef;
|
||||
class QJsonObject;
|
||||
class QVariant;
|
||||
#else
|
||||
typedef struct QCborMap QCborMap;
|
||||
typedef struct QCborMap__ConstIterator QCborMap__ConstIterator;
|
||||
@ -37,6 +38,7 @@ typedef struct QCborValue QCborValue;
|
||||
typedef struct QCborValueConstRef QCborValueConstRef;
|
||||
typedef struct QCborValueRef QCborValueRef;
|
||||
typedef struct QJsonObject QJsonObject;
|
||||
typedef struct QVariant QVariant;
|
||||
#endif
|
||||
|
||||
QCborMap* QCborMap_new();
|
||||
@ -95,7 +97,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);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QConcatenateTablesProxyModel>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
@ -78,6 +79,34 @@ bool QConcatenateTablesProxyModel_SetData(QConcatenateTablesProxyModel* self, QM
|
||||
return self->setData(*index, *value);
|
||||
}
|
||||
|
||||
struct miqt_map QConcatenateTablesProxyModel_ItemData(const QConcatenateTablesProxyModel* self, QModelIndex* proxyIndex) {
|
||||
QMap<int, QVariant> _ret = self->itemData(*proxyIndex);
|
||||
// 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 QConcatenateTablesProxyModel_SetItemData(QConcatenateTablesProxyModel* 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);
|
||||
}
|
||||
|
||||
int QConcatenateTablesProxyModel_Flags(const QConcatenateTablesProxyModel* self, QModelIndex* index) {
|
||||
Qt::ItemFlags _ret = self->flags(*index);
|
||||
return static_cast<int>(_ret);
|
||||
|
@ -117,6 +117,43 @@ func (this *QConcatenateTablesProxyModel) SetData(index *QModelIndex, value *QVa
|
||||
return (bool)(C.QConcatenateTablesProxyModel_SetData(this.h, index.cPointer(), value.cPointer()))
|
||||
}
|
||||
|
||||
func (this *QConcatenateTablesProxyModel) ItemData(proxyIndex *QModelIndex) map[int]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QConcatenateTablesProxyModel_ItemData(this.h, proxyIndex.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 *QConcatenateTablesProxyModel) 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.QConcatenateTablesProxyModel_SetItemData(this.h, index.cPointer(), roles_mm))
|
||||
}
|
||||
|
||||
func (this *QConcatenateTablesProxyModel) Flags(index *QModelIndex) ItemFlag {
|
||||
return (ItemFlag)(C.QConcatenateTablesProxyModel_Flags(this.h, index.cPointer()))
|
||||
}
|
||||
|
@ -45,6 +45,8 @@ QModelIndex* QConcatenateTablesProxyModel_MapFromSource(const QConcatenateTables
|
||||
QModelIndex* QConcatenateTablesProxyModel_MapToSource(const QConcatenateTablesProxyModel* self, QModelIndex* proxyIndex);
|
||||
QVariant* QConcatenateTablesProxyModel_Data(const QConcatenateTablesProxyModel* self, QModelIndex* index);
|
||||
bool QConcatenateTablesProxyModel_SetData(QConcatenateTablesProxyModel* self, QModelIndex* index, QVariant* value);
|
||||
struct miqt_map QConcatenateTablesProxyModel_ItemData(const QConcatenateTablesProxyModel* self, QModelIndex* proxyIndex);
|
||||
bool QConcatenateTablesProxyModel_SetItemData(QConcatenateTablesProxyModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
int QConcatenateTablesProxyModel_Flags(const QConcatenateTablesProxyModel* self, QModelIndex* index);
|
||||
QModelIndex* QConcatenateTablesProxyModel_Index(const QConcatenateTablesProxyModel* self, int row, int column);
|
||||
QModelIndex* QConcatenateTablesProxyModel_Parent(const QConcatenateTablesProxyModel* self, QModelIndex* index);
|
||||
|
@ -1,10 +1,12 @@
|
||||
#include <QAbstractFileIconProvider>
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QFileSystemModel>
|
||||
#include <QIcon>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
@ -220,6 +222,29 @@ int QFileSystemModel_SupportedDropActions(const QFileSystemModel* self) {
|
||||
return static_cast<int>(_ret);
|
||||
}
|
||||
|
||||
struct miqt_map QFileSystemModel_RoleNames(const QFileSystemModel* 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;
|
||||
}
|
||||
|
||||
QModelIndex* QFileSystemModel_SetRootPath(QFileSystemModel* self, struct miqt_string path) {
|
||||
QString path_QString = QString::fromUtf8(path.data, path.len);
|
||||
return new QModelIndex(self->setRootPath(path_QString));
|
||||
|
@ -305,6 +305,23 @@ func (this *QFileSystemModel) SupportedDropActions() DropAction {
|
||||
return (DropAction)(C.QFileSystemModel_SupportedDropActions(this.h))
|
||||
}
|
||||
|
||||
func (this *QFileSystemModel) RoleNames() map[int][]byte {
|
||||
var _mm C.struct_miqt_map = C.QFileSystemModel_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 *QFileSystemModel) SetRootPath(path string) *QModelIndex {
|
||||
path_ms := C.struct_miqt_string{}
|
||||
path_ms.data = C.CString(path)
|
||||
|
@ -15,6 +15,7 @@ extern "C" {
|
||||
|
||||
#ifdef __cplusplus
|
||||
class QAbstractFileIconProvider;
|
||||
class QByteArray;
|
||||
class QDateTime;
|
||||
class QDir;
|
||||
class QFileInfo;
|
||||
@ -27,6 +28,7 @@ class QObject;
|
||||
class QVariant;
|
||||
#else
|
||||
typedef struct QAbstractFileIconProvider QAbstractFileIconProvider;
|
||||
typedef struct QByteArray QByteArray;
|
||||
typedef struct QDateTime QDateTime;
|
||||
typedef struct QDir QDir;
|
||||
typedef struct QFileInfo QFileInfo;
|
||||
@ -69,6 +71,7 @@ struct miqt_array QFileSystemModel_MimeTypes(const QFileSystemModel* self);
|
||||
QMimeData* QFileSystemModel_MimeData(const QFileSystemModel* self, struct miqt_array /* of QModelIndex* */ indexes);
|
||||
bool QFileSystemModel_DropMimeData(QFileSystemModel* self, QMimeData* data, int action, int row, int column, QModelIndex* parent);
|
||||
int QFileSystemModel_SupportedDropActions(const QFileSystemModel* self);
|
||||
struct miqt_map QFileSystemModel_RoleNames(const QFileSystemModel* self);
|
||||
QModelIndex* QFileSystemModel_SetRootPath(QFileSystemModel* self, struct miqt_string path);
|
||||
struct miqt_string QFileSystemModel_RootPath(const QFileSystemModel* self);
|
||||
QDir* QFileSystemModel_RootDirectory(const QFileSystemModel* self);
|
||||
|
@ -1,26 +0,0 @@
|
||||
#include <QHashDummyValue>
|
||||
#define WORKAROUND_INNER_CLASS_DEFINITION_QHashPrivate__SpanConstants
|
||||
#include <qhash.h>
|
||||
#include "gen_qhash.h"
|
||||
#include "_cgo_export.h"
|
||||
|
||||
QHashDummyValue* QHashDummyValue_new() {
|
||||
return new QHashDummyValue();
|
||||
}
|
||||
|
||||
QHashDummyValue* QHashDummyValue_new2(QHashDummyValue* param1) {
|
||||
return new QHashDummyValue(*param1);
|
||||
}
|
||||
|
||||
bool QHashDummyValue_OperatorEqual(const QHashDummyValue* self, QHashDummyValue* param1) {
|
||||
return self->operator==(*param1);
|
||||
}
|
||||
|
||||
void QHashDummyValue_Delete(QHashDummyValue* self) {
|
||||
delete self;
|
||||
}
|
||||
|
||||
void QHashPrivate__SpanConstants_Delete(QHashPrivate__SpanConstants* self) {
|
||||
delete self;
|
||||
}
|
||||
|
116
qt6/gen_qhash.go
116
qt6/gen_qhash.go
@ -1,116 +0,0 @@
|
||||
package qt6
|
||||
|
||||
/*
|
||||
|
||||
#include "gen_qhash.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type QHashDummyValue struct {
|
||||
h *C.QHashDummyValue
|
||||
}
|
||||
|
||||
func (this *QHashDummyValue) cPointer() *C.QHashDummyValue {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return this.h
|
||||
}
|
||||
|
||||
func (this *QHashDummyValue) UnsafePointer() unsafe.Pointer {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(this.h)
|
||||
}
|
||||
|
||||
func newQHashDummyValue(h *C.QHashDummyValue) *QHashDummyValue {
|
||||
if h == nil {
|
||||
return nil
|
||||
}
|
||||
return &QHashDummyValue{h: h}
|
||||
}
|
||||
|
||||
func UnsafeNewQHashDummyValue(h unsafe.Pointer) *QHashDummyValue {
|
||||
return newQHashDummyValue((*C.QHashDummyValue)(h))
|
||||
}
|
||||
|
||||
// NewQHashDummyValue constructs a new QHashDummyValue object.
|
||||
func NewQHashDummyValue() *QHashDummyValue {
|
||||
ret := C.QHashDummyValue_new()
|
||||
return newQHashDummyValue(ret)
|
||||
}
|
||||
|
||||
// NewQHashDummyValue2 constructs a new QHashDummyValue object.
|
||||
func NewQHashDummyValue2(param1 *QHashDummyValue) *QHashDummyValue {
|
||||
ret := C.QHashDummyValue_new2(param1.cPointer())
|
||||
return newQHashDummyValue(ret)
|
||||
}
|
||||
|
||||
func (this *QHashDummyValue) OperatorEqual(param1 *QHashDummyValue) bool {
|
||||
return (bool)(C.QHashDummyValue_OperatorEqual(this.h, param1.cPointer()))
|
||||
}
|
||||
|
||||
// Delete this object from C++ memory.
|
||||
func (this *QHashDummyValue) Delete() {
|
||||
C.QHashDummyValue_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 *QHashDummyValue) GoGC() {
|
||||
runtime.SetFinalizer(this, func(this *QHashDummyValue) {
|
||||
this.Delete()
|
||||
runtime.KeepAlive(this.h)
|
||||
})
|
||||
}
|
||||
|
||||
type QHashPrivate__SpanConstants struct {
|
||||
h *C.QHashPrivate__SpanConstants
|
||||
}
|
||||
|
||||
func (this *QHashPrivate__SpanConstants) cPointer() *C.QHashPrivate__SpanConstants {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return this.h
|
||||
}
|
||||
|
||||
func (this *QHashPrivate__SpanConstants) UnsafePointer() unsafe.Pointer {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return unsafe.Pointer(this.h)
|
||||
}
|
||||
|
||||
func newQHashPrivate__SpanConstants(h *C.QHashPrivate__SpanConstants) *QHashPrivate__SpanConstants {
|
||||
if h == nil {
|
||||
return nil
|
||||
}
|
||||
return &QHashPrivate__SpanConstants{h: h}
|
||||
}
|
||||
|
||||
func UnsafeNewQHashPrivate__SpanConstants(h unsafe.Pointer) *QHashPrivate__SpanConstants {
|
||||
return newQHashPrivate__SpanConstants((*C.QHashPrivate__SpanConstants)(h))
|
||||
}
|
||||
|
||||
// Delete this object from C++ memory.
|
||||
func (this *QHashPrivate__SpanConstants) Delete() {
|
||||
C.QHashPrivate__SpanConstants_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 *QHashPrivate__SpanConstants) GoGC() {
|
||||
runtime.SetFinalizer(this, func(this *QHashPrivate__SpanConstants) {
|
||||
this.Delete()
|
||||
runtime.KeepAlive(this.h)
|
||||
})
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
#ifndef GEN_QHASH_H
|
||||
#define GEN_QHASH_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#include "../libmiqt/libmiqt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
class QHashDummyValue;
|
||||
#if defined(WORKAROUND_INNER_CLASS_DEFINITION_QHashPrivate__SpanConstants)
|
||||
typedef QHashPrivate::SpanConstants QHashPrivate__SpanConstants;
|
||||
#else
|
||||
class QHashPrivate__SpanConstants;
|
||||
#endif
|
||||
#else
|
||||
typedef struct QHashDummyValue QHashDummyValue;
|
||||
typedef struct QHashPrivate__SpanConstants QHashPrivate__SpanConstants;
|
||||
#endif
|
||||
|
||||
QHashDummyValue* QHashDummyValue_new();
|
||||
QHashDummyValue* QHashDummyValue_new2(QHashDummyValue* param1);
|
||||
bool QHashDummyValue_OperatorEqual(const QHashDummyValue* self, QHashDummyValue* param1);
|
||||
void QHashDummyValue_Delete(QHashDummyValue* self);
|
||||
|
||||
void QHashPrivate__SpanConstants_Delete(QHashPrivate__SpanConstants* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
||||
#endif
|
@ -5,9 +5,11 @@
|
||||
#include <QJsonValueConstRef>
|
||||
#include <QJsonValueRef>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <cstring>
|
||||
#include <QVariant>
|
||||
#include <qjsonobject.h>
|
||||
#include "gen_qjsonobject.h"
|
||||
#include "_cgo_export.h"
|
||||
@ -28,6 +30,79 @@ void QJsonObject_Swap(QJsonObject* self, QJsonObject* other) {
|
||||
self->swap(*other);
|
||||
}
|
||||
|
||||
QJsonObject* QJsonObject_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 QJsonObject(QJsonObject::fromVariantMap(mapVal_QMap));
|
||||
}
|
||||
|
||||
struct miqt_map QJsonObject_ToVariantMap(const QJsonObject* 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;
|
||||
}
|
||||
|
||||
QJsonObject* QJsonObject_FromVariantHash(struct miqt_map mapVal) {
|
||||
QVariantHash mapVal_QMap;
|
||||
mapVal_QMap.reserve(mapVal.len);
|
||||
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 QJsonObject(QJsonObject::fromVariantHash(mapVal_QMap));
|
||||
}
|
||||
|
||||
struct miqt_map QJsonObject_ToVariantHash(const QJsonObject* 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;
|
||||
}
|
||||
|
||||
struct miqt_array QJsonObject_Keys(const QJsonObject* self) {
|
||||
QStringList _ret = self->keys();
|
||||
// Convert QList<> from C++ memory to manually-managed C memory
|
||||
|
@ -62,6 +62,98 @@ func (this *QJsonObject) Swap(other *QJsonObject) {
|
||||
C.QJsonObject_Swap(this.h, other.cPointer())
|
||||
}
|
||||
|
||||
func QJsonObject_FromVariantMap(mapVal map[string]QVariant) *QJsonObject {
|
||||
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.QJsonObject_FromVariantMap(mapVal_mm)
|
||||
_goptr := newQJsonObject(_ret)
|
||||
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||||
return _goptr
|
||||
}
|
||||
|
||||
func (this *QJsonObject) ToVariantMap() map[string]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QJsonObject_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 QJsonObject_FromVariantHash(mapVal map[string]QVariant) *QJsonObject {
|
||||
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.QJsonObject_FromVariantHash(mapVal_mm)
|
||||
_goptr := newQJsonObject(_ret)
|
||||
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||||
return _goptr
|
||||
}
|
||||
|
||||
func (this *QJsonObject) ToVariantHash() map[string]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QJsonObject_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 *QJsonObject) Keys() []string {
|
||||
var _ma C.struct_miqt_array = C.QJsonObject_Keys(this.h)
|
||||
_ret := make([]string, int(_ma.len))
|
||||
|
@ -28,6 +28,7 @@ class QJsonObject__iterator;
|
||||
class QJsonValue;
|
||||
class QJsonValueConstRef;
|
||||
class QJsonValueRef;
|
||||
class QVariant;
|
||||
#else
|
||||
typedef struct QJsonObject QJsonObject;
|
||||
typedef struct QJsonObject__const_iterator QJsonObject__const_iterator;
|
||||
@ -35,12 +36,17 @@ typedef struct QJsonObject__iterator QJsonObject__iterator;
|
||||
typedef struct QJsonValue QJsonValue;
|
||||
typedef struct QJsonValueConstRef QJsonValueConstRef;
|
||||
typedef struct QJsonValueRef QJsonValueRef;
|
||||
typedef struct QVariant QVariant;
|
||||
#endif
|
||||
|
||||
QJsonObject* QJsonObject_new();
|
||||
QJsonObject* QJsonObject_new2(QJsonObject* other);
|
||||
void QJsonObject_OperatorAssign(QJsonObject* self, QJsonObject* other);
|
||||
void QJsonObject_Swap(QJsonObject* self, QJsonObject* other);
|
||||
QJsonObject* QJsonObject_FromVariantMap(struct miqt_map mapVal);
|
||||
struct miqt_map QJsonObject_ToVariantMap(const QJsonObject* self);
|
||||
QJsonObject* QJsonObject_FromVariantHash(struct miqt_map mapVal);
|
||||
struct miqt_map QJsonObject_ToVariantHash(const QJsonObject* self);
|
||||
struct miqt_array QJsonObject_Keys(const QJsonObject* self);
|
||||
ptrdiff_t QJsonObject_Size(const QJsonObject* self);
|
||||
ptrdiff_t QJsonObject_Count(const QJsonObject* self);
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include <QBrush>
|
||||
#include <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QFont>
|
||||
#include <QIcon>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QMimeData>
|
||||
#include <QModelIndex>
|
||||
@ -541,6 +543,41 @@ struct miqt_string QStandardItemModel_Tr(const char* s) {
|
||||
return _ms;
|
||||
}
|
||||
|
||||
void QStandardItemModel_SetItemRoleNames(QStandardItemModel* self, struct miqt_map roleNames) {
|
||||
QHash<int, QByteArray> roleNames_QMap;
|
||||
roleNames_QMap.reserve(roleNames.len);
|
||||
int* roleNames_karr = static_cast<int*>(roleNames.keys);
|
||||
struct miqt_string* roleNames_varr = static_cast<struct miqt_string*>(roleNames.values);
|
||||
for(size_t i = 0; i < roleNames.len; ++i) {
|
||||
QByteArray roleNames_varr_i_QByteArray(roleNames_varr[i].data, roleNames_varr[i].len);
|
||||
roleNames_QMap[static_cast<int>(roleNames_karr[i])] = roleNames_varr_i_QByteArray;
|
||||
}
|
||||
self->setItemRoleNames(roleNames_QMap);
|
||||
}
|
||||
|
||||
struct miqt_map QStandardItemModel_RoleNames(const QStandardItemModel* 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;
|
||||
}
|
||||
|
||||
QModelIndex* QStandardItemModel_Index(const QStandardItemModel* self, int row, int column) {
|
||||
return new QModelIndex(self->index(static_cast<int>(row), static_cast<int>(column)));
|
||||
}
|
||||
@ -611,6 +648,34 @@ int QStandardItemModel_SupportedDropActions(const QStandardItemModel* self) {
|
||||
return static_cast<int>(_ret);
|
||||
}
|
||||
|
||||
struct miqt_map QStandardItemModel_ItemData(const QStandardItemModel* 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 QStandardItemModel_SetItemData(QStandardItemModel* 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);
|
||||
}
|
||||
|
||||
void QStandardItemModel_Clear(QStandardItemModel* self) {
|
||||
self->clear();
|
||||
}
|
||||
|
@ -645,6 +645,45 @@ func QStandardItemModel_Tr(s string) string {
|
||||
return _ret
|
||||
}
|
||||
|
||||
func (this *QStandardItemModel) SetItemRoleNames(roleNames map[int][]byte) {
|
||||
roleNames_Keys_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(roleNames))))
|
||||
defer C.free(unsafe.Pointer(roleNames_Keys_CArray))
|
||||
roleNames_Values_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(roleNames))))
|
||||
defer C.free(unsafe.Pointer(roleNames_Values_CArray))
|
||||
roleNames_ctr := 0
|
||||
for roleNames_k, roleNames_v := range roleNames {
|
||||
roleNames_Keys_CArray[roleNames_ctr] = (C.int)(roleNames_k)
|
||||
roleNames_v_alias := C.struct_miqt_string{}
|
||||
roleNames_v_alias.data = (*C.char)(unsafe.Pointer(&roleNames_v[0]))
|
||||
roleNames_v_alias.len = C.size_t(len(roleNames_v))
|
||||
roleNames_Values_CArray[roleNames_ctr] = roleNames_v_alias
|
||||
roleNames_ctr++
|
||||
}
|
||||
roleNames_mm := C.struct_miqt_map{
|
||||
len: C.size_t(len(roleNames)),
|
||||
keys: unsafe.Pointer(roleNames_Keys_CArray),
|
||||
values: unsafe.Pointer(roleNames_Values_CArray),
|
||||
}
|
||||
C.QStandardItemModel_SetItemRoleNames(this.h, roleNames_mm)
|
||||
}
|
||||
|
||||
func (this *QStandardItemModel) RoleNames() map[int][]byte {
|
||||
var _mm C.struct_miqt_map = C.QStandardItemModel_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 *QStandardItemModel) Index(row int, column int) *QModelIndex {
|
||||
_ret := C.QStandardItemModel_Index(this.h, (C.int)(row), (C.int)(column))
|
||||
_goptr := newQModelIndex(_ret)
|
||||
@ -725,6 +764,43 @@ func (this *QStandardItemModel) SupportedDropActions() DropAction {
|
||||
return (DropAction)(C.QStandardItemModel_SupportedDropActions(this.h))
|
||||
}
|
||||
|
||||
func (this *QStandardItemModel) ItemData(index *QModelIndex) map[int]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QStandardItemModel_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 *QStandardItemModel) 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.QStandardItemModel_SetItemData(this.h, index.cPointer(), roles_mm))
|
||||
}
|
||||
|
||||
func (this *QStandardItemModel) Clear() {
|
||||
C.QStandardItemModel_Clear(this.h)
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ extern "C" {
|
||||
|
||||
#ifdef __cplusplus
|
||||
class QBrush;
|
||||
class QByteArray;
|
||||
class QDataStream;
|
||||
class QFont;
|
||||
class QIcon;
|
||||
@ -29,6 +30,7 @@ class QStandardItemModel;
|
||||
class QVariant;
|
||||
#else
|
||||
typedef struct QBrush QBrush;
|
||||
typedef struct QByteArray QByteArray;
|
||||
typedef struct QDataStream QDataStream;
|
||||
typedef struct QFont QFont;
|
||||
typedef struct QIcon QIcon;
|
||||
@ -146,6 +148,8 @@ QStandardItemModel* QStandardItemModel_new4(int rows, int columns, QObject* pare
|
||||
QMetaObject* QStandardItemModel_MetaObject(const QStandardItemModel* self);
|
||||
void* QStandardItemModel_Metacast(QStandardItemModel* self, const char* param1);
|
||||
struct miqt_string QStandardItemModel_Tr(const char* s);
|
||||
void QStandardItemModel_SetItemRoleNames(QStandardItemModel* self, struct miqt_map roleNames);
|
||||
struct miqt_map QStandardItemModel_RoleNames(const QStandardItemModel* self);
|
||||
QModelIndex* QStandardItemModel_Index(const QStandardItemModel* self, int row, int column);
|
||||
QModelIndex* QStandardItemModel_Parent(const QStandardItemModel* self, QModelIndex* child);
|
||||
int QStandardItemModel_RowCount(const QStandardItemModel* self);
|
||||
@ -163,6 +167,8 @@ bool QStandardItemModel_RemoveRows(QStandardItemModel* self, int row, int count)
|
||||
bool QStandardItemModel_RemoveColumns(QStandardItemModel* self, int column, int count);
|
||||
int QStandardItemModel_Flags(const QStandardItemModel* self, QModelIndex* index);
|
||||
int QStandardItemModel_SupportedDropActions(const QStandardItemModel* self);
|
||||
struct miqt_map QStandardItemModel_ItemData(const QStandardItemModel* self, QModelIndex* index);
|
||||
bool QStandardItemModel_SetItemData(QStandardItemModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
void QStandardItemModel_Clear(QStandardItemModel* self);
|
||||
void QStandardItemModel_Sort(QStandardItemModel* self, int column);
|
||||
QStandardItem* QStandardItemModel_ItemFromIndex(const QStandardItemModel* self, QModelIndex* index);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QModelIndex>
|
||||
#include <QObject>
|
||||
@ -97,6 +98,34 @@ bool QStringListModel_MoveRows(QStringListModel* self, QModelIndex* sourceParent
|
||||
return self->moveRows(*sourceParent, static_cast<int>(sourceRow), static_cast<int>(count), *destinationParent, static_cast<int>(destinationChild));
|
||||
}
|
||||
|
||||
struct miqt_map QStringListModel_ItemData(const QStringListModel* 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 QStringListModel_SetItemData(QStringListModel* 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);
|
||||
}
|
||||
|
||||
void QStringListModel_Sort(QStringListModel* self, int column) {
|
||||
self->sort(static_cast<int>(column));
|
||||
}
|
||||
|
@ -148,6 +148,43 @@ func (this *QStringListModel) MoveRows(sourceParent *QModelIndex, sourceRow int,
|
||||
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))
|
||||
}
|
||||
|
||||
func (this *QStringListModel) Sort(column int) {
|
||||
C.QStringListModel_Sort(this.h, (C.int)(column))
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ int QStringListModel_Flags(const QStringListModel* self, QModelIndex* index);
|
||||
bool QStringListModel_InsertRows(QStringListModel* self, int row, int count);
|
||||
bool QStringListModel_RemoveRows(QStringListModel* self, int row, int count);
|
||||
bool QStringListModel_MoveRows(QStringListModel* self, QModelIndex* sourceParent, int sourceRow, int count, QModelIndex* destinationParent, int destinationChild);
|
||||
struct miqt_map QStringListModel_ItemData(const QStringListModel* self, QModelIndex* index);
|
||||
bool QStringListModel_SetItemData(QStringListModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
void QStringListModel_Sort(QStringListModel* self, int column);
|
||||
struct miqt_array QStringListModel_StringList(const QStringListModel* self);
|
||||
void QStringListModel_SetStringList(QStringListModel* self, struct miqt_array /* of struct miqt_string */ strings);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QPen>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
@ -183,6 +184,24 @@ void QTextFormat_SetProperty2(QTextFormat* self, int propertyId, struct miqt_arr
|
||||
self->setProperty(static_cast<int>(propertyId), lengths_QList);
|
||||
}
|
||||
|
||||
struct miqt_map QTextFormat_Properties(const QTextFormat* self) {
|
||||
QMap<int, QVariant> _ret = self->properties();
|
||||
// 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 QTextFormat_PropertyCount(const QTextFormat* self) {
|
||||
return self->propertyCount();
|
||||
}
|
||||
|
@ -504,6 +504,24 @@ func (this *QTextFormat) SetProperty2(propertyId int, lengths []QTextLength) {
|
||||
C.QTextFormat_SetProperty2(this.h, (C.int)(propertyId), lengths_ma)
|
||||
}
|
||||
|
||||
func (this *QTextFormat) Properties() map[int]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QTextFormat_Properties(this.h)
|
||||
_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 *QTextFormat) PropertyCount() int {
|
||||
return (int)(C.QTextFormat_PropertyCount(this.h))
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ QBrush* QTextFormat_BrushProperty(const QTextFormat* self, int propertyId);
|
||||
QTextLength* QTextFormat_LengthProperty(const QTextFormat* self, int propertyId);
|
||||
struct miqt_array QTextFormat_LengthVectorProperty(const QTextFormat* self, int propertyId);
|
||||
void QTextFormat_SetProperty2(QTextFormat* self, int propertyId, struct miqt_array /* of QTextLength* */ lengths);
|
||||
struct miqt_map QTextFormat_Properties(const QTextFormat* self);
|
||||
int QTextFormat_PropertyCount(const QTextFormat* self);
|
||||
void QTextFormat_SetObjectType(QTextFormat* self, int typeVal);
|
||||
int QTextFormat_ObjectType(const QTextFormat* self);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QMap>
|
||||
#include <QMetaObject>
|
||||
#include <QModelIndex>
|
||||
#include <QObject>
|
||||
@ -59,10 +60,38 @@ bool QTransposeProxyModel_SetHeaderData(QTransposeProxyModel* self, int section,
|
||||
return self->setHeaderData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation), *value);
|
||||
}
|
||||
|
||||
bool QTransposeProxyModel_SetItemData(QTransposeProxyModel* 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);
|
||||
}
|
||||
|
||||
QSize* QTransposeProxyModel_Span(const QTransposeProxyModel* self, QModelIndex* index) {
|
||||
return new QSize(self->span(*index));
|
||||
}
|
||||
|
||||
struct miqt_map QTransposeProxyModel_ItemData(const QTransposeProxyModel* 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;
|
||||
}
|
||||
|
||||
QModelIndex* QTransposeProxyModel_MapFromSource(const QTransposeProxyModel* self, QModelIndex* sourceIndex) {
|
||||
return new QModelIndex(self->mapFromSource(*sourceIndex));
|
||||
}
|
||||
|
@ -97,6 +97,25 @@ func (this *QTransposeProxyModel) SetHeaderData(section int, orientation Orienta
|
||||
return (bool)(C.QTransposeProxyModel_SetHeaderData(this.h, (C.int)(section), (C.int)(orientation), value.cPointer()))
|
||||
}
|
||||
|
||||
func (this *QTransposeProxyModel) 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.QTransposeProxyModel_SetItemData(this.h, index.cPointer(), roles_mm))
|
||||
}
|
||||
|
||||
func (this *QTransposeProxyModel) Span(index *QModelIndex) *QSize {
|
||||
_ret := C.QTransposeProxyModel_Span(this.h, index.cPointer())
|
||||
_goptr := newQSize(_ret)
|
||||
@ -104,6 +123,24 @@ func (this *QTransposeProxyModel) Span(index *QModelIndex) *QSize {
|
||||
return _goptr
|
||||
}
|
||||
|
||||
func (this *QTransposeProxyModel) ItemData(index *QModelIndex) map[int]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QTransposeProxyModel_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 *QTransposeProxyModel) MapFromSource(sourceIndex *QModelIndex) *QModelIndex {
|
||||
_ret := C.QTransposeProxyModel_MapFromSource(this.h, sourceIndex.cPointer())
|
||||
_goptr := newQModelIndex(_ret)
|
||||
|
@ -41,7 +41,9 @@ int QTransposeProxyModel_RowCount(const QTransposeProxyModel* self);
|
||||
int QTransposeProxyModel_ColumnCount(const QTransposeProxyModel* self);
|
||||
QVariant* QTransposeProxyModel_HeaderData(const QTransposeProxyModel* self, int section, int orientation);
|
||||
bool QTransposeProxyModel_SetHeaderData(QTransposeProxyModel* self, int section, int orientation, QVariant* value);
|
||||
bool QTransposeProxyModel_SetItemData(QTransposeProxyModel* self, QModelIndex* index, struct miqt_map roles);
|
||||
QSize* QTransposeProxyModel_Span(const QTransposeProxyModel* self, QModelIndex* index);
|
||||
struct miqt_map QTransposeProxyModel_ItemData(const QTransposeProxyModel* self, QModelIndex* index);
|
||||
QModelIndex* QTransposeProxyModel_MapFromSource(const QTransposeProxyModel* self, QModelIndex* sourceIndex);
|
||||
QModelIndex* QTransposeProxyModel_MapToSource(const QTransposeProxyModel* self, QModelIndex* proxyIndex);
|
||||
QModelIndex* QTransposeProxyModel_Parent(const QTransposeProxyModel* self, QModelIndex* index);
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <QLineF>
|
||||
#include <QList>
|
||||
#include <QLocale>
|
||||
#include <QMap>
|
||||
#include <QMetaType>
|
||||
#include <QModelIndex>
|
||||
#include <QPartialOrdering>
|
||||
@ -122,87 +123,110 @@ QVariant* QVariant_new19(QDateTime* datetime) {
|
||||
return new QVariant(*datetime);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new20(QSize* size) {
|
||||
QVariant* QVariant_new20(struct miqt_map mapVal) {
|
||||
QMap<QString, QVariant> 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 QVariant(mapVal_QMap);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new21(struct miqt_map hash) {
|
||||
QHash<QString, QVariant> 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 QVariant(hash_QMap);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new22(QSize* size) {
|
||||
return new QVariant(*size);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new21(QSizeF* size) {
|
||||
QVariant* QVariant_new23(QSizeF* size) {
|
||||
return new QVariant(*size);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new22(QPoint* pt) {
|
||||
QVariant* QVariant_new24(QPoint* pt) {
|
||||
return new QVariant(*pt);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new23(QPointF* pt) {
|
||||
QVariant* QVariant_new25(QPointF* pt) {
|
||||
return new QVariant(*pt);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new24(QLine* line) {
|
||||
QVariant* QVariant_new26(QLine* line) {
|
||||
return new QVariant(*line);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new25(QLineF* line) {
|
||||
QVariant* QVariant_new27(QLineF* line) {
|
||||
return new QVariant(*line);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new26(QRect* rect) {
|
||||
QVariant* QVariant_new28(QRect* rect) {
|
||||
return new QVariant(*rect);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new27(QRectF* rect) {
|
||||
QVariant* QVariant_new29(QRectF* rect) {
|
||||
return new QVariant(*rect);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new28(QLocale* locale) {
|
||||
QVariant* QVariant_new30(QLocale* locale) {
|
||||
return new QVariant(*locale);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new29(QRegularExpression* re) {
|
||||
QVariant* QVariant_new31(QRegularExpression* re) {
|
||||
return new QVariant(*re);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new30(QEasingCurve* easing) {
|
||||
QVariant* QVariant_new32(QEasingCurve* easing) {
|
||||
return new QVariant(*easing);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new31(QUuid* uuid) {
|
||||
QVariant* QVariant_new33(QUuid* uuid) {
|
||||
return new QVariant(*uuid);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new32(QUrl* url) {
|
||||
QVariant* QVariant_new34(QUrl* url) {
|
||||
return new QVariant(*url);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new33(QJsonValue* jsonValue) {
|
||||
QVariant* QVariant_new35(QJsonValue* jsonValue) {
|
||||
return new QVariant(*jsonValue);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new34(QJsonObject* jsonObject) {
|
||||
QVariant* QVariant_new36(QJsonObject* jsonObject) {
|
||||
return new QVariant(*jsonObject);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new35(QJsonArray* jsonArray) {
|
||||
QVariant* QVariant_new37(QJsonArray* jsonArray) {
|
||||
return new QVariant(*jsonArray);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new36(QJsonDocument* jsonDocument) {
|
||||
QVariant* QVariant_new38(QJsonDocument* jsonDocument) {
|
||||
return new QVariant(*jsonDocument);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new37(QModelIndex* modelIndex) {
|
||||
QVariant* QVariant_new39(QModelIndex* modelIndex) {
|
||||
return new QVariant(*modelIndex);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new38(QPersistentModelIndex* modelIndex) {
|
||||
QVariant* QVariant_new40(QPersistentModelIndex* modelIndex) {
|
||||
return new QVariant(*modelIndex);
|
||||
}
|
||||
|
||||
QVariant* QVariant_new39(int typeVal) {
|
||||
QVariant* QVariant_new41(int typeVal) {
|
||||
return new QVariant(static_cast<QVariant::Type>(typeVal));
|
||||
}
|
||||
|
||||
QVariant* QVariant_new40(QMetaType* typeVal, const void* copyVal) {
|
||||
QVariant* QVariant_new42(QMetaType* typeVal, const void* copyVal) {
|
||||
return new QVariant(*typeVal, copyVal);
|
||||
}
|
||||
|
||||
@ -366,6 +390,56 @@ QDateTime* QVariant_ToDateTime(const QVariant* self) {
|
||||
return new QDateTime(self->toDateTime());
|
||||
}
|
||||
|
||||
struct miqt_map QVariant_ToMap(const QVariant* self) {
|
||||
QMap<QString, QVariant> _ret = self->toMap();
|
||||
// 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 QVariant_ToHash(const QVariant* self) {
|
||||
QHash<QString, QVariant> _ret = self->toHash();
|
||||
// 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;
|
||||
}
|
||||
|
||||
QPoint* QVariant_ToPoint(const QVariant* self) {
|
||||
return new QPoint(self->toPoint());
|
||||
}
|
||||
|
@ -241,128 +241,178 @@ func NewQVariant19(datetime *QDateTime) *QVariant {
|
||||
}
|
||||
|
||||
// NewQVariant20 constructs a new QVariant object.
|
||||
func NewQVariant20(size *QSize) *QVariant {
|
||||
ret := C.QVariant_new20(size.cPointer())
|
||||
func NewQVariant20(mapVal map[string]QVariant) *QVariant {
|
||||
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.QVariant_new20(mapVal_mm)
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant21 constructs a new QVariant object.
|
||||
func NewQVariant21(size *QSizeF) *QVariant {
|
||||
ret := C.QVariant_new21(size.cPointer())
|
||||
func NewQVariant21(hash map[string]QVariant) *QVariant {
|
||||
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.QVariant_new21(hash_mm)
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant22 constructs a new QVariant object.
|
||||
func NewQVariant22(pt *QPoint) *QVariant {
|
||||
ret := C.QVariant_new22(pt.cPointer())
|
||||
func NewQVariant22(size *QSize) *QVariant {
|
||||
ret := C.QVariant_new22(size.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant23 constructs a new QVariant object.
|
||||
func NewQVariant23(pt *QPointF) *QVariant {
|
||||
ret := C.QVariant_new23(pt.cPointer())
|
||||
func NewQVariant23(size *QSizeF) *QVariant {
|
||||
ret := C.QVariant_new23(size.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant24 constructs a new QVariant object.
|
||||
func NewQVariant24(line *QLine) *QVariant {
|
||||
ret := C.QVariant_new24(line.cPointer())
|
||||
func NewQVariant24(pt *QPoint) *QVariant {
|
||||
ret := C.QVariant_new24(pt.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant25 constructs a new QVariant object.
|
||||
func NewQVariant25(line *QLineF) *QVariant {
|
||||
ret := C.QVariant_new25(line.cPointer())
|
||||
func NewQVariant25(pt *QPointF) *QVariant {
|
||||
ret := C.QVariant_new25(pt.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant26 constructs a new QVariant object.
|
||||
func NewQVariant26(rect *QRect) *QVariant {
|
||||
ret := C.QVariant_new26(rect.cPointer())
|
||||
func NewQVariant26(line *QLine) *QVariant {
|
||||
ret := C.QVariant_new26(line.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant27 constructs a new QVariant object.
|
||||
func NewQVariant27(rect *QRectF) *QVariant {
|
||||
ret := C.QVariant_new27(rect.cPointer())
|
||||
func NewQVariant27(line *QLineF) *QVariant {
|
||||
ret := C.QVariant_new27(line.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant28 constructs a new QVariant object.
|
||||
func NewQVariant28(locale *QLocale) *QVariant {
|
||||
ret := C.QVariant_new28(locale.cPointer())
|
||||
func NewQVariant28(rect *QRect) *QVariant {
|
||||
ret := C.QVariant_new28(rect.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant29 constructs a new QVariant object.
|
||||
func NewQVariant29(re *QRegularExpression) *QVariant {
|
||||
ret := C.QVariant_new29(re.cPointer())
|
||||
func NewQVariant29(rect *QRectF) *QVariant {
|
||||
ret := C.QVariant_new29(rect.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant30 constructs a new QVariant object.
|
||||
func NewQVariant30(easing *QEasingCurve) *QVariant {
|
||||
ret := C.QVariant_new30(easing.cPointer())
|
||||
func NewQVariant30(locale *QLocale) *QVariant {
|
||||
ret := C.QVariant_new30(locale.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant31 constructs a new QVariant object.
|
||||
func NewQVariant31(uuid *QUuid) *QVariant {
|
||||
ret := C.QVariant_new31(uuid.cPointer())
|
||||
func NewQVariant31(re *QRegularExpression) *QVariant {
|
||||
ret := C.QVariant_new31(re.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant32 constructs a new QVariant object.
|
||||
func NewQVariant32(url *QUrl) *QVariant {
|
||||
ret := C.QVariant_new32(url.cPointer())
|
||||
func NewQVariant32(easing *QEasingCurve) *QVariant {
|
||||
ret := C.QVariant_new32(easing.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant33 constructs a new QVariant object.
|
||||
func NewQVariant33(jsonValue *QJsonValue) *QVariant {
|
||||
ret := C.QVariant_new33(jsonValue.cPointer())
|
||||
func NewQVariant33(uuid *QUuid) *QVariant {
|
||||
ret := C.QVariant_new33(uuid.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant34 constructs a new QVariant object.
|
||||
func NewQVariant34(jsonObject *QJsonObject) *QVariant {
|
||||
ret := C.QVariant_new34(jsonObject.cPointer())
|
||||
func NewQVariant34(url *QUrl) *QVariant {
|
||||
ret := C.QVariant_new34(url.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant35 constructs a new QVariant object.
|
||||
func NewQVariant35(jsonArray *QJsonArray) *QVariant {
|
||||
ret := C.QVariant_new35(jsonArray.cPointer())
|
||||
func NewQVariant35(jsonValue *QJsonValue) *QVariant {
|
||||
ret := C.QVariant_new35(jsonValue.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant36 constructs a new QVariant object.
|
||||
func NewQVariant36(jsonDocument *QJsonDocument) *QVariant {
|
||||
ret := C.QVariant_new36(jsonDocument.cPointer())
|
||||
func NewQVariant36(jsonObject *QJsonObject) *QVariant {
|
||||
ret := C.QVariant_new36(jsonObject.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant37 constructs a new QVariant object.
|
||||
func NewQVariant37(modelIndex *QModelIndex) *QVariant {
|
||||
ret := C.QVariant_new37(modelIndex.cPointer())
|
||||
func NewQVariant37(jsonArray *QJsonArray) *QVariant {
|
||||
ret := C.QVariant_new37(jsonArray.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant38 constructs a new QVariant object.
|
||||
func NewQVariant38(modelIndex *QPersistentModelIndex) *QVariant {
|
||||
ret := C.QVariant_new38(modelIndex.cPointer())
|
||||
func NewQVariant38(jsonDocument *QJsonDocument) *QVariant {
|
||||
ret := C.QVariant_new38(jsonDocument.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant39 constructs a new QVariant object.
|
||||
func NewQVariant39(typeVal QVariant__Type) *QVariant {
|
||||
ret := C.QVariant_new39((C.int)(typeVal))
|
||||
func NewQVariant39(modelIndex *QModelIndex) *QVariant {
|
||||
ret := C.QVariant_new39(modelIndex.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant40 constructs a new QVariant object.
|
||||
func NewQVariant40(typeVal QMetaType, copyVal unsafe.Pointer) *QVariant {
|
||||
ret := C.QVariant_new40(typeVal.cPointer(), copyVal)
|
||||
func NewQVariant40(modelIndex *QPersistentModelIndex) *QVariant {
|
||||
ret := C.QVariant_new40(modelIndex.cPointer())
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant41 constructs a new QVariant object.
|
||||
func NewQVariant41(typeVal QVariant__Type) *QVariant {
|
||||
ret := C.QVariant_new41((C.int)(typeVal))
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
// NewQVariant42 constructs a new QVariant object.
|
||||
func NewQVariant42(typeVal QMetaType, copyVal unsafe.Pointer) *QVariant {
|
||||
ret := C.QVariant_new42(typeVal.cPointer(), copyVal)
|
||||
return newQVariant(ret)
|
||||
}
|
||||
|
||||
@ -528,6 +578,46 @@ func (this *QVariant) ToDateTime() *QDateTime {
|
||||
return _goptr
|
||||
}
|
||||
|
||||
func (this *QVariant) ToMap() map[string]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QVariant_ToMap(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 *QVariant) ToHash() map[string]QVariant {
|
||||
var _mm C.struct_miqt_map = C.QVariant_ToHash(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 *QVariant) ToPoint() *QPoint {
|
||||
_ret := C.QVariant_ToPoint(this.h)
|
||||
_goptr := newQPoint(_ret)
|
||||
|
@ -102,27 +102,29 @@ QVariant* QVariant_new16(QChar* qchar);
|
||||
QVariant* QVariant_new17(QDate* date);
|
||||
QVariant* QVariant_new18(QTime* time);
|
||||
QVariant* QVariant_new19(QDateTime* datetime);
|
||||
QVariant* QVariant_new20(QSize* size);
|
||||
QVariant* QVariant_new21(QSizeF* size);
|
||||
QVariant* QVariant_new22(QPoint* pt);
|
||||
QVariant* QVariant_new23(QPointF* pt);
|
||||
QVariant* QVariant_new24(QLine* line);
|
||||
QVariant* QVariant_new25(QLineF* line);
|
||||
QVariant* QVariant_new26(QRect* rect);
|
||||
QVariant* QVariant_new27(QRectF* rect);
|
||||
QVariant* QVariant_new28(QLocale* locale);
|
||||
QVariant* QVariant_new29(QRegularExpression* re);
|
||||
QVariant* QVariant_new30(QEasingCurve* easing);
|
||||
QVariant* QVariant_new31(QUuid* uuid);
|
||||
QVariant* QVariant_new32(QUrl* url);
|
||||
QVariant* QVariant_new33(QJsonValue* jsonValue);
|
||||
QVariant* QVariant_new34(QJsonObject* jsonObject);
|
||||
QVariant* QVariant_new35(QJsonArray* jsonArray);
|
||||
QVariant* QVariant_new36(QJsonDocument* jsonDocument);
|
||||
QVariant* QVariant_new37(QModelIndex* modelIndex);
|
||||
QVariant* QVariant_new38(QPersistentModelIndex* modelIndex);
|
||||
QVariant* QVariant_new39(int typeVal);
|
||||
QVariant* QVariant_new40(QMetaType* typeVal, const void* copyVal);
|
||||
QVariant* QVariant_new20(struct miqt_map mapVal);
|
||||
QVariant* QVariant_new21(struct miqt_map hash);
|
||||
QVariant* QVariant_new22(QSize* size);
|
||||
QVariant* QVariant_new23(QSizeF* size);
|
||||
QVariant* QVariant_new24(QPoint* pt);
|
||||
QVariant* QVariant_new25(QPointF* pt);
|
||||
QVariant* QVariant_new26(QLine* line);
|
||||
QVariant* QVariant_new27(QLineF* line);
|
||||
QVariant* QVariant_new28(QRect* rect);
|
||||
QVariant* QVariant_new29(QRectF* rect);
|
||||
QVariant* QVariant_new30(QLocale* locale);
|
||||
QVariant* QVariant_new31(QRegularExpression* re);
|
||||
QVariant* QVariant_new32(QEasingCurve* easing);
|
||||
QVariant* QVariant_new33(QUuid* uuid);
|
||||
QVariant* QVariant_new34(QUrl* url);
|
||||
QVariant* QVariant_new35(QJsonValue* jsonValue);
|
||||
QVariant* QVariant_new36(QJsonObject* jsonObject);
|
||||
QVariant* QVariant_new37(QJsonArray* jsonArray);
|
||||
QVariant* QVariant_new38(QJsonDocument* jsonDocument);
|
||||
QVariant* QVariant_new39(QModelIndex* modelIndex);
|
||||
QVariant* QVariant_new40(QPersistentModelIndex* modelIndex);
|
||||
QVariant* QVariant_new41(int typeVal);
|
||||
QVariant* QVariant_new42(QMetaType* typeVal, const void* copyVal);
|
||||
void QVariant_OperatorAssign(QVariant* self, QVariant* other);
|
||||
void QVariant_Swap(QVariant* self, QVariant* other);
|
||||
int QVariant_UserType(const QVariant* self);
|
||||
@ -155,6 +157,8 @@ QChar* QVariant_ToChar(const QVariant* self);
|
||||
QDate* QVariant_ToDate(const QVariant* self);
|
||||
QTime* QVariant_ToTime(const QVariant* self);
|
||||
QDateTime* QVariant_ToDateTime(const QVariant* self);
|
||||
struct miqt_map QVariant_ToMap(const QVariant* self);
|
||||
struct miqt_map QVariant_ToHash(const QVariant* self);
|
||||
QPoint* QVariant_ToPoint(const QVariant* self);
|
||||
QPointF* QVariant_ToPointF(const QVariant* self);
|
||||
QRect* QVariant_ToRect(const QVariant* self);
|
||||
|
Loading…
Reference in New Issue
Block a user