4#include <QtQuick/private/qandroiditemmodelproxy_p.h>
5#include <QtQuick/private/qandroidmodelindexproxy_p.h>
6#include <QtQuick/private/qandroidtypeconverter_p.h>
16 return jInstance.callMethod<jint>(
"columnCount", parentIndex);
23 return jInstance.callMethod<jboolean>(
"canFetchMore", parentIndex);
35 QJniObject jData = jInstance.callMethod<jobject>(
"data", jIndex, role);
42 JQtModelIndex jIndex = jInstance.callMethod<JQtModelIndex>(
53 jInstance.callMethod<JQtModelIndex>(
"parent", jIndex));
60 return jInstance.callMethod<
int>(
"rowCount", parentIndex);
68 HashMap hashMap = jInstance.callMethod<HashMap>(
"roleNames");
69 Set
set = hashMap.callMethod<Set>(
"keySet");
70 QJniArray<jobject> keyArray =
set.callMethod<QJniArray<jobject>>(
"toArray");
72 for (
auto key : keyArray) {
73 const QJniObject roleName = hashMap.callMethod<jobject>(
"get",
key);
74 const int intKey =
QJniObject(
key).callMethod<jint>(
"intValue");
90 jInstance.callMethod<
void>(
"fetchMore", parentIndex);
102 return jInstance.callMethod<jboolean>(
"hasChildren", parentIndex);
125 jlong nativeReference = itemModel.callMethod<jlong>(
"nativeReference");
136 itemModel.callMethod<
void>(
"setNativeReference",
reinterpret_cast<jlong
>(nativeProxy));
138 auto proxy = qobject_cast<QAndroidItemModelProxy *>(
obj);
140 proxy->jInstance.callMethod<
void>(
"detachFromNative");
148 return JQtAndroidItemModelProxy(
reinterpret_cast<jlong
>(itemModel));
167 JQtModelIndex parent)
194 HashMap jRoleNames{};
196 const Integer jRole(role);
197 const QJniObject jRoleName = QJniObject::fromString(roleName);
198 jRoleNames.callMethod<jobject>(
"put", jRole.object(), jRoleName.object());
200 return env->NewLocalRef(jRoleNames.object());
234 JQtModelIndex parent)
241 JQtModelIndex parent, jint
first, jint last)
249 jint
first, jint last)
256 JQtModelIndex sourceParent, jint sourceFirst,
258 JQtModelIndex destinationParent,
259 jint destinationChild)
268 JQtModelIndex sourceParent, jint sourceFirst,
269 jint sourceLast, JQtModelIndex destinationParent,
270 jint destinationChild)
279 JQtModelIndex parent, jint
first, jint last)
286 jint
first, jint last)
333 JQtModelIndex parent)
343 return env.registerNativeMethods(
344 Traits<JQtAbstractItemModel>::className(),
370 return env.registerNativeMethods(
371 Traits<JQtAndroidItemModelProxy>::className(),
Q_INVOKABLE int const QModelIndex & parent
Returns the parent of the model item with the given index.
void endResetModel()
Completes a model reset operation.
bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow)
void endMoveColumns()
Ends a column move operation.
Q_INVOKABLE bool hasIndex(int row, int column, const QModelIndex &parent=QModelIndex()) const
Returns {true} if the model returns a valid QModelIndex for row and column with parent,...
void endRemoveRows()
Ends a row removal operation.
void endMoveRows()
Ends a row move operation.
void beginRemoveColumns(const QModelIndex &parent, int first, int last)
Begins a column removal operation.
Q_INVOKABLE int int const QModelIndex & destinationParent
virtual Q_INVOKABLE bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Returns {true} if parent has any children; otherwise returns {false}.
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of rows under the given parent.
virtual Q_INVOKABLE void fetchMore(const QModelIndex &parent)
Fetches any available data for the items with the parent specified by the parent index.
Q_INVOKABLE int int const QModelIndex int destinationChild
virtual Q_INVOKABLE bool canFetchMore(const QModelIndex &parent) const
Returns {true} if there is more data available for parent; otherwise returns {false}.
virtual Q_INVOKABLE QModelIndex sibling(int row, int column, const QModelIndex &idx) const
Returns the sibling at row and column for the item at index, or an invalid QModelIndex if there is no...
bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn)
Begins a column move operation.
virtual QHash< int, QByteArray > roleNames() const
void beginInsertColumns(const QModelIndex &parent, int first, int last)
Begins a column insertion operation.
void endInsertRows()
Ends a row insertion operation.
void beginResetModel()
Begins a model reset operation.
void endRemoveColumns()
Ends a column removal operation.
virtual Q_INVOKABLE int columnCount(const QModelIndex &parent=QModelIndex()) const =0
Returns the number of columns for the children of the given parent.
QModelIndex createIndex(int row, int column, const void *data=nullptr) const
Creates a model index for the given row and column with the internal pointer ptr.
void endInsertColumns()
Ends a column insertion operation.
virtual Q_INVOKABLE QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
void beginRemoveRows(const QModelIndex &parent, int first, int last)
Begins a row removal operation.
virtual Q_INVOKABLE QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index.
void beginInsertRows(const QModelIndex &parent, int first, int last)
Begins a row insertion operation.
static jobject jni_roleNames(JNIEnv *env, jobject object)
static QJniObject createProxy(QAbstractItemModel *abstractClass)
static jboolean jni_beginMoveRows(JNIEnv *env, jobject object, JQtModelIndex sourceParent, jint sourceFirst, jint sourceLast, JQtModelIndex destinationParent, jint destinationChild)
static auto invokeNativeMethod(JNIEnv *, jobject jvmObject, Func func, Args &&...args)
static void jni_beginResetModel(JNIEnv *env, jobject object)
static void jni_beginInsertRows(JNIEnv *env, jobject object, JQtModelIndex parent, jint first, jint last)
static Q_REQUIRED_RESULT QAbstractItemModel * nativeInstance(QtJniTypes::JQtAbstractItemModel itemModel)
static void jni_endRemoveRows(JNIEnv *env, jobject object)
static void jni_endResetModel(JNIEnv *env, jobject object)
static bool registerProxyNatives(QJniEnvironment &env)
QAndroidItemModelProxy(QtJniTypes::JQtAbstractItemModel jInstance)
static void jni_endInsertRows(JNIEnv *env, jobject object)
bool canFetchMoreDefault(const QModelIndex &parent) const
static auto invokeNativeProxyMethod(JNIEnv *, jobject jvmObject, Func func, Args &&...args)
static void jni_endMoveColumns(JNIEnv *env, jobject object)
static void jni_beginRemoveRows(JNIEnv *env, jobject object, JQtModelIndex parent, jint first, jint last)
void fetchMoreDefault(const QModelIndex &parent)
static void jni_endMoveRows(JNIEnv *env, jobject object)
static jint jni_columnCount(JNIEnv *env, jobject object, JQtModelIndex parent)
static jobject jni_createIndex(JNIEnv *env, jobject object, jint row, jint column, jlong id)
void fetchMore(const QModelIndex &parent) override
Fetches any available data for the items with the parent specified by the parent index.
static void jni_beginInsertColumns(JNIEnv *env, jobject object, JQtModelIndex parent, jint first, jint last)
static void jni_endRemoveColumns(JNIEnv *env, jobject object)
QModelIndex sibling(int row, int column, const QModelIndex &parent) const override
Returns the sibling at row and column for the item at index, or an invalid QModelIndex if there is no...
static jboolean jni_canFetchMore(JNIEnv *env, jobject object, JQtModelIndex parent)
bool hasChildren(const QModelIndex &parent) const override
Returns {true} if parent has any children; otherwise returns {false}.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns the data stored under the given role for the item referred to by the index.
static jobject jni_parent(JNIEnv *env, jobject object, JQtModelIndex index)
static void jni_endInsertColumns(JNIEnv *env, jobject object)
static bool registerAbstractNatives(QJniEnvironment &env)
static jobject jni_sibling(JNIEnv *env, jobject object, jint row, jint column, JQtModelIndex parent)
static void jni_beginRemoveColumns(JNIEnv *env, jobject object, JQtModelIndex parent, jint first, jint last)
QHash< int, QByteArray > defaultRoleNames() const
static jobject jni_data(JNIEnv *env, jobject object, JQtModelIndex index, jint role)
static jboolean jni_hasChildren(JNIEnv *env, jobject object, JQtModelIndex parent)
bool hasChildrenDefault(const QModelIndex &parent) const
QModelIndex siblingDefault(int row, int column, const QModelIndex &parent)
static Q_REQUIRED_RESULT QAbstractItemModel * createNativeProxy(QJniObject itemModel)
static jboolean jni_beginMoveColumns(JNIEnv *env, jobject object, JQtModelIndex sourceParent, jint sourceFirst, jint sourceLast, JQtModelIndex destinationParent, jint destinationChild)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns for the children of the given parent.
static void jni_fetchMore(JNIEnv *env, jobject object, JQtModelIndex parent)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
bool canFetchMore(const QModelIndex &parent) const override
Returns {true} if there is more data available for parent; otherwise returns {false}.
static jboolean jni_hasIndex(JNIEnv *env, jobject object, jint row, jint column, JQtModelIndex parent)
static auto invokeNativeImpl(JNIEnv *, jobject jvmObject, Func1 defaultFunc, Func2 func, Args &&...args)
static jobject jni_index(JNIEnv *env, jobject object, jint row, jint column, JQtModelIndex parent)
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the item in the model specified by the given row, column and parent index.
static jint jni_rowCount(JNIEnv *env, jobject object, JQtModelIndex parent)
QHash< int, QByteArray > roleNames() const override
static JQtModelIndex jInstance(QModelIndex modelIndex)
static QModelIndex qInstance(JQtModelIndex jModelIndex)
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
static QVariant toQVariant(const QJniObject &object)
static Q_REQUIRED_RESULT jobject toJavaObject(const QVariant &var, JNIEnv *env)
Combined button and popup list for selecting options.
#define Q_REQUIRED_RESULT
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
QFuture< QSet< QChar > > set
[10]