Qt 4.8
Signals | Public Functions | Private Functions | Properties | Friends | List of all members
QDeclarativeListModel Class Reference

#include <qdeclarativelistmodel_p.h>

Inheritance diagram for QDeclarativeListModel:
QListModelInterface QObject

Signals

void countChanged ()
 
- Signals inherited from QListModelInterface
void itemsChanged (int index, int count, const QList< int > &roles)
 Emit this signal when count items at index have had their roles changed. More...
 
void itemsInserted (int index, int count)
 Emit this signal when count items are inserted at index. More...
 
void itemsMoved (int from, int to, int count)
 Emit this signal when count items are moved from index from to index to. More...
 
void itemsRemoved (int index, int count)
 Emit this signal when count items are removed at index. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 

Public Functions

QDeclarativeListModelWorkerAgentagent ()
 
Q_INVOKABLE void append (const QScriptValue &)
 
Q_INVOKABLE void clear ()
 
virtual int count () const
 Returns the number of data entries in the model. More...
 
virtual QVariant data (int index, int role) const
 Returns the data at the given index for the specified roles. More...
 
Q_INVOKABLE QScriptValue get (int index) const
 
Q_INVOKABLE void insert (int index, const QScriptValue &)
 
Q_INVOKABLE void move (int from, int to, int count)
 
 QDeclarativeListModel (QObject *parent=0)
 
Q_INVOKABLE void remove (int index)
 
virtual QList< int > roles () const
 Returns the list of roles for which the list model interface provides data. More...
 
Q_INVOKABLE void set (int index, const QScriptValue &)
 
Q_INVOKABLE void setProperty (int index, const QString &property, const QVariant &value)
 
Q_INVOKABLE void sync ()
 
virtual QString toString (int role) const
 Returns a string description of the specified role. More...
 
 ~QDeclarativeListModel ()
 
- Public Functions inherited from QListModelInterface
 QListModelInterface (QObject *parent=0)
 Constructs a QListModelInterface with the specified parent. More...
 
virtual ~QListModelInterface ()
 The destructor is virtual. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Private Functions

bool canMove (int from, int to, int n) const
 
bool flatten ()
 
bool inWorkerThread () const
 
 QDeclarativeListModel (const QDeclarativeListModel *orig, QDeclarativeListModelWorkerAgent *parent)
 
void set (int index, const QScriptValue &, QList< int > *roles)
 
void setProperty (int index, const QString &property, const QVariant &value, QList< int > *roles)
 

Properties

int count
 
QDeclarativeListModelWorkerAgentm_agent
 
FlatListModelm_flat
 
NestedListModelm_nested
 

Friends

class FlatListModel
 
class FlatListScriptClass
 
struct ModelNode
 
class QDeclarativeListModelParser
 
class QDeclarativeListModelWorkerAgent
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QListModelInterface
 QListModelInterface (QObjectPrivate &dd, QObject *parent)
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 67 of file qdeclarativelistmodel_p.h.

Constructors and Destructors

◆ QDeclarativeListModel() [1/2]

QDeclarativeListModel::QDeclarativeListModel ( QObject parent = 0)

Definition at line 222 of file qdeclarativelistmodel.cpp.

Referenced by ModelNode::model().

223 : QListModelInterface(parent), m_agent(0), m_nested(new NestedListModel(this)), m_flat(0)
224 {
225 }
QListModelInterface(QObject *parent=0)
Constructs a QListModelInterface with the specified parent.
QDeclarativeListModelWorkerAgent * m_agent

◆ ~QDeclarativeListModel()

QDeclarativeListModel::~QDeclarativeListModel ( )

Definition at line 244 of file qdeclarativelistmodel.cpp.

245 {
246  if (m_agent)
247  m_agent->release();
248 
249  delete m_nested;
250  delete m_flat;
251 }
QDeclarativeListModelWorkerAgent * m_agent

◆ QDeclarativeListModel() [2/2]

QDeclarativeListModel::QDeclarativeListModel ( const QDeclarativeListModel orig,
QDeclarativeListModelWorkerAgent parent 
)
private

Definition at line 227 of file qdeclarativelistmodel.cpp.

