mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
544 lines
15 KiB
C++
544 lines
15 KiB
C++
#include <QAnyStringView>
|
|
#include <QBindingStorage>
|
|
#include <QByteArray>
|
|
#include <QChildEvent>
|
|
#include <QEvent>
|
|
#include <QList>
|
|
#include <QMetaMethod>
|
|
#include <QMetaObject>
|
|
#define WORKAROUND_INNER_CLASS_DEFINITION_QMetaObject__Connection
|
|
#include <QObject>
|
|
#include <QObjectData>
|
|
#include <QSignalBlocker>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <QThread>
|
|
#include <QTimerEvent>
|
|
#include <QVariant>
|
|
#include <qobject.h>
|
|
#include "gen_qobject.h"
|
|
#include "_cgo_export.h"
|
|
|
|
QMetaObject* QObjectData_DynamicMetaObject(const QObjectData* self) {
|
|
return self->dynamicMetaObject();
|
|
}
|
|
|
|
void QObjectData_Delete(QObjectData* self, bool isSubclass) {
|
|
if (isSubclass) {
|
|
delete dynamic_cast<QObjectData*>( self );
|
|
} else {
|
|
delete self;
|
|
}
|
|
}
|
|
|
|
class MiqtVirtualQObject : public virtual QObject {
|
|
public:
|
|
|
|
MiqtVirtualQObject(): QObject() {};
|
|
MiqtVirtualQObject(QObject* parent): QObject(parent) {};
|
|
|
|
virtual ~MiqtVirtualQObject() = default;
|
|
|
|
// cgo.Handle value for overwritten implementation
|
|
intptr_t handle__Event = 0;
|
|
|
|
// Subclass to allow providing a Go implementation
|
|
virtual bool event(QEvent* event) override {
|
|
if (handle__Event == 0) {
|
|
return QObject::event(event);
|
|
}
|
|
|
|
QEvent* sigval1 = event;
|
|
|
|
bool callback_return_value = miqt_exec_callback_QObject_Event(this, handle__Event, sigval1);
|
|
|
|
return callback_return_value;
|
|
}
|
|
|
|
// Wrapper to allow calling protected method
|
|
bool virtualbase_Event(QEvent* event) {
|
|
|
|
return QObject::event(event);
|
|
|
|
}
|
|
|
|
// cgo.Handle value for overwritten implementation
|
|
intptr_t handle__EventFilter = 0;
|
|
|
|
// Subclass to allow providing a Go implementation
|
|
virtual bool eventFilter(QObject* watched, QEvent* event) override {
|
|
if (handle__EventFilter == 0) {
|
|
return QObject::eventFilter(watched, event);
|
|
}
|
|
|
|
QObject* sigval1 = watched;
|
|
QEvent* sigval2 = event;
|
|
|
|
bool callback_return_value = miqt_exec_callback_QObject_EventFilter(this, handle__EventFilter, sigval1, sigval2);
|
|
|
|
return callback_return_value;
|
|
}
|
|
|
|
// Wrapper to allow calling protected method
|
|
bool virtualbase_EventFilter(QObject* watched, QEvent* event) {
|
|
|
|
return QObject::eventFilter(watched, event);
|
|
|
|
}
|
|
|
|
// cgo.Handle value for overwritten implementation
|
|
intptr_t handle__TimerEvent = 0;
|
|
|
|
// Subclass to allow providing a Go implementation
|
|
virtual void timerEvent(QTimerEvent* event) override {
|
|
if (handle__TimerEvent == 0) {
|
|
QObject::timerEvent(event);
|
|
return;
|
|
}
|
|
|
|
QTimerEvent* sigval1 = event;
|
|
|
|
miqt_exec_callback_QObject_TimerEvent(this, handle__TimerEvent, sigval1);
|
|
|
|
|
|
}
|
|
|
|
// Wrapper to allow calling protected method
|
|
void virtualbase_TimerEvent(QTimerEvent* event) {
|
|
|
|
QObject::timerEvent(event);
|
|
|
|
}
|
|
|
|
// cgo.Handle value for overwritten implementation
|
|
intptr_t handle__ChildEvent = 0;
|
|
|
|
// Subclass to allow providing a Go implementation
|
|
virtual void childEvent(QChildEvent* event) override {
|
|
if (handle__ChildEvent == 0) {
|
|
QObject::childEvent(event);
|
|
return;
|
|
}
|
|
|
|
QChildEvent* sigval1 = event;
|
|
|
|
miqt_exec_callback_QObject_ChildEvent(this, handle__ChildEvent, sigval1);
|
|
|
|
|
|
}
|
|
|
|
// Wrapper to allow calling protected method
|
|
void virtualbase_ChildEvent(QChildEvent* event) {
|
|
|
|
QObject::childEvent(event);
|
|
|
|
}
|
|
|
|
// cgo.Handle value for overwritten implementation
|
|
intptr_t handle__CustomEvent = 0;
|
|
|
|
// Subclass to allow providing a Go implementation
|
|
virtual void customEvent(QEvent* event) override {
|
|
if (handle__CustomEvent == 0) {
|
|
QObject::customEvent(event);
|
|
return;
|
|
}
|
|
|
|
QEvent* sigval1 = event;
|
|
|
|
miqt_exec_callback_QObject_CustomEvent(this, handle__CustomEvent, sigval1);
|
|
|
|
|
|
}
|
|
|
|
// Wrapper to allow calling protected method
|
|
void virtualbase_CustomEvent(QEvent* event) {
|
|
|
|
QObject::customEvent(event);
|
|
|
|
}
|
|
|
|
// cgo.Handle value for overwritten implementation
|
|
intptr_t handle__ConnectNotify = 0;
|
|
|
|
// Subclass to allow providing a Go implementation
|
|
virtual void connectNotify(const QMetaMethod& signal) override {
|
|
if (handle__ConnectNotify == 0) {
|
|
QObject::connectNotify(signal);
|
|
return;
|
|
}
|
|
|
|
const QMetaMethod& signal_ret = signal;
|
|
// Cast returned reference into pointer
|
|
QMetaMethod* sigval1 = const_cast<QMetaMethod*>(&signal_ret);
|
|
|
|
miqt_exec_callback_QObject_ConnectNotify(this, handle__ConnectNotify, sigval1);
|
|
|
|
|
|
}
|
|
|
|
// Wrapper to allow calling protected method
|
|
void virtualbase_ConnectNotify(QMetaMethod* signal) {
|
|
|
|
QObject::connectNotify(*signal);
|
|
|
|
}
|
|
|
|
// cgo.Handle value for overwritten implementation
|
|
intptr_t handle__DisconnectNotify = 0;
|
|
|
|
// Subclass to allow providing a Go implementation
|
|
virtual void disconnectNotify(const QMetaMethod& signal) override {
|
|
if (handle__DisconnectNotify == 0) {
|
|
QObject::disconnectNotify(signal);
|
|
return;
|
|
}
|
|
|
|
const QMetaMethod& signal_ret = signal;
|
|
// Cast returned reference into pointer
|
|
QMetaMethod* sigval1 = const_cast<QMetaMethod*>(&signal_ret);
|
|
|
|
miqt_exec_callback_QObject_DisconnectNotify(this, handle__DisconnectNotify, sigval1);
|
|
|
|
|
|
}
|
|
|
|
// Wrapper to allow calling protected method
|
|
void virtualbase_DisconnectNotify(QMetaMethod* signal) {
|
|
|
|
QObject::disconnectNotify(*signal);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
void QObject_new(QObject** outptr_QObject) {
|
|
MiqtVirtualQObject* ret = new MiqtVirtualQObject();
|
|
*outptr_QObject = ret;
|
|
}
|
|
|
|
void QObject_new2(QObject* parent, QObject** outptr_QObject) {
|
|
MiqtVirtualQObject* ret = new MiqtVirtualQObject(parent);
|
|
*outptr_QObject = ret;
|
|
}
|
|
|
|
QMetaObject* QObject_MetaObject(const QObject* self) {
|
|
return (QMetaObject*) self->metaObject();
|
|
}
|
|
|
|
void* QObject_Metacast(QObject* self, const char* param1) {
|
|
return self->qt_metacast(param1);
|
|
}
|
|
|
|
struct miqt_string QObject_Tr(const char* s) {
|
|
QString _ret = QObject::tr(s);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
bool QObject_Event(QObject* self, QEvent* event) {
|
|
return self->event(event);
|
|
}
|
|
|
|
bool QObject_EventFilter(QObject* self, QObject* watched, QEvent* event) {
|
|
return self->eventFilter(watched, event);
|
|
}
|
|
|
|
struct miqt_string QObject_ObjectName(const QObject* self) {
|
|
QString _ret = self->objectName();
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
void QObject_SetObjectName(QObject* self, QAnyStringView* name) {
|
|
self->setObjectName(*name);
|
|
}
|
|
|
|
bool QObject_IsWidgetType(const QObject* self) {
|
|
return self->isWidgetType();
|
|
}
|
|
|
|
bool QObject_IsWindowType(const QObject* self) {
|
|
return self->isWindowType();
|
|
}
|
|
|
|
bool QObject_IsQuickItemType(const QObject* self) {
|
|
return self->isQuickItemType();
|
|
}
|
|
|
|
bool QObject_SignalsBlocked(const QObject* self) {
|
|
return self->signalsBlocked();
|
|
}
|
|
|
|
bool QObject_BlockSignals(QObject* self, bool b) {
|
|
return self->blockSignals(b);
|
|
}
|
|
|
|
QThread* QObject_Thread(const QObject* self) {
|
|
return self->thread();
|
|
}
|
|
|
|
void QObject_MoveToThread(QObject* self, QThread* thread) {
|
|
self->moveToThread(thread);
|
|
}
|
|
|
|
int QObject_StartTimer(QObject* self, int interval) {
|
|
return self->startTimer(static_cast<int>(interval));
|
|
}
|
|
|
|
void QObject_KillTimer(QObject* self, int id) {
|
|
self->killTimer(static_cast<int>(id));
|
|
}
|
|
|
|
struct miqt_array /* of QObject* */ QObject_Children(const QObject* self) {
|
|
const QObjectList& _ret = self->children();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
QObject** _arr = static_cast<QObject**>(malloc(sizeof(QObject*) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
_arr[i] = _ret[i];
|
|
}
|
|
struct miqt_array _out;
|
|
_out.len = _ret.length();
|
|
_out.data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
void QObject_SetParent(QObject* self, QObject* parent) {
|
|
self->setParent(parent);
|
|
}
|
|
|
|
void QObject_InstallEventFilter(QObject* self, QObject* filterObj) {
|
|
self->installEventFilter(filterObj);
|
|
}
|
|
|
|
void QObject_RemoveEventFilter(QObject* self, QObject* obj) {
|
|
self->removeEventFilter(obj);
|
|
}
|
|
|
|
QMetaObject__Connection* QObject_Connect(QObject* sender, QMetaMethod* signal, QObject* receiver, QMetaMethod* method) {
|
|
return new QMetaObject::Connection(QObject::connect(sender, *signal, receiver, *method));
|
|
}
|
|
|
|
QMetaObject__Connection* QObject_Connect2(const QObject* self, QObject* sender, const char* signal, const char* member) {
|
|
return new QMetaObject::Connection(self->connect(sender, signal, member));
|
|
}
|
|
|
|
bool QObject_Disconnect(QObject* sender, QMetaMethod* signal, QObject* receiver, QMetaMethod* member) {
|
|
return QObject::disconnect(sender, *signal, receiver, *member);
|
|
}
|
|
|
|
bool QObject_DisconnectWithQMetaObjectConnection(QMetaObject__Connection* param1) {
|
|
return QObject::disconnect(*param1);
|
|
}
|
|
|
|
void QObject_DumpObjectTree(const QObject* self) {
|
|
self->dumpObjectTree();
|
|
}
|
|
|
|
void QObject_DumpObjectInfo(const QObject* self) {
|
|
self->dumpObjectInfo();
|
|
}
|
|
|
|
bool QObject_SetProperty(QObject* self, const char* name, QVariant* value) {
|
|
return self->setProperty(name, *value);
|
|
}
|
|
|
|
QVariant* QObject_Property(const QObject* self, const char* name) {
|
|
return new QVariant(self->property(name));
|
|
}
|
|
|
|
struct miqt_array /* of struct miqt_string */ QObject_DynamicPropertyNames(const QObject* self) {
|
|
QList<QByteArray> _ret = self->dynamicPropertyNames();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array _out;
|
|
_out.len = _ret.length();
|
|
_out.data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
QBindingStorage* QObject_BindingStorage(QObject* self) {
|
|
return self->bindingStorage();
|
|
}
|
|
|
|
QBindingStorage* QObject_BindingStorage2(const QObject* self) {
|
|
return (QBindingStorage*) self->bindingStorage();
|
|
}
|
|
|
|
void QObject_Destroyed(QObject* self) {
|
|
self->destroyed();
|
|
}
|
|
|
|
void QObject_connect_Destroyed(QObject* self, intptr_t slot) {
|
|
MiqtVirtualQObject::connect(self, static_cast<void (QObject::*)(QObject*)>(&QObject::destroyed), self, [=]() {
|
|
miqt_exec_callback_QObject_Destroyed(slot);
|
|
});
|
|
}
|
|
|
|
QObject* QObject_Parent(const QObject* self) {
|
|
return self->parent();
|
|
}
|
|
|
|
bool QObject_Inherits(const QObject* self, const char* classname) {
|
|
return self->inherits(classname);
|
|
}
|
|
|
|
void QObject_DeleteLater(QObject* self) {
|
|
self->deleteLater();
|
|
}
|
|
|
|
struct miqt_string QObject_Tr2(const char* s, const char* c) {
|
|
QString _ret = QObject::tr(s, c);
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
struct miqt_string QObject_Tr3(const char* s, const char* c, int n) {
|
|
QString _ret = QObject::tr(s, c, static_cast<int>(n));
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
struct miqt_string _ms;
|
|
_ms.len = _b.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _b.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
int QObject_StartTimer2(QObject* self, int interval, int timerType) {
|
|
return self->startTimer(static_cast<int>(interval), static_cast<Qt::TimerType>(timerType));
|
|
}
|
|
|
|
QMetaObject__Connection* QObject_Connect5(QObject* sender, QMetaMethod* signal, QObject* receiver, QMetaMethod* method, int typeVal) {
|
|
return new QMetaObject::Connection(QObject::connect(sender, *signal, receiver, *method, static_cast<Qt::ConnectionType>(typeVal)));
|
|
}
|
|
|
|
QMetaObject__Connection* QObject_Connect4(const QObject* self, QObject* sender, const char* signal, const char* member, int typeVal) {
|
|
return new QMetaObject::Connection(self->connect(sender, signal, member, static_cast<Qt::ConnectionType>(typeVal)));
|
|
}
|
|
|
|
void QObject_Destroyed1(QObject* self, QObject* param1) {
|
|
self->destroyed(param1);
|
|
}
|
|
|
|
void QObject_connect_Destroyed1(QObject* self, intptr_t slot) {
|
|
MiqtVirtualQObject::connect(self, static_cast<void (QObject::*)(QObject*)>(&QObject::destroyed), self, [=](QObject* param1) {
|
|
QObject* sigval1 = param1;
|
|
miqt_exec_callback_QObject_Destroyed1(slot, sigval1);
|
|
});
|
|
}
|
|
|
|
void QObject_override_virtual_Event(void* self, intptr_t slot) {
|
|
dynamic_cast<MiqtVirtualQObject*>( (QObject*)(self) )->handle__Event = slot;
|
|
}
|
|
|
|
bool QObject_virtualbase_Event(void* self, QEvent* event) {
|
|
return ( (MiqtVirtualQObject*)(self) )->virtualbase_Event(event);
|
|
}
|
|
|
|
void QObject_override_virtual_EventFilter(void* self, intptr_t slot) {
|
|
dynamic_cast<MiqtVirtualQObject*>( (QObject*)(self) )->handle__EventFilter = slot;
|
|
}
|
|
|
|
bool QObject_virtualbase_EventFilter(void* self, QObject* watched, QEvent* event) {
|
|
return ( (MiqtVirtualQObject*)(self) )->virtualbase_EventFilter(watched, event);
|
|
}
|
|
|
|
void QObject_override_virtual_TimerEvent(void* self, intptr_t slot) {
|
|
dynamic_cast<MiqtVirtualQObject*>( (QObject*)(self) )->handle__TimerEvent = slot;
|
|
}
|
|
|
|
void QObject_virtualbase_TimerEvent(void* self, QTimerEvent* event) {
|
|
( (MiqtVirtualQObject*)(self) )->virtualbase_TimerEvent(event);
|
|
}
|
|
|
|
void QObject_override_virtual_ChildEvent(void* self, intptr_t slot) {
|
|
dynamic_cast<MiqtVirtualQObject*>( (QObject*)(self) )->handle__ChildEvent = slot;
|
|
}
|
|
|
|
void QObject_virtualbase_ChildEvent(void* self, QChildEvent* event) {
|
|
( (MiqtVirtualQObject*)(self) )->virtualbase_ChildEvent(event);
|
|
}
|
|
|
|
void QObject_override_virtual_CustomEvent(void* self, intptr_t slot) {
|
|
dynamic_cast<MiqtVirtualQObject*>( (QObject*)(self) )->handle__CustomEvent = slot;
|
|
}
|
|
|
|
void QObject_virtualbase_CustomEvent(void* self, QEvent* event) {
|
|
( (MiqtVirtualQObject*)(self) )->virtualbase_CustomEvent(event);
|
|
}
|
|
|
|
void QObject_override_virtual_ConnectNotify(void* self, intptr_t slot) {
|
|
dynamic_cast<MiqtVirtualQObject*>( (QObject*)(self) )->handle__ConnectNotify = slot;
|
|
}
|
|
|
|
void QObject_virtualbase_ConnectNotify(void* self, QMetaMethod* signal) {
|
|
( (MiqtVirtualQObject*)(self) )->virtualbase_ConnectNotify(signal);
|
|
}
|
|
|
|
void QObject_override_virtual_DisconnectNotify(void* self, intptr_t slot) {
|
|
dynamic_cast<MiqtVirtualQObject*>( (QObject*)(self) )->handle__DisconnectNotify = slot;
|
|
}
|
|
|
|
void QObject_virtualbase_DisconnectNotify(void* self, QMetaMethod* signal) {
|
|
( (MiqtVirtualQObject*)(self) )->virtualbase_DisconnectNotify(signal);
|
|
}
|
|
|
|
void QObject_Delete(QObject* self, bool isSubclass) {
|
|
if (isSubclass) {
|
|
delete dynamic_cast<MiqtVirtualQObject*>( self );
|
|
} else {
|
|
delete self;
|
|
}
|
|
}
|
|
|
|
void QSignalBlocker_new(QObject* o, QSignalBlocker** outptr_QSignalBlocker) {
|
|
QSignalBlocker* ret = new QSignalBlocker(o);
|
|
*outptr_QSignalBlocker = ret;
|
|
}
|
|
|
|
void QSignalBlocker_new2(QObject* o, QSignalBlocker** outptr_QSignalBlocker) {
|
|
QSignalBlocker* ret = new QSignalBlocker(*o);
|
|
*outptr_QSignalBlocker = ret;
|
|
}
|
|
|
|
void QSignalBlocker_Reblock(QSignalBlocker* self) {
|
|
self->reblock();
|
|
}
|
|
|
|
void QSignalBlocker_Unblock(QSignalBlocker* self) {
|
|
self->unblock();
|
|
}
|
|
|
|
void QSignalBlocker_Delete(QSignalBlocker* self, bool isSubclass) {
|
|
if (isSubclass) {
|
|
delete dynamic_cast<QSignalBlocker*>( self );
|
|
} else {
|
|
delete self;
|
|
}
|
|
}
|
|
|