Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ListModel Class Reference

#include <qqmllistmodel_p_p.h>

+ Collaboration diagram for ListModel:

Public Types

enum class  SetElement { WasJustInserted , IsCurrentlyUpdated }
 

Public Member Functions

 ListModel (ListLayout *layout, QQmlListModel *modelCache)
 
 ~ListModel ()
 
void destroy ()
 
int setOrCreateProperty (int elementIndex, const QString &key, const QVariant &data)
 
int setExistingProperty (int uid, const QString &key, const QV4::Value &data, QV4::ExecutionEngine *eng)
 
QVariant getProperty (int elementIndex, int roleIndex, const QQmlListModel *owner, QV4::ExecutionEngine *eng)
 
ListModelgetListProperty (int elementIndex, const ListLayout::Role &role)
 
void updateTranslations ()
 
int roleCount () const
 
const ListLayout::RolegetExistingRole (int index) const
 
const ListLayout::RolegetExistingRole (QV4::String *key) const
 
const ListLayout::RolegetOrCreateListRole (const QString &name)
 
int elementCount () const
 
void set (int elementIndex, QV4::Object *object, QVector< int > *roles)
 
void set (int elementIndex, QV4::Object *object, SetElement reason=SetElement::IsCurrentlyUpdated)
 
int append (QV4::Object *object)
 
void insert (int elementIndex, QV4::Object *object)
 
Q_REQUIRED_RESULT QVector< std::function< void()> > remove (int index, int count)
 
int appendElement ()
 
void insertElement (int index)
 
void move (int from, int to, int n)
 
QObjectgetOrCreateModelObject (QQmlListModel *model, int elementIndex)
 

Static Public Member Functions

static bool sync (ListModel *src, ListModel *target)
 

Friends

class ListElement
 
class QQmlListModelWorkerAgent
 
class QQmlListModelParser
 

Detailed Description

Definition at line 314 of file qqmllistmodel_p_p.h.

Member Enumeration Documentation

◆ SetElement

enum class ListModel::SetElement
strong
Enumerator
WasJustInserted 
IsCurrentlyUpdated 

Definition at line 356 of file qqmllistmodel_p_p.h.

Constructor & Destructor Documentation

◆ ListModel()

ListModel::ListModel ( ListLayout layout,
QQmlListModel modelCache 
)

Definition at line 472 of file qqmllistmodel.cpp.

◆ ~ListModel()

ListModel::~ListModel ( )
inline

Definition at line 319 of file qqmllistmodel_p_p.h.

Member Function Documentation

◆ append()

int ListModel::append ( QV4::Object object)

Definition at line 769 of file qqmllistmodel.cpp.

References appendElement(), set, and WasJustInserted.

Referenced by QQmlListModel::append(), set(), and set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendElement()

int ListModel::appendElement ( )

Definition at line 487 of file qqmllistmodel.cpp.

References QPODVector< T, Increment >::count().

Referenced by append().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy()

void ListModel::destroy ( )

Definition at line 476 of file qqmllistmodel.cpp.

References QPODVector< T, Increment >::count(), and remove().

Referenced by QQmlListModel::~QQmlListModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ elementCount()

int ListModel::elementCount ( ) const
inline

Definition at line 351 of file qqmllistmodel_p_p.h.

References QPODVector< T, Increment >::count().

Referenced by QQmlListModel::append(), and QQmlListModel::count().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExistingRole() [1/2]

const ListLayout::Role & ListModel::getExistingRole ( int  index) const
inline

Definition at line 336 of file qqmllistmodel_p_p.h.

References ListLayout::getExistingRole().

Referenced by QV4::ModelObjectOwnPropertyKeyIterator::next(), QQmlListModel::roleNames(), QQmlListModel::setData(), ModelNodeMetaObject::updateValues(), and ModelNodeMetaObject::updateValues().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExistingRole() [2/2]

const ListLayout::Role * ListModel::getExistingRole ( QV4::String key) const
inline

Definition at line 341 of file qqmllistmodel_p_p.h.

References ListLayout::getExistingRole().

+ Here is the call graph for this function:

◆ getListProperty()

ListModel * ListModel::getListProperty ( int  elementIndex,
const ListLayout::Role role 
)

Definition at line 551 of file qqmllistmodel.cpp.

References e.

Referenced by ListElement::sync().

+ Here is the caller graph for this function:

◆ getOrCreateListRole()

const ListLayout::Role & ListModel::getOrCreateListRole ( const QString name)
inline