228 : QListModelInterface(parent), m_agent(0), m_nested(0), m_flat(0)
229 {
230  m_flat = new FlatListModel(this);
232 
233  if (orig->m_flat) {
234  m_flat->m_roles = orig->m_flat->m_roles;
235  m_flat->m_strings = orig->m_flat->m_strings;
236  m_flat->m_values = orig->m_flat->m_values;
237 
239  for (int i=0; i<m_flat->m_values.count(); i++)
240  m_flat->m_nodeData << 0;
241  }
242 }
QListModelInterface(QObject *parent=0)
Constructs a QListModelInterface with the specified parent.
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QList< FlatNodeData * > m_nodeData
QList< QHash< int, QVariant > > m_values
QHash< int, QString > m_roles
QHash< QString, int > m_strings
QDeclarativeListModelWorkerAgent * m_parentAgent
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QDeclarativeListModelWorkerAgent * m_agent
void reserve(int size)
Reserve space for alloc elements.
Definition: qlist.h:496

Functions

◆ agent()

QDeclarativeListModelWorkerAgent * QDeclarativeListModel::agent ( )

Definition at line 292 of file qdeclarativelistmodel.cpp.

Referenced by QDeclarativeWorkerScriptEnginePrivate::scriptValueToVariant().

293 {
294  if (m_agent)
295  return m_agent;
296 
297  if (!flatten()) {
298  qmlInfo(this) << "List contains list-type data and cannot be used from a worker script";
299  return 0;
300  }
301 
303  return m_agent;
304 }
QDeclarativeListModelWorkerAgent * m_agent
QDeclarativeInfo qmlInfo(const QObject *me)
friend class QDeclarativeListModelWorkerAgent

◆ append()

void QDeclarativeListModel::append ( const QScriptValue valuemap)

Definition at line 518 of file qdeclarativelistmodel.cpp.

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

519 {
520  if (!valuemap.isObject() || valuemap.isArray()) {
521  qmlInfo(this) << tr("append: value is not an object");
522  return;
523  }
524 
525  insert(count(), valuemap);
526 }
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
virtual int count() const
Returns the number of data entries in the model.
Q_INVOKABLE void insert(int index, const QScriptValue &)
bool isArray() const
Returns true if this QScriptValue is an object of the Array class; otherwise returns false...
QDeclarativeInfo qmlInfo(const QObject *me)
bool isObject() const
Returns true if this QScriptValue is of the Object type; otherwise returns false. ...

◆ canMove()

bool QDeclarativeListModel::canMove ( int  from,
int  to,
int  n 
) const
inlineprivate

Definition at line 112 of file qdeclarativelistmodel_p.h.

Referenced by move(), and FlatListModel::moveNodes().

112 { return !(from+n > count() || to+n > count() || from < 0 || to < 0 || n < 0); }
virtual int count() const
Returns the number of data entries in the model.

◆ clear()

void QDeclarativeListModel::clear ( )

Definition at line 346 of file qdeclarativelistmodel.cpp.

Referenced by QDeclarativeListModelWorkerAgent::clear().

347 {
348  int cleared = count();
349  if (m_flat)
350  m_flat->clear();
351  else
352  m_nested->clear();
353 
354  if (!inWorkerThread()) {
355  emit itemsRemoved(0, cleared);
356  emit countChanged();
357  }
358 }
void itemsRemoved(int index, int count)
Emit this signal when count items are removed at index.
#define emit
Definition: qobjectdefs.h:76
virtual int count() const
Returns the number of data entries in the model.

◆ count()

virtual int QDeclarativeListModel::count ( ) const
virtual

Returns the number of data entries in the model.

Implements QListModelInterface.

Referenced by append(), clear(), data(), insert(), remove(), set(), and setProperty().

◆ countChanged

void QDeclarativeListModel::countChanged ( )
signal

◆ data()

QVariant QDeclarativeListModel::data ( int  index,
int  role 
) const
virtual

Returns the data at the given index for the specified roles.

Implements QListModelInterface.

Definition at line 316 of file qdeclarativelistmodel.cpp.

