miqt/qt/gen_qshortcut.cpp

446 lines
13 KiB
C++
Raw Normal View History

2024-11-19 06:29:06 +00:00
#include <QChildEvent>
#include <QEvent>
#include <QKeySequence>
2024-11-19 06:29:06 +00:00
#include <QMetaMethod>
#include <QMetaObject>
2024-11-19 06:29:06 +00:00
#include <QObject>
#include <QShortcut>
#include <QString>
2024-08-29 07:01:51 +00:00
#include <QByteArray>
#include <cstring>
2024-11-19 06:29:06 +00:00
#include <QTimerEvent>
#include <QWidget>
#include <qshortcut.h>
2024-08-29 07:01:51 +00:00
#include "gen_qshortcut.h"
#include "_cgo_export.h"
2024-11-19 06:29:06 +00:00
class MiqtVirtualQShortcut : public virtual QShortcut {
public:
MiqtVirtualQShortcut(QWidget* parent): QShortcut(parent) {};
MiqtVirtualQShortcut(const QKeySequence& key, QWidget* parent): QShortcut(key, parent) {};
MiqtVirtualQShortcut(const QKeySequence& key, QWidget* parent, const char* member): QShortcut(key, parent, member) {};
MiqtVirtualQShortcut(const QKeySequence& key, QWidget* parent, const char* member, const char* ambiguousMember): QShortcut(key, parent, member, ambiguousMember) {};
MiqtVirtualQShortcut(const QKeySequence& key, QWidget* parent, const char* member, const char* ambiguousMember, Qt::ShortcutContext shortcutContext): QShortcut(key, parent, member, ambiguousMember, shortcutContext) {};
virtual ~MiqtVirtualQShortcut() = default;
// cgo.Handle value for overwritten implementation
intptr_t handle__Event = 0;
// Subclass to allow providing a Go implementation
virtual bool event(QEvent* e) override {
if (handle__Event == 0) {
return QShortcut::event(e);
}
QEvent* sigval1 = e;
bool callback_return_value = miqt_exec_callback_QShortcut_Event(this, handle__Event, sigval1);
return callback_return_value;
}
// Wrapper to allow calling protected method
bool virtualbase_Event(QEvent* e) {
return QShortcut::event(e);
}
// 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 QShortcut::eventFilter(watched, event);
}
QObject* sigval1 = watched;
QEvent* sigval2 = event;
bool callback_return_value = miqt_exec_callback_QShortcut_EventFilter(this, handle__EventFilter, sigval1, sigval2);
return callback_return_value;
}
// Wrapper to allow calling protected method
bool virtualbase_EventFilter(QObject* watched, QEvent* event) {
return QShortcut::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) {
QShortcut::timerEvent(event);
return;
}
QTimerEvent* sigval1 = event;
miqt_exec_callback_QShortcut_TimerEvent(this, handle__TimerEvent, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_TimerEvent(QTimerEvent* event) {
QShortcut::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) {
QShortcut::childEvent(event);
return;
}
QChildEvent* sigval1 = event;
miqt_exec_callback_QShortcut_ChildEvent(this, handle__ChildEvent, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_ChildEvent(QChildEvent* event) {
QShortcut::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) {
QShortcut::customEvent(event);
return;
}
QEvent* sigval1 = event;
miqt_exec_callback_QShortcut_CustomEvent(this, handle__CustomEvent, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_CustomEvent(QEvent* event) {
QShortcut::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) {
QShortcut::connectNotify(signal);
return;
}
const QMetaMethod& signal_ret = signal;
// Cast returned reference into pointer
QMetaMethod* sigval1 = const_cast<QMetaMethod*>(&signal_ret);
miqt_exec_callback_QShortcut_ConnectNotify(this, handle__ConnectNotify, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_ConnectNotify(QMetaMethod* signal) {
QShortcut::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) {
QShortcut::disconnectNotify(signal);
return;
}
const QMetaMethod& signal_ret = signal;
// Cast returned reference into pointer
QMetaMethod* sigval1 = const_cast<QMetaMethod*>(&signal_ret);
miqt_exec_callback_QShortcut_DisconnectNotify(this, handle__DisconnectNotify, sigval1);
}
// Wrapper to allow calling protected method
void virtualbase_DisconnectNotify(QMetaMethod* signal) {
QShortcut::disconnectNotify(*signal);
}
};
void QShortcut_new(QWidget* parent, QShortcut** outptr_QShortcut, QObject** outptr_QObject) {
MiqtVirtualQShortcut* ret = new MiqtVirtualQShortcut(parent);
*outptr_QShortcut = ret;
*outptr_QObject = static_cast<QObject*>(ret);
}
2024-11-19 06:29:06 +00:00
void QShortcut_new2(QKeySequence* key, QWidget* parent, QShortcut** outptr_QShortcut, QObject** outptr_QObject) {
MiqtVirtualQShortcut* ret = new MiqtVirtualQShortcut(*key, parent);
*outptr_QShortcut = ret;
*outptr_QObject = static_cast<QObject*>(ret);
2024-08-29 07:01:51 +00:00
}
2024-11-19 06:29:06 +00:00
void QShortcut_new3(QKeySequence* key, QWidget* parent, const char* member, QShortcut** outptr_QShortcut, QObject** outptr_QObject) {
MiqtVirtualQShortcut* ret = new MiqtVirtualQShortcut(*key, parent, member);
*outptr_QShortcut = ret;
*outptr_QObject = static_cast<QObject*>(ret);
2024-08-29 07:01:51 +00:00
}
2024-11-19 06:29:06 +00:00
void QShortcut_new4(QKeySequence* key, QWidget* parent, const char* member, const char* ambiguousMember, QShortcut** outptr_QShortcut, QObject** outptr_QObject) {
MiqtVirtualQShortcut* ret = new MiqtVirtualQShortcut(*key, parent, member, ambiguousMember);
*outptr_QShortcut = ret;
*outptr_QObject = static_cast<QObject*>(ret);
2024-08-29 07:01:51 +00:00
}
2024-11-19 06:29:06 +00:00
void QShortcut_new5(QKeySequence* key, QWidget* parent, const char* member, const char* ambiguousMember, int shortcutContext, QShortcut** outptr_QShortcut, QObject** outptr_QObject) {
MiqtVirtualQShortcut* ret = new MiqtVirtualQShortcut(*key, parent, member, ambiguousMember, static_cast<Qt::ShortcutContext>(shortcutContext));
*outptr_QShortcut = ret;
*outptr_QObject = static_cast<QObject*>(ret);
2024-08-29 07:01:51 +00:00
}
QMetaObject* QShortcut_MetaObject(const QShortcut* self) {
return (QMetaObject*) self->metaObject();
}
void* QShortcut_Metacast(QShortcut* self, const char* param1) {
return self->qt_metacast(param1);
}
struct miqt_string QShortcut_Tr(const char* s) {
QString _ret = QShortcut::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;
}
struct miqt_string QShortcut_TrUtf8(const char* s) {
QString _ret = QShortcut::trUtf8(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;
}
void QShortcut_SetKey(QShortcut* self, QKeySequence* key) {
self->setKey(*key);
}
QKeySequence* QShortcut_Key(const QShortcut* self) {
return new QKeySequence(self->key());
}
void QShortcut_SetEnabled(QShortcut* self, bool enable) {
self->setEnabled(enable);
}
bool QShortcut_IsEnabled(const QShortcut* self) {
return self->isEnabled();
2024-08-29 07:01:51 +00:00
}
void QShortcut_SetContext(QShortcut* self, int context) {
2024-08-29 07:01:51 +00:00
self->setContext(static_cast<Qt::ShortcutContext>(context));
}
int QShortcut_Context(const QShortcut* self) {
Qt::ShortcutContext _ret = self->context();
return static_cast<int>(_ret);
}
void QShortcut_SetWhatsThis(QShortcut* self, struct miqt_string text) {
QString text_QString = QString::fromUtf8(text.data, text.len);
self->setWhatsThis(text_QString);
}
struct miqt_string QShortcut_WhatsThis(const QShortcut* self) {
QString _ret = self->whatsThis();
// 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 QShortcut_SetAutoRepeat(QShortcut* self, bool on) {
self->setAutoRepeat(on);
}
bool QShortcut_AutoRepeat(const QShortcut* self) {
return self->autoRepeat();
}
int QShortcut_Id(const QShortcut* self) {
return self->id();
}
QWidget* QShortcut_ParentWidget(const QShortcut* self) {
return self->parentWidget();
}
void QShortcut_Activated(QShortcut* self) {
self->activated();
}
void QShortcut_connect_Activated(QShortcut* self, intptr_t slot) {
2024-11-19 06:29:06 +00:00
MiqtVirtualQShortcut::connect(self, static_cast<void (QShortcut::*)()>(&QShortcut::activated), self, [=]() {
miqt_exec_callback_QShortcut_Activated(slot);
});
}
void QShortcut_ActivatedAmbiguously(QShortcut* self) {
self->activatedAmbiguously();
}
void QShortcut_connect_ActivatedAmbiguously(QShortcut* self, intptr_t slot) {
2024-11-19 06:29:06 +00:00
MiqtVirtualQShortcut::connect(self, static_cast<void (QShortcut::*)()>(&QShortcut::activatedAmbiguously), self, [=]() {
miqt_exec_callback_QShortcut_ActivatedAmbiguously(slot);
});
}
struct miqt_string QShortcut_Tr2(const char* s, const char* c) {
QString _ret = QShortcut::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 QShortcut_Tr3(const char* s, const char* c, int n) {
QString _ret = QShortcut::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;
}
struct miqt_string QShortcut_TrUtf82(const char* s, const char* c) {
QString _ret = QShortcut::trUtf8(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 QShortcut_TrUtf83(const char* s, const char* c, int n) {
QString _ret = QShortcut::trUtf8(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;
}
2024-11-19 06:29:06 +00:00
void QShortcut_override_virtual_Event(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQShortcut*>( (QShortcut*)(self) )->handle__Event = slot;
}
bool QShortcut_virtualbase_Event(void* self, QEvent* e) {
return ( (MiqtVirtualQShortcut*)(self) )->virtualbase_Event(e);
}
void QShortcut_override_virtual_EventFilter(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQShortcut*>( (QShortcut*)(self) )->handle__EventFilter = slot;
}
bool QShortcut_virtualbase_EventFilter(void* self, QObject* watched, QEvent* event) {
return ( (MiqtVirtualQShortcut*)(self) )->virtualbase_EventFilter(watched, event);
}
void QShortcut_override_virtual_TimerEvent(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQShortcut*>( (QShortcut*)(self) )->handle__TimerEvent = slot;
}
void QShortcut_virtualbase_TimerEvent(void* self, QTimerEvent* event) {
( (MiqtVirtualQShortcut*)(self) )->virtualbase_TimerEvent(event);
}
void QShortcut_override_virtual_ChildEvent(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQShortcut*>( (QShortcut*)(self) )->handle__ChildEvent = slot;
}
void QShortcut_virtualbase_ChildEvent(void* self, QChildEvent* event) {
( (MiqtVirtualQShortcut*)(self) )->virtualbase_ChildEvent(event);
}
void QShortcut_override_virtual_CustomEvent(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQShortcut*>( (QShortcut*)(self) )->handle__CustomEvent = slot;
}
void QShortcut_virtualbase_CustomEvent(void* self, QEvent* event) {
( (MiqtVirtualQShortcut*)(self) )->virtualbase_CustomEvent(event);
}
void QShortcut_override_virtual_ConnectNotify(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQShortcut*>( (QShortcut*)(self) )->handle__ConnectNotify = slot;
}
void QShortcut_virtualbase_ConnectNotify(void* self, QMetaMethod* signal) {
( (MiqtVirtualQShortcut*)(self) )->virtualbase_ConnectNotify(signal);
}
void QShortcut_override_virtual_DisconnectNotify(void* self, intptr_t slot) {
dynamic_cast<MiqtVirtualQShortcut*>( (QShortcut*)(self) )->handle__DisconnectNotify = slot;
}
void QShortcut_virtualbase_DisconnectNotify(void* self, QMetaMethod* signal) {
( (MiqtVirtualQShortcut*)(self) )->virtualbase_DisconnectNotify(signal);
}
void QShortcut_Delete(QShortcut* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<MiqtVirtualQShortcut*>( self );
} else {
delete self;
}
}