Definition at line 346 of file qqmllistmodel_p_p.h.

References ListLayout::getRoleOrCreate(), and ListLayout::Role::List.

+ Here is the call graph for this function:

◆ getOrCreateModelObject()

QObject * ListModel::getOrCreateModelObject ( QQmlListModel model,
int  elementIndex 
)

Definition at line 315 of file qqmllistmodel.cpp.

References QObjectPrivate::declarativeData, QQmlData::DoesNotOwnMemory, e, elements, QObjectPrivate::get(), model, Q_ASSERT, and void.

Referenced by QQmlListModel::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProperty()

QVariant ListModel::getProperty ( int  elementIndex,
int  roleIndex,
const QQmlListModel owner,
QV4::ExecutionEngine eng 
)

Definition at line 542 of file qqmllistmodel.cpp.

References e, ListLayout::getExistingRole(), and ListLayout::roleCount().

Referenced by QQmlListModel::data().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

void ListModel::insert ( int  elementIndex,
QV4::Object object 
)

Definition at line 763 of file qqmllistmodel.cpp.

References insertElement(), set, and WasJustInserted.

Referenced by QQmlListModel::insert(), and QQmlListModel::set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertElement()

void ListModel::insertElement ( int  index)

Definition at line 494 of file qqmllistmodel.cpp.

Referenced by insert().

+ Here is the caller graph for this function:

◆ move()

void ListModel::move ( int  from,
int  to,
int  n 
)

Definition at line 500 of file qqmllistmodel.cpp.

References QPODVector< T, Increment >::append(), QPODVector< T, Increment >::count(), and i.

Referenced by QQmlListModel::move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

QVector< std::function< void()> > ListModel::remove ( int  index,
int  count 
)

Definition at line 747 of file qqmllistmodel.cpp.

References QPODVector< T, Increment >::append(), i, layout, QPODVector< T, Increment >::remove(), and void.

Referenced by destroy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roleCount()

int ListModel::roleCount ( ) const
inline

Definition at line 331 of file qqmllistmodel_p_p.h.

References ListLayout::roleCount().

Referenced by QQmlListModel::roleNames(), and ModelNodeMetaObject::updateValues().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set() [1/2]

void ListModel::set ( int  elementIndex,
QV4::Object object,
QVector< int > *  roles 
)

◆ set() [2/2]

◆ setExistingProperty()

int ListModel::setExistingProperty ( int  uid,
const QString key,
const QV4::Value data,
QV4::ExecutionEngine eng 
)

Definition at line 797 of file qqmllistmodel.cpp.

References QPODVector< T, Increment >::count(), e, and ListLayout::getExistingRole().

Referenced by ModelNodeMetaObject::propertyWritten().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOrCreateProperty()

int ListModel::setOrCreateProperty ( int  elementIndex,
const QString key,
const QVariant data 
)

Definition at line 776 of file qqmllistmodel.cpp.

References cache, QPODVector< T, Increment >::count(), e, and ListLayout::getRoleOrCreate().

Referenced by QQmlListModel::setData(), and QQmlListModel::setProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sync()

bool ListModel::sync ( ListModel src,
ListModel target 
)
static

Definition at line 333 of file qqmllistmodel.cpp.

References QAbstractItemModel::beginInsertRows(), QAbstractItemModel::beginMoveRows(), QAbstractItemModel::beginRemoveRows(), QAbstractItemModel::createIndex(), QAbstractItemModel::dataChanged(), e, QHash< Key, T >::end(), QAbstractItemModel::endInsertRows(), QAbstractItemModel::endMoveRows(), QAbstractItemModel::endRemoveRows(), QHash< Key, T >::find(), i, QHash< Key, T >::insert(), it, j, mo, Q_ASSERT, ListElement::sync(), ListLayout::sync(), and QHash< Key, T >::iterator::value().

Referenced by QQmlListModelWorkerAgent::event(), and ListElement::sync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateTranslations()

void ListModel::updateTranslations ( )

Definition at line 557 of file qqmllistmodel.cpp.

References cache, QPODVector< T, Increment >::count(), and e.

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ ListElement

friend class ListElement
friend

Definition at line 394 of file qqmllistmodel_p_p.h.

◆ QQmlListModelParser

friend class QQmlListModelParser
friend

Definition at line 396 of file qqmllistmodel_p_p.h.

◆ QQmlListModelWorkerAgent

friend class QQmlListModelWorkerAgent
friend

Definition at line 395 of file qqmllistmodel_p_p.h.


The documentation for this class was generated from the following files: