2024-08-25 04:08:24 +00:00
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QColumnView>
|
|
|
|
#include <QItemSelectionModel>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QPoint>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QSize>
|
|
|
|
#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 "qcolumnview.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qcolumnview.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QColumnView* QColumnView_new() {
|
|
|
|
return new QColumnView();
|
|
|
|
}
|
|
|
|
|
|
|
|
QColumnView* QColumnView_new2(QWidget* parent) {
|
|
|
|
return new QColumnView(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
QMetaObject* QColumnView_MetaObject(QColumnView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return (QMetaObject*) const_cast<const QColumnView*>(self)->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QColumnView_Tr(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QColumnView::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 QColumnView_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QColumnView::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 QColumnView_UpdatePreviewWidget(QColumnView* self, QModelIndex* index) {
|
|
|
|
self->updatePreviewWidget(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_connect_UpdatePreviewWidget(QColumnView* self, void* slot) {
|
|
|
|
QColumnView::connect(self, static_cast<void (QColumnView::*)(const QModelIndex&)>(&QColumnView::updatePreviewWidget), self, [=](const QModelIndex& index) {
|
|
|
|
miqt_exec_callback(slot, 0, nullptr);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
QModelIndex* QColumnView_IndexAt(QColumnView* self, QPoint* point) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QModelIndex ret = const_cast<const QColumnView*>(self)->indexAt(*point);
|
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-08-29 07:01:51 +00:00
|
|
|
void QColumnView_ScrollTo(QColumnView* self, QModelIndex* index) {
|
|
|
|
self->scrollTo(*index);
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
QSize* QColumnView_SizeHint(QColumnView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QSize ret = const_cast<const QColumnView*>(self)->sizeHint();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QSize*>(new QSize(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect* QColumnView_VisualRect(QColumnView* self, QModelIndex* index) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QRect ret = const_cast<const QColumnView*>(self)->visualRect(*index);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QRect*>(new QRect(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_SetModel(QColumnView* self, QAbstractItemModel* model) {
|
|
|
|
self->setModel(model);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_SetSelectionModel(QColumnView* self, QItemSelectionModel* selectionModel) {
|
|
|
|
self->setSelectionModel(selectionModel);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_SetRootIndex(QColumnView* self, QModelIndex* index) {
|
|
|
|
self->setRootIndex(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_SelectAll(QColumnView* self) {
|
|
|
|
self->selectAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_SetResizeGripsVisible(QColumnView* self, bool visible) {
|
|
|
|
self->setResizeGripsVisible(visible);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QColumnView_ResizeGripsVisible(QColumnView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QColumnView*>(self)->resizeGripsVisible();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QWidget* QColumnView_PreviewWidget(QColumnView* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QColumnView*>(self)->previewWidget();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_SetPreviewWidget(QColumnView* self, QWidget* widget) {
|
|
|
|
self->setPreviewWidget(widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_SetColumnWidths(QColumnView* self, int* list, size_t list_len) {
|
|
|
|
QList<int> list_QList;
|
|
|
|
list_QList.reserve(list_len);
|
|
|
|
for(size_t i = 0; i < list_len; ++i) {
|
|
|
|
list_QList.push_back(list[i]);
|
|
|
|
}
|
|
|
|
self->setColumnWidths(list_QList);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QColumnView_ColumnWidths(QColumnView* self, int** _out, size_t* _out_len) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QList<int> ret = const_cast<const QColumnView*>(self)->columnWidths();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
|
|
int* __out = static_cast<int*>(malloc(sizeof(int) * ret.length()));
|
|
|
|
for (size_t i = 0, e = ret.length(); i < e; ++i) {
|
|
|
|
__out[i] = ret[i];
|
|
|
|
}
|
|
|
|
*_out = __out;
|
|
|
|
*_out_len = ret.length();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QColumnView_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QColumnView::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 QColumnView_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QColumnView::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 QColumnView_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QColumnView::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 QColumnView_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QColumnView::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();
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QColumnView_ScrollTo2(QColumnView* self, QModelIndex* index, uintptr_t hint) {
|
|
|
|
self->scrollTo(*index, static_cast<QAbstractItemView::ScrollHint>(hint));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QColumnView_Delete(QColumnView* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|