equal
deleted
inserted
replaced
70 |
70 |
71 #define XMLLISTMODEL_CLEAR_ID 0 |
71 #define XMLLISTMODEL_CLEAR_ID 0 |
72 |
72 |
73 /*! |
73 /*! |
74 \qmlclass XmlRole QDeclarativeXmlListModelRole |
74 \qmlclass XmlRole QDeclarativeXmlListModelRole |
|
75 \ingroup qml-working-with-data |
75 \since 4.7 |
76 \since 4.7 |
76 \brief The XmlRole element allows you to specify a role for an XmlListModel. |
77 \brief The XmlRole element allows you to specify a role for an XmlListModel. |
77 |
78 |
78 \sa {QtDeclarative} |
79 \sa {QtDeclarative} |
79 */ |
80 */ |
463 int queryId; |
464 int queryId; |
464 QStringList keyRoleResultsCache; |
465 QStringList keyRoleResultsCache; |
465 QList<QDeclarativeXmlListModelRole *> roleObjects; |
466 QList<QDeclarativeXmlListModelRole *> roleObjects; |
466 static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role); |
467 static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role); |
467 static void clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list); |
468 static void clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list); |
468 static void removeAt_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, int i); |
|
469 static void insert_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, int i, QDeclarativeXmlListModelRole *role); |
|
470 QList<QList<QVariant> > data; |
469 QList<QList<QVariant> > data; |
471 int redirectCount; |
470 int redirectCount; |
472 }; |
471 }; |
473 |
472 |
474 |
473 |
497 _this->d_func()->roleNames.clear(); |
496 _this->d_func()->roleNames.clear(); |
498 _this->d_func()->roleObjects.clear(); |
497 _this->d_func()->roleObjects.clear(); |
499 } |
498 } |
500 |
499 |
501 /*! |
500 /*! |
502 \class QDeclarativeXmlListModel |
|
503 \internal |
|
504 */ |
|
505 |
|
506 /*! |
|
507 \qmlclass XmlListModel QDeclarativeXmlListModel |
501 \qmlclass XmlListModel QDeclarativeXmlListModel |
|
502 \ingroup qml-working-with-data |
508 \since 4.7 |
503 \since 4.7 |
509 \brief The XmlListModel element is used to specify a model using XPath expressions. |
504 \brief The XmlListModel element is used to specify a model using XPath expressions. |
510 |
505 |
511 XmlListModel is used to create a model from XML data. It can be used as a data source |
506 XmlListModel is used to create a model from XML data. It can be used as a data source |
512 for view elements (such as ListView, PathView, GridView) and other elements that interact with model |
507 for view elements (such as ListView, PathView, GridView) and other elements that interact with model |
558 |
553 |
559 \qml |
554 \qml |
560 ListView { |
555 ListView { |
561 width: 180; height: 300 |
556 width: 180; height: 300 |
562 model: xmlModel |
557 model: xmlModel |
563 delegate: Text { text: title + " (" + pubDate + ")" } |
558 delegate: Text { text: title + ": " + pubDate } |
564 } |
559 } |
565 \endqml |
560 \endqml |
566 |
561 |
567 \image qml-xmllistmodel-example.png |
562 \image qml-xmllistmodel-example.png |
568 |
563 |
853 { |
848 { |
854 Q_D(const QDeclarativeXmlListModel); |
849 Q_D(const QDeclarativeXmlListModel); |
855 return d->progress; |
850 return d->progress; |
856 } |
851 } |
857 |
852 |
|
853 /*! |
|
854 \qmlmethod void XmlListModel::errorString() |
|
855 |
|
856 Returns a string description of the last error that occurred |
|
857 if \l status is XmlListModel::Error. |
|
858 */ |
858 QString QDeclarativeXmlListModel::errorString() const |
859 QString QDeclarativeXmlListModel::errorString() const |
859 { |
860 { |
860 Q_D(const QDeclarativeXmlListModel); |
861 Q_D(const QDeclarativeXmlListModel); |
861 return d->errorString; |
862 return d->errorString; |
862 } |
863 } |