Qt Declarative Module

The QDeclarativeListReference class allows the manipulation of QDeclarativeListProperty properties. More...

This documentation was introduced in Qt 4.7.



Encapsulates a QML component definition


Defines a context within a QML engine


Environment for instantiating QML components


Encapsulates a QML error


Evaluates JavaScript in a QML context


Abstract base for custom QML extension plugins


Interface for supporting pixmaps and threaded image requests in QML


The most basic of all visual items in QML


Allows applications to expose list-like properties to QML


Creates QNetworkAccessManager instances for a QML engine


Updates on the QML parser state


Abstracts accessing properties on objects created from QML


Allows you to set key-value pairs that can be used in QML bindings


Interface for property value sources such as animations and bindings


Encapsulates a script and its context


Widget for displaying a Qt Declarative user interface

Detailed Description

QDeclarativeListReference allows C++ programs to read from, and assign values to a QML list property in a simple and type safe way. A QDeclarativeListReference can be created by passing an object and property name or through a QDeclarativeProperty instance. These two are equivalant:

QDeclarativeListReference ref1(object, "children");

QDeclarativeProperty ref2(object, "children");
QDeclarativeListReference ref2 = qvariant_cast<QDeclarativeListReference>(ref2.read());

Not all QML list properties support all operations. A set of methods, canAppend(), canAt(), canClear() and canCount() allow programs to query whether an operation is supported on a given property.

QML list properties are typesafe. Only QObject's that derive from the correct base class can be assigned to the list. The listElementType() method can be used to query the QMetaObject of the QObject type supported. Attempting to add objects of the incorrect type to a list property will fail.

Like with normal lists, when accessing a list element by index, it is the callers responsibility to ensure that it does not request an out of range element using the count() method before calling at().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.