Referenced by QDeclarativeListModelParser::compile(), and QDeclarativeListModelParser::setCustomData().

317 {
318  if (index >= count() || index < 0)
319  return QVariant();
320 
321  return m_flat ? m_flat->data(index, role) : m_nested->data(index, role);
322 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QHash< int, QVariant > data(int index, const QList< int > &roles, bool *hasNested=0) const
QVariant data(int index, int role) const
virtual int count() const
Returns the number of data entries in the model.
quint16 index

◆ flatten()

bool QDeclarativeListModel::flatten ( )
private

Definition at line 253 of file qdeclarativelistmodel.cpp.

Referenced by agent().

254 {
255  if (m_flat)
256  return true;
257 
259 
261  bool hasNested = false;
262  for (int i=0; i<m_nested->count(); i++) {
263  values.append(m_nested->data(i, roles, &hasNested));
264  if (hasNested)
265  return false;
266  }
267 
268  FlatListModel *flat = new FlatListModel(this);
269  flat->m_values = values;
270 
271  for (int i=0; i<roles.count(); i++) {
272  QString s = m_nested->toString(roles[i]);
273  flat->m_roles.insert(roles[i], s);
274  flat->m_strings.insert(s, roles[i]);
275  }
276 
277  flat->m_nodeData.reserve(flat->m_values.count());
278  for (int i=0; i<flat->m_values.count(); i++)
279  flat->m_nodeData << 0;
280 
281  m_flat = flat;
282  delete m_nested;
283  m_nested = 0;
284  return true;
285 }
QHash< int, QVariant > data(int index, const QList< int > &roles, bool *hasNested=0) const
QList< int > roles() const
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString toString(int role) const
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QList< FlatNodeData * > m_nodeData
QList< QHash< int, QVariant > > m_values
QHash< int, QString > m_roles
quint16 values[128]
QHash< QString, int > m_strings
virtual QList< int > roles() const
Returns the list of roles for which the list model interface provides data.
void reserve(int size)
Reserve space for alloc elements.
Definition: qlist.h:496

◆ get()

QScriptValue QDeclarativeListModel::get ( int  index) const

Definition at line 562 of file qdeclarativelistmodel.cpp.

Referenced by QDeclarativeListModelWorkerAgent::get().

563 {
564  // the internal flat/nested class checks for bad index
565  return m_flat ? m_flat->get(index) : m_nested->get(index);
566 }
QScriptValue get(int index) const
quint16 index
QScriptValue get(int index) const

◆ insert()

void QDeclarativeListModel::insert ( int  index,
const QScriptValue valuemap 
)

Definition at line 437 of file qdeclarativelistmodel.cpp.

Referenced by append(), and QDeclarativeListModelWorkerAgent::insert().

438 {
439  if (!valuemap.isObject() || valuemap.isArray()) {
440  qmlInfo(this) << tr("insert: value is not an object");
441  return;
442  }
443 
444  if (index < 0 || index > count()) {
445  qmlInfo(this) << tr("insert: index %1 out of range").arg(index);
446  return;
447  }
448 
449  bool ok = m_flat ? m_flat->insert(index, valuemap) : m_nested->insert(index, valuemap);
450  if (ok && !inWorkerThread()) {
452  emit countChanged();
453  }
454 }
bool insert(int index, const QScriptValue &)
bool insert(int index, const QScriptValue &)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
#define emit
Definition: qobjectdefs.h:76
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
virtual int count() const
Returns the number of data entries in the model.
void itemsInserted(int index, int count)
Emit this signal when count items are inserted at index.
quint16 index
bool isArray() const
Returns true if this QScriptValue is an object of the Array class; otherwise returns false...
QDeclarativeInfo qmlInfo(const QObject *me)
bool isObject() const
Returns true if this QScriptValue is of the Object type; otherwise returns false. ...

◆ inWorkerThread()

bool QDeclarativeListModel::inWorkerThread ( ) const
private

Definition at line 287 of file qdeclarativelistmodel.cpp.

Referenced by clear(), insert(), move(), remove(), set(), and setProperty().

288 {
289  return m_flat && m_flat->m_parentAgent;
290 }
QDeclarativeListModelWorkerAgent * m_parentAgent

◆ move()

void QDeclarativeListModel::move ( int  from,
int  to,
int  count 
)

Definition at line 473 of file qdeclarativelistmodel.cpp.

Referenced by QDeclarativeListModelWorkerAgent::move().

474 {
475  if (n==0 || from==to)
476  return;
477  if (!canMove(from, to, n)) {
478  qmlInfo(this) << tr("move: out of range");
479  return;
480  }
481 
482  int origfrom = from;
483  int origto = to;
484  int orign = n;
485  if (from > to) {
486  // Only move forwards - flip if backwards moving
487  int tfrom = from;
488  int tto = to;
489  from = tto;
490  to = tto+n;
491  n = tfrom-tto;
492  }
493 
494  if (m_flat)
495  m_flat->move(from, to, n);
496  else
497  m_nested->move(from, to, n);
498 
499  if (!inWorkerThread())
500  emit itemsMoved(origfrom, origto, orign);
501 }
void move(int from, int to, int count)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
#define emit
Definition: qobjectdefs.h:76
void itemsMoved(int from, int to, int count)
Emit this signal when count items are moved from index from to index to.
bool canMove(int from, int to, int n) const
QDeclarativeInfo qmlInfo(const QObject *me)
void move(int from, int to, int count)

◆ remove()

void QDeclarativeListModel::remove ( int  index)

Definition at line 401 of file qdeclarativelistmodel.cpp.

Referenced by QDeclarativeListModelWorkerAgent::remove().

402 {
403  if (index < 0 || index >= count()) {
404  qmlInfo(this) << tr("remove: index %1 out of range").arg(index);
405  return;
406  }
407 
408  if (m_flat)
409  m_flat->remove(index);
410  else
412 
413  if (!inWorkerThread()) {
414  emit itemsRemoved(index, 1);
415  emit countChanged();
416  }
417 }
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
void itemsRemoved(int index, int count)
Emit this signal when count items are removed at index.
#define emit
Definition: qobjectdefs.h:76
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
virtual int count() const
Returns the number of data entries in the model.
void remove(int index)
quint16 index
QDeclarativeInfo qmlInfo(const QObject *me)

◆ roles()

QList< int > QDeclarativeListModel::roles ( ) const
virtual

Returns the list of roles for which the list model interface provides data.

Implements QListModelInterface.

Definition at line 306 of file qdeclarativelistmodel.cpp.

Referenced by flatten(), set(), and setProperty().

307 {
308  return m_flat ? m_flat->roles() : m_nested->roles();
309 }
QList< int > roles() const
QList< int > roles() const

◆ set() [1/2]

void QDeclarativeListModel::set ( int  index,
const QScriptValue valuemap 
)

Definition at line 587 of file qdeclarativelistmodel.cpp.

Referenced by QDeclarativeListModelWorkerAgent::set().

588 {
590  set(index, valuemap, &roles);
591  if (!roles.isEmpty() && !inWorkerThread())
592  emit itemsChanged(index, 1, roles);
593 }
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define emit
Definition: qobjectdefs.h:76
void itemsChanged(int index, int count, const QList< int > &roles)
Emit this signal when count items at index have had their roles changed.
virtual QList< int > roles() const
Returns the list of roles for which the list model interface provides data.
quint16 index

◆ set() [2/2]

void QDeclarativeListModel::set ( int  index,
const QScriptValue valuemap,
QList< int > *  roles 
)
private

Definition at line 595 of file qdeclarativelistmodel.cpp.

596 {
597  if (!valuemap.isObject() || valuemap.isArray()) {
598  qmlInfo(this) << tr("set: value is not an object");
599  return;
600  }
601  if (index > count() || index < 0) {
602  qmlInfo(this) << tr("set: index %1 out of range").arg(index);
603  return;
604  }
605 
606  if (index == count()) {
607  append(valuemap);
608  } else {
609  if (m_flat)
610  m_flat->set(index, valuemap, roles);
611  else
612  m_nested->set(index, valuemap, roles);
613  }
614 }
void set(int index, const QScriptValue &, QList< int > *roles)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
Q_INVOKABLE void append(const QScriptValue &)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
virtual int count() const
Returns the number of data entries in the model.
quint16 index
bool isArray() const
Returns true if this QScriptValue is an object of the Array class; otherwise returns false...
QDeclarativeInfo qmlInfo(const QObject *me)
void set(int index, const QScriptValue &, QList< int > *roles)
bool isObject() const
Returns true if this QScriptValue is of the Object type; otherwise returns false. ...

◆ setProperty() [1/2]

void QDeclarativeListModel::setProperty ( int  index,
const QString property,
const QVariant value 
)

Definition at line 632 of file qdeclarativelistmodel.cpp.

Referenced by QDeclarativeListModelWorkerAgent::setProperty().

633 {
635  setProperty(index, property, value, &roles);
636  if (!roles.isEmpty() && !inWorkerThread())
637  emit itemsChanged(index, 1, roles);
638 }
Q_INVOKABLE void setProperty(int index, const QString &property, const QVariant &value)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define emit
Definition: qobjectdefs.h:76
void itemsChanged(int index, int count, const QList< int > &roles)
Emit this signal when count items at index have had their roles changed.
virtual QList< int > roles() const
Returns the list of roles for which the list model interface provides data.
quint16 index

◆ setProperty() [2/2]

void QDeclarativeListModel::setProperty ( int  index,
const QString property,
const QVariant value,
QList< int > *  roles 
)
private

Definition at line 640 of file qdeclarativelistmodel.cpp.

641 {
642  if (count() == 0 || index >= count() || index < 0) {
643  qmlInfo(this) << tr("set: index %1 out of range").arg(index);
644  return;
645  }
646 
647  if (m_flat)
648  m_flat->setProperty(index, property, value, roles);
649  else
650  m_nested->setProperty(index, property, value, roles);
651 }
void setProperty(int index, const QString &property, const QVariant &value, QList< int > *roles)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
void setProperty(int index, const QString &property, const QVariant &value, QList< int > *roles)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
virtual int count() const
Returns the number of data entries in the model.
quint16 index
QDeclarativeInfo qmlInfo(const QObject *me)

◆ sync()

void QDeclarativeListModel::sync ( )

Definition at line 662 of file qdeclarativelistmodel.cpp.

663 {
664  // This is just a dummy method to make it look like sync() exists in
665  // ListModel (and not just QDeclarativeListModelWorkerAgent) and to let
666  // us document sync().
667  qmlInfo(this) << "List sync() can only be called from a WorkerScript";
668 }
QDeclarativeInfo qmlInfo(const QObject *me)

◆ toString()

QString QDeclarativeListModel::toString ( int  role) const
virtual

Returns a string description of the specified role.

Implements QListModelInterface.

Definition at line 311 of file qdeclarativelistmodel.cpp.

312 {
313  return m_flat ? m_flat->toString(role) : m_nested->toString(role);
314 }
QString toString(int role) const
QString toString(int role) const

Friends and Related Functions

◆ FlatListModel

friend class FlatListModel
friend

Definition at line 99 of file qdeclarativelistmodel_p.h.

Referenced by flatten(), and QDeclarativeListModel().

◆ FlatListScriptClass

friend class FlatListScriptClass
friend

Definition at line 100 of file qdeclarativelistmodel_p.h.

◆ ModelNode

friend struct ModelNode
friend

◆ QDeclarativeListModelParser

Definition at line 97 of file qdeclarativelistmodel_p.h.

◆ QDeclarativeListModelWorkerAgent

Definition at line 98 of file qdeclarativelistmodel_p.h.

Referenced by agent().

Properties

◆ count

int QDeclarativeListModel::count
private

◆ m_agent

QDeclarativeListModelWorkerAgent* QDeclarativeListModel::m_agent
private

Definition at line 114 of file qdeclarativelistmodel_p.h.

Referenced by agent(), and ~QDeclarativeListModel().

◆ m_flat

FlatListModel* QDeclarativeListModel::m_flat
private

◆ m_nested

NestedListModel* QDeclarativeListModel::m_nested
private

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