2024-08-25 04:08:24 +00:00
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QHeaderView>
|
|
|
|
#include <QItemSelectionModel>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QPoint>
|
|
|
|
#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 <QTreeView>
|
|
|
|
#include <QWidget>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qtreeview.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qtreeview.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTreeView* QTreeView_new() {
|
|
|
|
return new QTreeView();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTreeView* QTreeView_new2(QWidget* parent) {
|
|
|
|
return new QTreeView(parent);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMetaObject* QTreeView_MetaObject(const QTreeView* self) {
|
|
|
|
return (QMetaObject*) self->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTreeView_Tr(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QTreeView::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 QTreeView_TrUtf8(const char* s, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QTreeView::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 QTreeView_SetModel(QTreeView* self, QAbstractItemModel* model) {
|
|
|
|
self->setModel(model);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetRootIndex(QTreeView* self, QModelIndex* index) {
|
|
|
|
self->setRootIndex(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetSelectionModel(QTreeView* self, QItemSelectionModel* selectionModel) {
|
|
|
|
self->setSelectionModel(selectionModel);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QHeaderView* QTreeView_Header(const QTreeView* self) {
|
|
|
|
return self->header();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetHeader(QTreeView* self, QHeaderView* header) {
|
|
|
|
self->setHeader(header);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTreeView_AutoExpandDelay(const QTreeView* self) {
|
|
|
|
return self->autoExpandDelay();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetAutoExpandDelay(QTreeView* self, int delay) {
|
|
|
|
self->setAutoExpandDelay(static_cast<int>(delay));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTreeView_Indentation(const QTreeView* self) {
|
|
|
|
return self->indentation();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetIndentation(QTreeView* self, int i) {
|
|
|
|
self->setIndentation(static_cast<int>(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_ResetIndentation(QTreeView* self) {
|
|
|
|
self->resetIndentation();
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_RootIsDecorated(const QTreeView* self) {
|
|
|
|
return self->rootIsDecorated();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetRootIsDecorated(QTreeView* self, bool show) {
|
|
|
|
self->setRootIsDecorated(show);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_UniformRowHeights(const QTreeView* self) {
|
|
|
|
return self->uniformRowHeights();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetUniformRowHeights(QTreeView* self, bool uniform) {
|
|
|
|
self->setUniformRowHeights(uniform);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_ItemsExpandable(const QTreeView* self) {
|
|
|
|
return self->itemsExpandable();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetItemsExpandable(QTreeView* self, bool enable) {
|
|
|
|
self->setItemsExpandable(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_ExpandsOnDoubleClick(const QTreeView* self) {
|
|
|
|
return self->expandsOnDoubleClick();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetExpandsOnDoubleClick(QTreeView* self, bool enable) {
|
|
|
|
self->setExpandsOnDoubleClick(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTreeView_ColumnViewportPosition(const QTreeView* self, int column) {
|
|
|
|
return self->columnViewportPosition(static_cast<int>(column));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTreeView_ColumnWidth(const QTreeView* self, int column) {
|
|
|
|
return self->columnWidth(static_cast<int>(column));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetColumnWidth(QTreeView* self, int column, int width) {
|
|
|
|
self->setColumnWidth(static_cast<int>(column), static_cast<int>(width));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTreeView_ColumnAt(const QTreeView* self, int x) {
|
|
|
|
return self->columnAt(static_cast<int>(x));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_IsColumnHidden(const QTreeView* self, int column) {
|
|
|
|
return self->isColumnHidden(static_cast<int>(column));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetColumnHidden(QTreeView* self, int column, bool hide) {
|
|
|
|
self->setColumnHidden(static_cast<int>(column), hide);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_IsHeaderHidden(const QTreeView* self) {
|
|
|
|
return self->isHeaderHidden();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetHeaderHidden(QTreeView* self, bool hide) {
|
|
|
|
self->setHeaderHidden(hide);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_IsRowHidden(const QTreeView* self, int row, QModelIndex* parent) {
|
|
|
|
return self->isRowHidden(static_cast<int>(row), *parent);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetRowHidden(QTreeView* self, int row, QModelIndex* parent, bool hide) {
|
|
|
|
self->setRowHidden(static_cast<int>(row), *parent, hide);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_IsFirstColumnSpanned(const QTreeView* self, int row, QModelIndex* parent) {
|
|
|
|
return self->isFirstColumnSpanned(static_cast<int>(row), *parent);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetFirstColumnSpanned(QTreeView* self, int row, QModelIndex* parent, bool span) {
|
|
|
|
self->setFirstColumnSpanned(static_cast<int>(row), *parent, span);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_IsExpanded(const QTreeView* self, QModelIndex* index) {
|
|
|
|
return self->isExpanded(*index);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetExpanded(QTreeView* self, QModelIndex* index, bool expand) {
|
|
|
|
self->setExpanded(*index, expand);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetSortingEnabled(QTreeView* self, bool enable) {
|
|
|
|
self->setSortingEnabled(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_IsSortingEnabled(const QTreeView* self) {
|
|
|
|
return self->isSortingEnabled();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetAnimated(QTreeView* self, bool enable) {
|
|
|
|
self->setAnimated(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_IsAnimated(const QTreeView* self) {
|
|
|
|
return self->isAnimated();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetAllColumnsShowFocus(QTreeView* self, bool enable) {
|
|
|
|
self->setAllColumnsShowFocus(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_AllColumnsShowFocus(const QTreeView* self) {
|
|
|
|
return self->allColumnsShowFocus();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetWordWrap(QTreeView* self, bool on) {
|
|
|
|
self->setWordWrap(on);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QTreeView_WordWrap(const QTreeView* self) {
|
|
|
|
return self->wordWrap();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SetTreePosition(QTreeView* self, int logicalIndex) {
|
|
|
|
self->setTreePosition(static_cast<int>(logicalIndex));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QTreeView_TreePosition(const QTreeView* self) {
|
|
|
|
return self->treePosition();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_KeyboardSearch(QTreeView* self, const char* search, size_t search_Strlen) {
|
|
|
|
QString search_QString = QString::fromUtf8(search, search_Strlen);
|
|
|
|
self->keyboardSearch(search_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QRect* QTreeView_VisualRect(const QTreeView* self, QModelIndex* index) {
|
|
|
|
QRect ret = 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));
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTreeView_ScrollTo(QTreeView* self, QModelIndex* index) {
|
|
|
|
self->scrollTo(*index);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QModelIndex* QTreeView_IndexAt(const QTreeView* self, QPoint* p) {
|
|
|
|
QModelIndex ret = self->indexAt(*p);
|
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
|
|
|
QModelIndex* QTreeView_IndexAbove(const QTreeView* self, QModelIndex* index) {
|
|
|
|
QModelIndex ret = self->indexAbove(*index);
|
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
|
|
|
QModelIndex* QTreeView_IndexBelow(const QTreeView* self, QModelIndex* index) {
|
|
|
|
QModelIndex ret = self->indexBelow(*index);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QModelIndex*>(new QModelIndex(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_DoItemsLayout(QTreeView* self) {
|
|
|
|
self->doItemsLayout();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_Reset(QTreeView* self) {
|
|
|
|
self->reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_DataChanged(QTreeView* self, QModelIndex* topLeft, QModelIndex* bottomRight) {
|
|
|
|
self->dataChanged(*topLeft, *bottomRight);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SelectAll(QTreeView* self) {
|
|
|
|
self->selectAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_Expanded(QTreeView* self, QModelIndex* index) {
|
|
|
|
self->expanded(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_connect_Expanded(QTreeView* self, void* slot) {
|
|
|
|
QTreeView::connect(self, static_cast<void (QTreeView::*)(const QModelIndex&)>(&QTreeView::expanded), self, [=](const QModelIndex& index) {
|
|
|
|
miqt_exec_callback(slot, 0, nullptr);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_Collapsed(QTreeView* self, QModelIndex* index) {
|
|
|
|
self->collapsed(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_connect_Collapsed(QTreeView* self, void* slot) {
|
|
|
|
QTreeView::connect(self, static_cast<void (QTreeView::*)(const QModelIndex&)>(&QTreeView::collapsed), self, [=](const QModelIndex& index) {
|
|
|
|
miqt_exec_callback(slot, 0, nullptr);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_HideColumn(QTreeView* self, int column) {
|
|
|
|
self->hideColumn(static_cast<int>(column));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_ShowColumn(QTreeView* self, int column) {
|
|
|
|
self->showColumn(static_cast<int>(column));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_Expand(QTreeView* self, QModelIndex* index) {
|
|
|
|
self->expand(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_Collapse(QTreeView* self, QModelIndex* index) {
|
|
|
|
self->collapse(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_ResizeColumnToContents(QTreeView* self, int column) {
|
|
|
|
self->resizeColumnToContents(static_cast<int>(column));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_SortByColumn(QTreeView* self, int column) {
|
|
|
|
self->sortByColumn(static_cast<int>(column));
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTreeView_SortByColumn2(QTreeView* self, int column, uintptr_t order) {
|
|
|
|
self->sortByColumn(static_cast<int>(column), static_cast<Qt::SortOrder>(order));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QTreeView_ExpandAll(QTreeView* self) {
|
|
|
|
self->expandAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_ExpandRecursively(QTreeView* self, QModelIndex* index) {
|
|
|
|
self->expandRecursively(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_CollapseAll(QTreeView* self) {
|
|
|
|
self->collapseAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_ExpandToDepth(QTreeView* self, int depth) {
|
|
|
|
self->expandToDepth(static_cast<int>(depth));
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QTreeView_Tr2(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QTreeView::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 QTreeView_Tr3(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QTreeView::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 QTreeView_TrUtf82(const char* s, const char* c, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QTreeView::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 QTreeView_TrUtf83(const char* s, const char* c, int n, char** _out, int* _out_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString ret = QTreeView::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 QTreeView_ScrollTo2(QTreeView* self, QModelIndex* index, uintptr_t hint) {
|
|
|
|
self->scrollTo(*index, static_cast<QAbstractItemView::ScrollHint>(hint));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QTreeView_DataChanged3(QTreeView* self, QModelIndex* topLeft, QModelIndex* bottomRight, int* roles, size_t roles_len) {
|
|
|
|
QVector<int> roles_QList;
|
|
|
|
roles_QList.reserve(roles_len);
|
|
|
|
for(size_t i = 0; i < roles_len; ++i) {
|
|
|
|
roles_QList.push_back(roles[i]);
|
|
|
|
}
|
|
|
|
self->dataChanged(*topLeft, *bottomRight, roles_QList);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_ExpandRecursively2(QTreeView* self, QModelIndex* index, int depth) {
|
|
|
|
self->expandRecursively(*index, static_cast<int>(depth));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTreeView_Delete(QTreeView* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|