Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QDECLARATIVEPLACECONTENTMODEL_H
6
#
define
QDECLARATIVEPLACECONTENTMODEL_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtLocation
/
private
/
qlocationglobal_p
.
h
>
20
#
include
<
QtCore
/
QAbstractListModel
>
21
#
include
<
QtQml
/
QQmlParserStatus
>
22
#
include
<
QtLocation
/
QPlaceContent
>
23
#
include
<
QtLocation
/
QPlaceContentReply
>
24
#
include
<
QtLocation
/
QPlaceContentRequest
>
25
#
include
<
QtLocation
/
QPlaceSupplier
>
26
27
Q_MOC_INCLUDE(<QtLocation/
private
/qdeclarativeplace_p.h>)
28
29
QT_BEGIN_NAMESPACE
30
31
class
QDeclarativePlace;
32
class
QDeclarativeGeoServiceProvider;
33
class
QGeoServiceProvider;
34
35
class
Q_LOCATION_EXPORT
QDeclarativePlaceContentModel
:
public
QAbstractListModel,
public
QQmlParserStatus
36
{
37
Q_OBJECT
38
39
Q_PROPERTY(QDeclarativePlace *place READ place WRITE setPlace NOTIFY placeChanged)
40
Q_PROPERTY(
int
batchSize READ batchSize WRITE setBatchSize NOTIFY batchSizeChanged)
41
Q_PROPERTY(
int
totalCount READ totalCount NOTIFY totalCountChanged)
42
43
Q_INTERFACES(QQmlParserStatus)
44
45
public
:
46
explicit
QDeclarativePlaceContentModel(QPlaceContent::Type type, QObject *parent =
nullptr
);
47
~QDeclarativePlaceContentModel();
48
49
QDeclarativePlace *place()
const
;
50
void
setPlace(QDeclarativePlace *place);
51
52
int
batchSize()
const
;
53
void
setBatchSize(
int
batchSize);
54
55
int
totalCount()
const
;
56
57
void
clearData();
58
59
void
initializeCollection(
int
totalCount,
const
QPlaceContent::Collection &collection);
60
61
// from QAbstractListModel
62
int
rowCount(
const
QModelIndex &parent)
const
override;
63
QVariant data(
const
QModelIndex &index,
int
role)
const
override;
64
QHash<
int
, QByteArray> roleNames()
const
override;
65
66
enum
Roles {
67
ContentSupplierRole = Qt::UserRole,
68
ContentUserRole,
69
ContentAttributionRole,
70
EditorialTitleRole,
71
EditorialTextRole,
72
EditorialLanguageRole,
73
ImageIdRole,
74
ImageUrlRole,
75
ImageMimeTypeRole,
76
ReviewIdRole,
77
ReviewDateTimeRole,
78
ReviewTitleRole,
79
ReviewTextRole,
80
ReviewLanguageRole,
81
ReviewRatingRole
82
};
83
84
bool
canFetchMore(
const
QModelIndex &parent)
const
override;
85
void
fetchMore(
const
QModelIndex &parent) override;
86
87
// from QQmlParserStatus
88
void
classBegin() override;
89
void
componentComplete() override;
90
91
Q_SIGNALS:
92
void
placeChanged();
93
void
batchSizeChanged();
94
void
totalCountChanged();
95
96
private
Q_SLOTS:
97
void
fetchFinished();
98
99
protected
:
100
QPlaceContent::Collection m_content;
101
QMap<QString, QPlaceSupplier> m_suppliers;
102
QMap<QString, QPlaceUser>m_users;
103
104
private
:
105
QDeclarativePlace *m_place =
nullptr
;
106
QPlaceContent::Type m_type;
107
int
m_batchSize = 1;
108
int
m_contentCount = -1;
109
110
QPlaceContentReply *m_reply =
nullptr
;
111
QPlaceContentRequest m_nextRequest;
112
113
bool
m_complete =
false
;
114
};
115
116
class
QDeclarativePlaceReviewModel
:
public
QDeclarativePlaceContentModel
117
{
118
Q_GADGET
119
QML_NAMED_ELEMENT(ReviewModel)
120
QML_ADDED_IN_VERSION
(5, 0)
121
122
public
:
123
explicit
QDeclarativePlaceReviewModel
(
QObject
*
parent
=
nullptr
)
124
:
QDeclarativePlaceContentModel
(
QPlaceContent
::
ReviewType
,
parent
)
125
{}
126
};
127
128
class
QDeclarativePlaceEditorialModel
:
public
QDeclarativePlaceContentModel
129
{
130
Q_GADGET
131
QML_NAMED_ELEMENT(EditorialModel)
132
QML_ADDED_IN_VERSION
(5, 0)
133
public
:
134
explicit
QDeclarativePlaceEditorialModel
(
QObject
*
parent
=
nullptr
)
135
:
QDeclarativePlaceContentModel
(
QPlaceContent
::
EditorialType
,
parent
)
136
{}
137
};
138
139
class
QDeclarativePlaceImageModel
:
public
QDeclarativePlaceContentModel
140
{
141
Q_GADGET
142
QML_NAMED_ELEMENT(ImageModel)
143
QML_ADDED_IN_VERSION
(5, 0)
144
public
:
145
explicit
QDeclarativePlaceImageModel
(
QObject
*
parent
=
nullptr
)
146
:
QDeclarativePlaceContentModel
(
QPlaceContent
::
ImageType
,
parent
)
147
{}
148
};
149
150
QT_END_NAMESPACE
151
152
#
endif
// QDECLARATIVEPLACECONTENTMODEL_H
QDeclarativePlaceContentModel
Definition
qdeclarativeplacecontentmodel_p.h:36
QDeclarativePlaceEditorialModel
Definition
qdeclarativeplacecontentmodel_p.h:129
QDeclarativePlaceImageModel
Definition
qdeclarativeplacecontentmodel_p.h:140
QDeclarativePlaceReviewModel
Definition
qdeclarativeplacecontentmodel_p.h:117
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtlocation
src
location
declarativeplaces
qdeclarativeplacecontentmodel_p.h
Generated on
for Qt by
1.18.0