Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QtAbstractItemModel.java
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4package org.qtproject.qt.android;
5
6import java.util.HashMap;
7
73public abstract class QtAbstractItemModel
74{
79
99 public abstract int columnCount(QtModelIndex parent);
114 public abstract Object data(QtModelIndex index, int role);
126 public abstract QtModelIndex index(int row, int column, QtModelIndex parent);
157 public abstract int rowCount(QtModelIndex parent);
164 public native boolean canFetchMore(QtModelIndex parent);
171 public native void fetchMore(QtModelIndex parent);
181 public native boolean hasChildren(QtModelIndex parent);
191 public native boolean hasIndex(int row, int column, QtModelIndex parent);
200 @SuppressWarnings("unchecked")
201 public HashMap<Integer, String> roleNames()
202 {
203 return (HashMap<Integer, String>)jni_roleNames();
204 }
205
221 {
222 return (QtModelIndex)jni_sibling(row, column, parent);
223 }
224
240 public boolean setData(QtModelIndex index, Object value, int role) {
241 return jni_setData(index, value, role);
242 }
243
263 public void dataChanged(QtModelIndex topLeft, QtModelIndex bottomRight, int[] roles) {
264 jni_dataChanged(topLeft, bottomRight, roles);
265 }
266
269 public interface OnDataChangedListener {
277 void onDataChanged(QtModelIndex topLeft, QtModelIndex bottomRight, int[] roles);
278 }
279
285 m_OnDataChangedListener = listener;
286 }
287
296 protected final void beginInsertColumns(QtModelIndex parent, int first, int last)
297 {
298 jni_beginInsertColumns(parent, first, last);
299 }
300
308 protected final void beginInsertRows(QtModelIndex parent, int first, int last)
309 {
310 jni_beginInsertRows(parent, first, last);
311 }
312
344 protected final boolean beginMoveColumns(QtModelIndex sourceParent, int sourceFirst,
345 int sourceLast, QtModelIndex destinationParent,
346 int destinationChild)
347 {
348 return jni_beginMoveColumns(sourceParent, sourceFirst, sourceLast, destinationParent,
349 destinationChild);
350 }
351
384 protected final boolean beginMoveRows(QtModelIndex sourceParent, int sourceFirst,
385 int sourceLast, QtModelIndex destinationParent,
386 int destinationChild)
387 {
388 return jni_beginMoveRows(sourceParent, sourceFirst, sourceLast, destinationParent,
389 destinationChild);
390 }
391
404 protected final void beginRemoveColumns(QtModelIndex parent, int first, int last)
405 {
406 jni_beginRemoveColumns(parent, first, last);
407 }
408
420 protected final void beginRemoveRows(QtModelIndex parent, int first, int last)
421 {
422 jni_beginRemoveRows(parent, first, last);
423 }
424
446 protected final void beginResetModel() { jni_beginResetModel(); }
447
455 protected final QtModelIndex createIndex(int row, int column, long id)
456 {
457 return (QtModelIndex)jni_createIndex(row, column, id);
458 }
459
468 protected final void endInsertColumns() { jni_endInsertColumns(); }
477 protected final void endInsertRows() { jni_endInsertRows(); }
487 protected final void endMoveColumns() { jni_endMoveColumns(); }
497 protected final void endMoveRows() { jni_endMoveRows(); }
506 protected final void endRemoveColumns() { jni_endRemoveColumns(); }
516 protected final void endRemoveRows() { jni_endRemoveRows(); }
524 protected final void endResetModel() { jni_endResetModel(); }
525
526 private void handleDataChanged(QtModelIndex topLeft, QtModelIndex bottomRight, int[] roles)
527 {
528 if (m_OnDataChangedListener != null) {
529 QtNative.runAction(() -> {
530 if (m_OnDataChangedListener != null)
531 m_OnDataChangedListener.onDataChanged(topLeft, bottomRight, roles);
532 });
533 }
534 }
535 private native void jni_beginInsertColumns(QtModelIndex parent, int first, int last);
536 private native void jni_beginInsertRows(QtModelIndex parent, int first, int last);
537 private native boolean jni_beginMoveColumns(QtModelIndex sourceParent, int sourceFirst,
538 int sourceLast, QtModelIndex destinationParent,
539 int destinationChild);
540 private native boolean jni_beginMoveRows(QtModelIndex sourceParent, int sourceFirst,
541 int sourceLast, QtModelIndex destinationParent,
542 int destinationChild);
543 private native void jni_beginRemoveColumns(QtModelIndex parent, int first, int last);
544 private native void jni_beginRemoveRows(QtModelIndex parent, int first, int last);
545 private native void jni_beginResetModel();
546 private native Object jni_createIndex(int row, int column, long id);
547 private native void jni_endInsertColumns();
548 private native void jni_endInsertRows();
549 private native void jni_endMoveColumns();
550 private native void jni_endMoveRows();
551 private native void jni_endRemoveColumns();
552 private native void jni_endRemoveRows();
553 private native void jni_endResetModel();
554 private native Object jni_roleNames();
555 private native Object jni_sibling(int row, int column, QtModelIndex parent);
556 private native boolean jni_setData(QtModelIndex index, Object value, int role);
557 private native void jni_dataChanged(QtModelIndex topLeft, QtModelIndex bottomRight,
558 int[] roles);
559
560 private long m_nativeReference = 0;
561 private OnDataChangedListener m_OnDataChangedListener;
562 private QtAbstractItemModel(long nativeReference) { m_nativeReference = nativeReference; }
563 private void detachFromNative() { m_nativeReference = 0; }
564
565 private long nativeReference() { return m_nativeReference; }
566 private void setNativeReference(long nativeReference) { m_nativeReference = nativeReference; }
567 private static boolean instanceOf(Object obj) { return (obj instanceof QtAbstractItemModel); }
568}
final boolean beginMoveColumns(QtModelIndex sourceParent, int sourceFirst, int sourceLast, QtModelIndex destinationParent, int destinationChild)
abstract QtModelIndex parent(QtModelIndex index)
native boolean canFetchMore(QtModelIndex parent)
final void beginRemoveColumns(QtModelIndex parent, int first, int last)
abstract int rowCount(QtModelIndex parent)
void dataChanged(QtModelIndex topLeft, QtModelIndex bottomRight, int[] roles)
native boolean hasIndex(int row, int column, QtModelIndex parent)
abstract Object data(QtModelIndex index, int role)
void setOnDataChangedListener(OnDataChangedListener listener)
abstract QtModelIndex index(int row, int column, QtModelIndex parent)
native boolean hasChildren(QtModelIndex parent)
final QtModelIndex createIndex(int row, int column, long id)
final void beginRemoveRows(QtModelIndex parent, int first, int last)
boolean setData(QtModelIndex index, Object value, int role)
native void fetchMore(QtModelIndex parent)
final void beginInsertColumns(QtModelIndex parent, int first, int last)
QtModelIndex sibling(int row, int column, QtModelIndex parent)
final boolean beginMoveRows(QtModelIndex sourceParent, int sourceFirst, int sourceLast, QtModelIndex destinationParent, int destinationChild)
final void beginInsertRows(QtModelIndex parent, int first, int last)
abstract int columnCount(QtModelIndex parent)
void onDataChanged(QtModelIndex topLeft, QtModelIndex bottomRight, int[] roles)
[vector_of_multirole_objects_0]
Definition main.cpp:188
EGLOutputLayerEXT EGLint EGLAttrib value
[3]
GLint first
GLuint index
GLenum GLenum GLsizei void GLsizei void * column
GLhandleARB obj
[0]
GLenum GLenum GLsizei void * row