2024-08-25 04:08:24 +00:00
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QAbstractItemView>
|
|
|
|
#include <QCompleter>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QWidget>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qcompleter.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qcompleter.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QCompleter* QCompleter_new() {
|
|
|
|
return new QCompleter();
|
|
|
|
}
|
|
|
|
|
|
|
|
QCompleter* QCompleter_new2(QAbstractItemModel* model) {
|
|
|
|
return new QCompleter(model);
|
|
|
|
}
|
|
|
|
|
|
|
|
QCompleter* QCompleter_new3(char** completions, uint64_t* completions_Lengths, size_t completions_len) {
|
|
|
|
QList<QString> completions_QList;
|
|
|
|
completions_QList.reserve(completions_len);
|
|
|
|
for(size_t i = 0; i < completions_len; ++i) {
|
|
|
|
completions_QList.push_back(QString::fromUtf8(completions[i], completions_Lengths[i]));
|
|
|
|
}
|
|
|
|
return new QCompleter(completions_QList);
|
|
|
|
}
|
|
|
|
|
|
|
|
QCompleter* QCompleter_new4(QObject* parent) {
|
|
|
|
return new QCompleter(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
QCompleter* QCompleter_new5(QAbstractItemModel* model, QObject* parent) {
|
|
|
|
return new QCompleter(model, parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
QCompleter* QCompleter_new6(char** completions, uint64_t* completions_Lengths, size_t completions_len, QObject* parent) {
|
|
|
|
QList<QString> completions_QList;
|
|
|
|
completions_QList.reserve(completions_len);
|
|
|
|
for(size_t i = 0; i < completions_len; ++i) {
|
|
|
|
completions_QList.push_back(QString::fromUtf8(completions[i], completions_Lengths[i]));
|
|
|
|
}
|
|
|
|
return new QCompleter(completions_QList, parent);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMetaObject* QCompleter_MetaObject(const QCompleter* self) {
|
|
|
|
return (QMetaObject*) self->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QCompleter_Tr(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QCompleter::tr(s);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QCompleter_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QCompleter::trUtf8(s);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetWidget(QCompleter* self, QWidget* widget) {
|
|
|
|
self->setWidget(widget);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QWidget* QCompleter_Widget(const QCompleter* self) {
|
|
|
|
return self->widget();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetModel(QCompleter* self, QAbstractItemModel* c) {
|
|
|
|
self->setModel(c);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QAbstractItemModel* QCompleter_Model(const QCompleter* self) {
|
|
|
|
return self->model();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetCompletionMode(QCompleter* self, uintptr_t mode) {
|
|
|
|
self->setCompletionMode(static_cast<QCompleter::CompletionMode>(mode));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uintptr_t QCompleter_CompletionMode(const QCompleter* self) {
|
|
|
|
QCompleter::CompletionMode ret = self->completionMode();
|
2024-08-29 07:01:51 +00:00
|
|
|
return static_cast<uintptr_t>(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetFilterMode(QCompleter* self, int filterMode) {
|
|
|
|
self->setFilterMode(static_cast<Qt::MatchFlags>(filterMode));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCompleter_FilterMode(const QCompleter* self) {
|
|
|
|
Qt::MatchFlags ret = self->filterMode();
|
2024-08-29 07:01:51 +00:00
|
|
|
return static_cast<int>(ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QAbstractItemView* QCompleter_Popup(const QCompleter* self) {
|
|
|
|
return self->popup();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetPopup(QCompleter* self, QAbstractItemView* popup) {
|
|
|
|
self->setPopup(popup);
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QCompleter_SetCaseSensitivity(QCompleter* self, uintptr_t caseSensitivity) {
|
|
|
|
self->setCaseSensitivity(static_cast<Qt::CaseSensitivity>(caseSensitivity));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uintptr_t QCompleter_CaseSensitivity(const QCompleter* self) {
|
|
|
|
Qt::CaseSensitivity ret = self->caseSensitivity();
|
2024-08-29 07:01:51 +00:00
|
|
|
return static_cast<uintptr_t>(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetModelSorting(QCompleter* self, uintptr_t sorting) {
|
|
|
|
self->setModelSorting(static_cast<QCompleter::ModelSorting>(sorting));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uintptr_t QCompleter_ModelSorting(const QCompleter* self) {
|
|
|
|
QCompleter::ModelSorting ret = self->modelSorting();
|
2024-08-29 07:01:51 +00:00
|
|
|
return static_cast<uintptr_t>(ret);
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QCompleter_SetCompletionColumn(QCompleter* self, int column) {
|
|
|
|
self->setCompletionColumn(static_cast<int>(column));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCompleter_CompletionColumn(const QCompleter* self) {
|
|
|
|
return self->completionColumn();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetCompletionRole(QCompleter* self, int role) {
|
|
|
|
self->setCompletionRole(static_cast<int>(role));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCompleter_CompletionRole(const QCompleter* self) {
|
|
|
|
return self->completionRole();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QCompleter_WrapAround(const QCompleter* self) {
|
|
|
|
return self->wrapAround();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCompleter_MaxVisibleItems(const QCompleter* self) {
|
|
|
|
return self->maxVisibleItems();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetMaxVisibleItems(QCompleter* self, int maxItems) {
|
|
|
|
self->setMaxVisibleItems(static_cast<int>(maxItems));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCompleter_CompletionCount(const QCompleter* self) {
|
|
|
|
return self->completionCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QCompleter_SetCurrentRow(QCompleter* self, int row) {
|
|
|
|
return self->setCurrentRow(static_cast<int>(row));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCompleter_CurrentRow(const QCompleter* self) {
|
|
|
|
return self->currentRow();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QModelIndex* QCompleter_CurrentIndex(const QCompleter* self) {
|
|
|
|
QModelIndex ret = self->currentIndex();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QModelIndex*>(new QModelIndex(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QCompleter_CurrentCompletion(const QCompleter* self, char** _out, int* _out_Strlen) {
|
|
|
|
QString ret = self->currentCompletion();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QAbstractItemModel* QCompleter_CompletionModel(const QCompleter* self) {
|
|
|
|
return self->completionModel();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QCompleter_CompletionPrefix(const QCompleter* self, char** _out, int* _out_Strlen) {
|
|
|
|
QString ret = self->completionPrefix();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetCompletionPrefix(QCompleter* self, const char* prefix, size_t prefix_Strlen) {
|
|
|
|
QString prefix_QString = QString::fromUtf8(prefix, prefix_Strlen);
|
|
|
|
self->setCompletionPrefix(prefix_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_Complete(QCompleter* self) {
|
|
|
|
self->complete();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_SetWrapAround(QCompleter* self, bool wrap) {
|
|
|
|
self->setWrapAround(wrap);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QCompleter_PathFromIndex(const QCompleter* self, QModelIndex* index, char** _out, int* _out_Strlen) {
|
|
|
|
QString ret = self->pathFromIndex(*index);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
void QCompleter_SplitPath(const QCompleter* self, const char* path, size_t path_Strlen, char*** _out, int** _out_Lengths, size_t* _out_len) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString path_QString = QString::fromUtf8(path, path_Strlen);
|
2024-09-11 05:41:09 +00:00
|
|
|
QStringList ret = self->splitPath(path_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QStringList from C++ memory to manually-managed C memory
|
|
|
|
char** __out = static_cast<char**>(malloc(sizeof(char*) * ret.length()));
|
|
|
|
int* __out_Lengths = static_cast<int*>(malloc(sizeof(int) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret[i].toUtf8();
|
|
|
|
__out[i] = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(__out[i], b.data(), b.length());
|
|
|
|
__out_Lengths[i] = b.length();
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_Lengths = __out_Lengths;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_Activated(QCompleter* self, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
self->activated(text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_connect_Activated(QCompleter* self, void* slot) {
|
|
|
|
QCompleter::connect(self, static_cast<void (QCompleter::*)(const QString&)>(&QCompleter::activated), self, [=](const QString& text) {
|
|
|
|
miqt_exec_callback(slot, 0, nullptr);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_ActivatedWithIndex(QCompleter* self, QModelIndex* index) {
|
|
|
|
self->activated(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_connect_ActivatedWithIndex(QCompleter* self, void* slot) {
|
|
|
|
QCompleter::connect(self, static_cast<void (QCompleter::*)(const QModelIndex&)>(&QCompleter::activated), self, [=](const QModelIndex& index) {
|
|
|
|
miqt_exec_callback(slot, 0, nullptr);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_Highlighted(QCompleter* self, const char* text, size_t text_Strlen) {
|
|
|
|
QString text_QString = QString::fromUtf8(text, text_Strlen);
|
|
|
|
self->highlighted(text_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_connect_Highlighted(QCompleter* self, void* slot) {
|
|
|
|
QCompleter::connect(self, static_cast<void (QCompleter::*)(const QString&)>(&QCompleter::highlighted), self, [=](const QString& text) {
|
|
|
|
miqt_exec_callback(slot, 0, nullptr);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_HighlightedWithIndex(QCompleter* self, QModelIndex* index) {
|
|
|
|
self->highlighted(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_connect_HighlightedWithIndex(QCompleter* self, void* slot) {
|
|
|
|
QCompleter::connect(self, static_cast<void (QCompleter::*)(const QModelIndex&)>(&QCompleter::highlighted), self, [=](const QModelIndex& index) {
|
|
|
|
miqt_exec_callback(slot, 0, nullptr);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QCompleter_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QCompleter::tr(s, c);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QCompleter_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QCompleter::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();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QCompleter_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QCompleter::trUtf8(s, c);
|
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QCompleter_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QCompleter::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();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_Complete1(QCompleter* self, QRect* rect) {
|
|
|
|
self->complete(*rect);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCompleter_Delete(QCompleter* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|