Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qdeclarativeplacecontentmodel_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDECLARATIVEPLACECONTENTMODEL_H
5#define QDECLARATIVEPLACECONTENTMODEL_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtLocation/private/qlocationglobal_p.h>
19#include <QtCore/QAbstractListModel>
20#include <QtQml/QQmlParserStatus>
21#include <QtLocation/QPlaceContent>
22#include <QtLocation/QPlaceContentReply>
23#include <QtLocation/QPlaceContentRequest>
24#include <QtLocation/QPlaceSupplier>
25
26Q_MOC_INCLUDE(<QtLocation/private/qdeclarativeplace_p.h>)
27
29
33
34class Q_LOCATION_PRIVATE_EXPORT QDeclarativePlaceContentModel : public QAbstractListModel, public QQmlParserStatus
35{
37
38 Q_PROPERTY(QDeclarativePlace *place READ place WRITE setPlace NOTIFY placeChanged)
39 Q_PROPERTY(int batchSize READ batchSize WRITE setBatchSize NOTIFY batchSizeChanged)
40 Q_PROPERTY(int totalCount READ totalCount NOTIFY totalCountChanged)
41
43
44public:
47
48 QDeclarativePlace *place() const;
49 void setPlace(QDeclarativePlace *place);
50
51 int batchSize() const;
52 void setBatchSize(int batchSize);
53
54 int totalCount() const;
55
56 void clearData();
57
58 void initializeCollection(int totalCount, const QPlaceContent::Collection &collection);
59
60 // from QAbstractListModel
61 int rowCount(const QModelIndex &parent) const override;
62 QVariant data(const QModelIndex &index, int role) const override;
63 QHash<int, QByteArray> roleNames() const override;
64
65 enum Roles {
66 ContentSupplierRole = Qt::UserRole,
80 ReviewRatingRole
81 };
82
83 bool canFetchMore(const QModelIndex &parent) const override;
84 void fetchMore(const QModelIndex &parent) override;
85
86 // from QQmlParserStatus
87 void classBegin() override;
88 void componentComplete() override;
89
94
95private Q_SLOTS:
96 void fetchFinished();
97
98protected:
102
103private:
104 QDeclarativePlace *m_place = nullptr;
105 QPlaceContent::Type m_type;
106 int m_batchSize = 1;
107 int m_contentCount = -1;
108
109 QPlaceContentReply *m_reply = nullptr;
110 QPlaceContentRequest m_nextRequest;
111
112 bool m_complete = false;
113};
114
116{
118 QML_NAMED_ELEMENT(ReviewModel)
120
121public:
124 {}
125};
126
128{
130 QML_NAMED_ELEMENT(EditorialModel)
132public:
135 {}
136};
137
139{
141 QML_NAMED_ELEMENT(ImageModel)
143public:
146 {}
147};
148
150
151#endif // QDECLARATIVEPLACECONTENTMODEL_H
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
QMap< QString, QPlaceSupplier > m_suppliers
QDeclarativePlaceImageModel(QObject *parent=nullptr)
QDeclarativePlaceReviewModel(QObject *parent=nullptr)
\inmodule QtLocation
\inmodule QtCore
Definition qhash.h:818
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:90
\inmodule QtLocation
\inmodule QtLocation
\inmodule QtLocation
Type
Defines the type of content.
The QQmlParserStatus class provides updates on the QML parser state.
\inmodule QtCore
Definition qvariant.h:64
Combined button and popup list for selecting options.
@ UserRole
GLuint index
[2]
GLenum type
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INTERFACES(x)
#define Q_SLOTS
#define Q_GADGET
#define Q_MOC_INCLUDE(...)
#define Q_SIGNALS
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent