mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
194 lines
6.0 KiB
C++
194 lines
6.0 KiB
C++
#include <QKeySequence>
|
|
#include <QList>
|
|
#include <QMetaObject>
|
|
#include <QObject>
|
|
#include <QShortcut>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <qshortcut.h>
|
|
#include "gen_qshortcut.h"
|
|
#include "_cgo_export.h"
|
|
|
|
QShortcut* QShortcut_new(QObject* parent) {
|
|
return new QShortcut(parent);
|
|
}
|
|
|
|
QShortcut* QShortcut_new2(QKeySequence* key, QObject* parent) {
|
|
return new QShortcut(*key, parent);
|
|
}
|
|
|
|
QShortcut* QShortcut_new3(int key, QObject* parent) {
|
|
return new QShortcut(static_cast<QKeySequence::StandardKey>(key), parent);
|
|
}
|
|
|
|
QShortcut* QShortcut_new4(QKeySequence* key, QObject* parent, const char* member) {
|
|
return new QShortcut(*key, parent, member);
|
|
}
|
|
|
|
QShortcut* QShortcut_new5(QKeySequence* key, QObject* parent, const char* member, const char* ambiguousMember) {
|
|
return new QShortcut(*key, parent, member, ambiguousMember);
|
|
}
|
|
|
|
QShortcut* QShortcut_new6(QKeySequence* key, QObject* parent, const char* member, const char* ambiguousMember, int context) {
|
|
return new QShortcut(*key, parent, member, ambiguousMember, static_cast<Qt::ShortcutContext>(context));
|
|
}
|
|
|
|
QShortcut* QShortcut_new7(int key, QObject* parent, const char* member) {
|
|
return new QShortcut(static_cast<QKeySequence::StandardKey>(key), parent, member);
|
|
}
|
|
|
|
QShortcut* QShortcut_new8(int key, QObject* parent, const char* member, const char* ambiguousMember) {
|
|
return new QShortcut(static_cast<QKeySequence::StandardKey>(key), parent, member, ambiguousMember);
|
|
}
|
|
|
|
QShortcut* QShortcut_new9(int key, QObject* parent, const char* member, const char* ambiguousMember, int context) {
|
|
return new QShortcut(static_cast<QKeySequence::StandardKey>(key), parent, member, ambiguousMember, static_cast<Qt::ShortcutContext>(context));
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
void QShortcut_SetKey(QShortcut* self, QKeySequence* key) {
|
|
self->setKey(*key);
|
|
}
|
|
|
|
QKeySequence* QShortcut_Key(const QShortcut* self) {
|
|
return new QKeySequence(self->key());
|
|
}
|
|
|
|
void QShortcut_SetKeys(QShortcut* self, int key) {
|
|
self->setKeys(static_cast<QKeySequence::StandardKey>(key));
|
|
}
|
|
|
|
void QShortcut_SetKeysWithKeys(QShortcut* self, struct miqt_array* /* of QKeySequence* */ keys) {
|
|
QList<QKeySequence> keys_QList;
|
|
keys_QList.reserve(keys->len);
|
|
QKeySequence** keys_arr = static_cast<QKeySequence**>(keys->data);
|
|
for(size_t i = 0; i < keys->len; ++i) {
|
|
keys_QList.push_back(*(keys_arr[i]));
|
|
}
|
|
self->setKeys(keys_QList);
|
|
}
|
|
|
|
struct miqt_array* QShortcut_Keys(const QShortcut* self) {
|
|
QList<QKeySequence> _ret = self->keys();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
QKeySequence** _arr = static_cast<QKeySequence**>(malloc(sizeof(QKeySequence*) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
_arr[i] = new QKeySequence(_ret[i]);
|
|
}
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
_out->len = _ret.length();
|
|
_out->data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
void QShortcut_SetEnabled(QShortcut* self, bool enable) {
|
|
self->setEnabled(enable);
|
|
}
|
|
|
|
bool QShortcut_IsEnabled(const QShortcut* self) {
|
|
return self->isEnabled();
|
|
}
|
|
|
|
void QShortcut_SetContext(QShortcut* self, int context) {
|
|
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_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();
|
|
}
|
|
|
|
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_Activated(QShortcut* self) {
|
|
self->activated();
|
|
}
|
|
|
|
void QShortcut_connect_Activated(QShortcut* self, intptr_t slot) {
|
|
QShortcut::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) {
|
|
QShortcut::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;
|
|
}
|
|
|
|
void QShortcut_Delete(QShortcut* self) {
|
|
delete self;
|
|
}
|
|
|