2024-08-25 04:08:24 +00:00
|
|
|
#include <QDirModel>
|
|
|
|
#include <QFileIconProvider>
|
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QIcon>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QMimeData>
|
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QVariant>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qdirmodel.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qdirmodel.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-11-04 07:18:27 +00:00
|
|
|
QDirModel* QDirModel_new(struct miqt_array /* of struct miqt_string */ nameFilters, int filters, int sort) {
|
2024-10-16 05:07:56 +00:00
|
|
|
QStringList nameFilters_QList;
|
2024-11-04 07:18:27 +00:00
|
|
|
nameFilters_QList.reserve(nameFilters.len);
|
|
|
|
struct miqt_string* nameFilters_arr = static_cast<struct miqt_string*>(nameFilters.data);
|
|
|
|
for(size_t i = 0; i < nameFilters.len; ++i) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString nameFilters_arr_i_QString = QString::fromUtf8(nameFilters_arr[i].data, nameFilters_arr[i].len);
|
2024-09-17 07:43:35 +00:00
|
|
|
nameFilters_QList.push_back(nameFilters_arr_i_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
return new QDirModel(nameFilters_QList, static_cast<QDir::Filters>(filters), static_cast<QDir::SortFlags>(sort));
|
|
|
|
}
|
|
|
|
|
|
|
|
QDirModel* QDirModel_new2() {
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QDirModel();
|
|
|
|
}
|
|
|
|
|
2024-11-04 07:18:27 +00:00
|
|
|
QDirModel* QDirModel_new3(struct miqt_array /* of struct miqt_string */ nameFilters, int filters, int sort, QObject* parent) {
|
2024-10-16 05:07:56 +00:00
|
|
|
QStringList nameFilters_QList;
|
2024-11-04 07:18:27 +00:00
|
|
|
nameFilters_QList.reserve(nameFilters.len);
|
|
|
|
struct miqt_string* nameFilters_arr = static_cast<struct miqt_string*>(nameFilters.data);
|
|
|
|
for(size_t i = 0; i < nameFilters.len; ++i) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString nameFilters_arr_i_QString = QString::fromUtf8(nameFilters_arr[i].data, nameFilters_arr[i].len);
|
2024-09-17 07:43:35 +00:00
|
|
|
nameFilters_QList.push_back(nameFilters_arr_i_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
return new QDirModel(nameFilters_QList, static_cast<QDir::Filters>(filters), static_cast<QDir::SortFlags>(sort), parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
QDirModel* QDirModel_new4(QObject* parent) {
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QDirModel(parent);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMetaObject* QDirModel_MetaObject(const QDirModel* self) {
|
|
|
|
return (QMetaObject*) self->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 22:32:57 +00:00
|
|
|
void* QDirModel_Metacast(QDirModel* self, const char* param1) {
|
|
|
|
return self->qt_metacast(param1);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirModel_Tr(const char* s) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = QDirModel::tr(s);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirModel_TrUtf8(const char* s) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = QDirModel::trUtf8(s);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QModelIndex* QDirModel_Index(const QDirModel* self, int row, int column) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QModelIndex(self->index(static_cast<int>(row), static_cast<int>(column)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QModelIndex* QDirModel_Parent(const QDirModel* self, QModelIndex* child) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QModelIndex(self->parent(*child));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QDirModel_RowCount(const QDirModel* self) {
|
|
|
|
return self->rowCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QDirModel_ColumnCount(const QDirModel* self) {
|
|
|
|
return self->columnCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QVariant* QDirModel_Data(const QDirModel* self, QModelIndex* index) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVariant(self->data(*index));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QDirModel_SetData(QDirModel* self, QModelIndex* index, QVariant* value) {
|
|
|
|
return self->setData(*index, *value);
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QVariant* QDirModel_HeaderData(const QDirModel* self, int section, int orientation) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVariant(self->headerData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation)));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QDirModel_HasChildren(const QDirModel* self) {
|
|
|
|
return self->hasChildren();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QDirModel_Flags(const QDirModel* self, QModelIndex* index) {
|
2024-09-14 22:29:05 +00:00
|
|
|
Qt::ItemFlags _ret = self->flags(*index);
|
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDirModel_Sort(QDirModel* self, int column) {
|
|
|
|
self->sort(static_cast<int>(column));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array QDirModel_MimeTypes(const QDirModel* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QStringList _ret = self->mimeTypes();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
QString _lv_ret = _ret[i];
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _lv_b = _lv_ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_b.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array _out;
|
|
|
|
_out.len = _ret.length();
|
|
|
|
_out.data = static_cast<void*>(_arr);
|
2024-09-14 22:29:05 +00:00
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-04 07:18:27 +00:00
|
|
|
QMimeData* QDirModel_MimeData(const QDirModel* self, struct miqt_array /* of QModelIndex* */ indexes) {
|
2024-10-16 05:07:56 +00:00
|
|
|
QModelIndexList indexes_QList;
|
2024-11-04 07:18:27 +00:00
|
|
|
indexes_QList.reserve(indexes.len);
|
|
|
|
QModelIndex** indexes_arr = static_cast<QModelIndex**>(indexes.data);
|
|
|
|
for(size_t i = 0; i < indexes.len; ++i) {
|
2024-09-14 22:29:05 +00:00
|
|
|
indexes_QList.push_back(*(indexes_arr[i]));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->mimeData(indexes_QList);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
bool QDirModel_DropMimeData(QDirModel* self, QMimeData* data, int action, int row, int column, QModelIndex* parent) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return self->dropMimeData(data, static_cast<Qt::DropAction>(action), static_cast<int>(row), static_cast<int>(column), *parent);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QDirModel_SupportedDropActions(const QDirModel* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
Qt::DropActions _ret = self->supportedDropActions();
|
|
|
|
return static_cast<int>(_ret);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDirModel_SetIconProvider(QDirModel* self, QFileIconProvider* provider) {
|
|
|
|
self->setIconProvider(provider);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QFileIconProvider* QDirModel_IconProvider(const QDirModel* self) {
|
|
|
|
return self->iconProvider();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-04 07:18:27 +00:00
|
|
|
void QDirModel_SetNameFilters(QDirModel* self, struct miqt_array /* of struct miqt_string */ filters) {
|
2024-10-16 05:07:56 +00:00
|
|
|
QStringList filters_QList;
|
2024-11-04 07:18:27 +00:00
|
|
|
filters_QList.reserve(filters.len);
|
|
|
|
struct miqt_string* filters_arr = static_cast<struct miqt_string*>(filters.data);
|
|
|
|
for(size_t i = 0; i < filters.len; ++i) {
|
2024-10-18 23:53:33 +00:00
|
|
|
QString filters_arr_i_QString = QString::fromUtf8(filters_arr[i].data, filters_arr[i].len);
|
2024-09-17 07:43:35 +00:00
|
|
|
filters_QList.push_back(filters_arr_i_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
self->setNameFilters(filters_QList);
|
|
|
|
}
|
|
|
|
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array QDirModel_NameFilters(const QDirModel* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QStringList _ret = self->nameFilters();
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
QString _lv_ret = _ret[i];
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _lv_b = _lv_ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_b.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
struct miqt_array _out;
|
|
|
|
_out.len = _ret.length();
|
|
|
|
_out.data = static_cast<void*>(_arr);
|
2024-09-14 22:29:05 +00:00
|
|
|
return _out;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
void QDirModel_SetFilter(QDirModel* self, int filters) {
|
|
|
|
self->setFilter(static_cast<QDir::Filters>(filters));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QDirModel_Filter(const QDirModel* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QDir::Filters _ret = self->filter();
|
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDirModel_SetSorting(QDirModel* self, int sort) {
|
|
|
|
self->setSorting(static_cast<QDir::SortFlags>(sort));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QDirModel_Sorting(const QDirModel* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QDir::SortFlags _ret = self->sorting();
|
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QDirModel_SetResolveSymlinks(QDirModel* self, bool enable) {
|
|
|
|
self->setResolveSymlinks(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QDirModel_ResolveSymlinks(const QDirModel* self) {
|
|
|
|
return self->resolveSymlinks();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDirModel_SetReadOnly(QDirModel* self, bool enable) {
|
|
|
|
self->setReadOnly(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QDirModel_IsReadOnly(const QDirModel* self) {
|
|
|
|
return self->isReadOnly();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDirModel_SetLazyChildCount(QDirModel* self, bool enable) {
|
|
|
|
self->setLazyChildCount(enable);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QDirModel_LazyChildCount(const QDirModel* self) {
|
|
|
|
return self->lazyChildCount();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QModelIndex* QDirModel_IndexWithPath(const QDirModel* self, struct miqt_string path) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QModelIndex(self->index(path_QString));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QDirModel_IsDir(const QDirModel* self, QModelIndex* index) {
|
|
|
|
return self->isDir(*index);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QModelIndex* QDirModel_Mkdir(QDirModel* self, QModelIndex* parent, struct miqt_string name) {
|
|
|
|
QString name_QString = QString::fromUtf8(name.data, name.len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QModelIndex(self->mkdir(*parent, name_QString));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QDirModel_Rmdir(QDirModel* self, QModelIndex* index) {
|
|
|
|
return self->rmdir(*index);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QDirModel_Remove(QDirModel* self, QModelIndex* index) {
|
|
|
|
return self->remove(*index);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirModel_FilePath(const QDirModel* self, QModelIndex* index) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->filePath(*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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirModel_FileName(const QDirModel* self, QModelIndex* index) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->fileName(*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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QIcon* QDirModel_FileIcon(const QDirModel* self, QModelIndex* index) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QIcon(self->fileIcon(*index));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QFileInfo* QDirModel_FileInfo(const QDirModel* self, QModelIndex* index) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QFileInfo(self->fileInfo(*index));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDirModel_Refresh(QDirModel* self) {
|
|
|
|
self->refresh();
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirModel_Tr2(const char* s, const char* c) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = QDirModel::tr(s, c);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirModel_Tr3(const char* s, const char* c, int n) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = QDirModel::tr(s, c, static_cast<int>(n));
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirModel_TrUtf82(const char* s, const char* c) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = QDirModel::trUtf8(s, c);
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QDirModel_TrUtf83(const char* s, const char* c, int n) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = QDirModel::trUtf8(s, c, static_cast<int>(n));
|
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
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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;
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QModelIndex* QDirModel_Index3(const QDirModel* self, int row, int column, QModelIndex* parent) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QModelIndex(self->index(static_cast<int>(row), static_cast<int>(column), *parent));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QDirModel_RowCount1(const QDirModel* self, QModelIndex* parent) {
|
|
|
|
return self->rowCount(*parent);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QDirModel_ColumnCount1(const QDirModel* self, QModelIndex* parent) {
|
|
|
|
return self->columnCount(*parent);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QVariant* QDirModel_Data2(const QDirModel* self, QModelIndex* index, int role) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVariant(self->data(*index, static_cast<int>(role)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QDirModel_SetData3(QDirModel* self, QModelIndex* index, QVariant* value, int role) {
|
|
|
|
return self->setData(*index, *value, static_cast<int>(role));
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
QVariant* QDirModel_HeaderData3(const QDirModel* self, int section, int orientation, int role) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QVariant(self->headerData(static_cast<int>(section), static_cast<Qt::Orientation>(orientation), static_cast<int>(role)));
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QDirModel_HasChildren1(const QDirModel* self, QModelIndex* index) {
|
|
|
|
return self->hasChildren(*index);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
void QDirModel_Sort2(QDirModel* self, int column, int order) {
|
2024-08-29 07:01:51 +00:00
|
|
|
self->sort(static_cast<int>(column), static_cast<Qt::SortOrder>(order));
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QModelIndex* QDirModel_Index2(const QDirModel* self, struct miqt_string path, int column) {
|
|
|
|
QString path_QString = QString::fromUtf8(path.data, path.len);
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QModelIndex(self->index(path_QString, static_cast<int>(column)));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QDirModel_Refresh1(QDirModel* self, QModelIndex* parent) {
|
|
|
|
self->refresh(*parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QDirModel_Delete(QDirModel* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|