mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
168 lines
5.2 KiB
C++
168 lines
5.2 KiB
C++
#include <QAbstractItemModel>
|
|
#include <QColumnView>
|
|
#include <QItemSelectionModel>
|
|
#include <QList>
|
|
#include <QMetaObject>
|
|
#include <QModelIndex>
|
|
#include <QPoint>
|
|
#include <QRect>
|
|
#include <QSize>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <QWidget>
|
|
#include "qcolumnview.h"
|
|
#include "gen_qcolumnview.h"
|
|
#include "_cgo_export.h"
|
|
|
|
QColumnView* QColumnView_new() {
|
|
return new QColumnView();
|
|
}
|
|
|
|
QColumnView* QColumnView_new2(QWidget* parent) {
|
|
return new QColumnView(parent);
|
|
}
|
|
|
|
QMetaObject* QColumnView_MetaObject(const QColumnView* self) {
|
|
return (QMetaObject*) self->metaObject();
|
|
}
|
|
|
|
void* QColumnView_Metacast(QColumnView* self, const char* param1) {
|
|
return self->qt_metacast(param1);
|
|
}
|
|
|
|
struct miqt_string* QColumnView_Tr(const char* s) {
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
struct miqt_string* QColumnView_TrUtf8(const char* s) {
|
|
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();
|
|
return miqt_strdup(_b.data(), _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) {
|
|
const QModelIndex& index_ret = index;
|
|
// Cast returned reference into pointer
|
|
QModelIndex* sigval1 = const_cast<QModelIndex*>(&index_ret);
|
|
miqt_exec_callback_QColumnView_UpdatePreviewWidget(slot, sigval1);
|
|
});
|
|
}
|
|
|
|
QModelIndex* QColumnView_IndexAt(const QColumnView* self, QPoint* point) {
|
|
return new QModelIndex(self->indexAt(*point));
|
|
}
|
|
|
|
void QColumnView_ScrollTo(QColumnView* self, QModelIndex* index) {
|
|
self->scrollTo(*index);
|
|
}
|
|
|
|
QSize* QColumnView_SizeHint(const QColumnView* self) {
|
|
return new QSize(self->sizeHint());
|
|
}
|
|
|
|
QRect* QColumnView_VisualRect(const QColumnView* self, QModelIndex* index) {
|
|
return new QRect(self->visualRect(*index));
|
|
}
|
|
|
|
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(const QColumnView* self) {
|
|
return self->resizeGripsVisible();
|
|
}
|
|
|
|
QWidget* QColumnView_PreviewWidget(const QColumnView* self) {
|
|
return self->previewWidget();
|
|
}
|
|
|
|
void QColumnView_SetPreviewWidget(QColumnView* self, QWidget* widget) {
|
|
self->setPreviewWidget(widget);
|
|
}
|
|
|
|
void QColumnView_SetColumnWidths(QColumnView* self, struct miqt_array* /* of int */ list) {
|
|
QList<int> list_QList;
|
|
list_QList.reserve(list->len);
|
|
int* list_arr = static_cast<int*>(list->data);
|
|
for(size_t i = 0; i < list->len; ++i) {
|
|
list_QList.push_back(static_cast<int>(list_arr[i]));
|
|
}
|
|
self->setColumnWidths(list_QList);
|
|
}
|
|
|
|
struct miqt_array* QColumnView_ColumnWidths(const QColumnView* self) {
|
|
QList<int> _ret = self->columnWidths();
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
int* _arr = static_cast<int*>(malloc(sizeof(int) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
_arr[i] = _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;
|
|
}
|
|
|
|
struct miqt_string* QColumnView_Tr2(const char* s, const char* c) {
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
struct miqt_string* QColumnView_Tr3(const char* s, const char* c, int n) {
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
struct miqt_string* QColumnView_TrUtf82(const char* s, const char* c) {
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
struct miqt_string* QColumnView_TrUtf83(const char* s, const char* c, int n) {
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
void QColumnView_ScrollTo2(QColumnView* self, QModelIndex* index, int hint) {
|
|
self->scrollTo(*index, static_cast<QAbstractItemView::ScrollHint>(hint));
|
|
}
|
|
|
|
void QColumnView_Delete(QColumnView* self) {
|
|
delete self;
|
|
}
|
|
|