MeVisLab Scripting Reference
|
#include <mlPythonItemModelWrapper.h>
Inherits MLAbstractItemModelWrapper.
Public Slots | |
bool | isCaching () const |
void | setDataSource (PyObject *object, bool caching=false) |
Public Slots inherited from MLAbstractItemModelWrapper | |
QObject * | qmlModel () const |
bool | isFlat () const |
bool | hasChildren (const ModelIndexWrapper *parent) |
int | getChildCount (const ModelIndexWrapper *parent) |
ModelIndexWrapper * | getChild (const ModelIndexWrapper *parent, unsigned int index) |
ModelIndexWrapper * | getParent (const ModelIndexWrapper *child) |
ModelIndexWrapper * | findFirst (const QVariant &attribute, const QVariant &value) |
ModelIndexWrapper * | searchItem (const QVariant &attribute, const QVariantList &values) |
int | getAttributeCount () const |
QStringList | getAttributeNames () const |
QString | getAttributeName (int index) const |
QVariant | getAttributeDefault (int index) const |
int | getAttributeIndex (const QString &name) |
QVariant | getData (const ModelIndexWrapper *item, int attributeIndex) |
bool | setData (const ModelIndexWrapper *item, int attributeIndex, const QVariant &data) |
bool | bulkSetData (const QList< ModelIndexWrapper * > &items, int attributeIndex, const QVariant &data) |
Static Public Member Functions | |
static ml::RefCountedBase * | createObject (const QVariantList &arguments) |
Additional Inherited Members | |
Signals inherited from MLAbstractItemModelWrapper | |
void | itemChanged (ModelIndexWrapper *item, bool after) |
void | itemsInserted (ModelIndexWrapper *parent, unsigned int childIndex, unsigned int itemsInserted, bool after) |
void | itemsRemoved (ModelIndexWrapper *parent, unsigned int childIndex, unsigned int itemsRemoved, bool after) |
void | dataChanged (const QList< ModelIndexWrapper * > &items, const QList< int > &attributeIndices) |
This class wraps the class ml::PythonItemModel and thus provides an item model that takes its data from a Python object.
You should not use this wrapper directly.
Instead you should derive from class ItemModelDataSource contained in the ItemModelSupport Python module (source code at Packages/MeVisLab/Standard/Modules/Scripts/python/ItemModelSupport.py).
You can also have a look at the TestItemModelView module for an example. This module implements both the StandardItemModel and PythonItemModel and you can switch between these implementations.
|
static |
Create new Python item model; this is used by MLAB.createMLBaseObject to create a PythonItemModel. This takes a list with 1 or 2 arguments.
The first, required element is the list of attribute names.
The second, optional element is a bool. If set this is a hint that the model will have no sub-items. This can be used by views to avoid reserving space for sub-item indicators.
Example:
|
inlineslot |
Return if the model is caching the values.
|
slot |
Changing the data source object for the model.
If caching is set to true, most results obtained from the data source are cached.
The object must have certain methods, as e.g. found in the ItemModelDataSource class mentioned above.