Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qplacesearchreply.cpp
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#include <QtLocation/QPlaceSearchRequest>
5#include <QtLocation/QPlaceSearchReply>
6#include <QtLocation/QPlaceProposedSearchResult>
7#include <QtLocation/private/qplacereply_p.h>
8
9QT_BEGIN_NAMESPACE
10
11class QPlaceSearchReplyPrivate : public QPlaceReplyPrivate
12{
13public:
14 QList<QPlaceSearchResult> results;
15 QPlaceSearchRequest searchRequest;
16 QPlaceSearchRequest previousPageRequest;
17 QPlaceSearchRequest nextPageRequest;
18};
19
20/*!
21 \class QPlaceSearchReply
22 \inmodule QtLocation
23 \ingroup QtLocation-places
24 \ingroup QtLocation-places-replies
25 \since 5.6
26
27 \brief The QPlaceSearchReply class manages a place search operation started by an
28 instance of QPlaceManager.
29
30 See \l {Discovery/Search} for an example on how to use a search reply.
31 \sa QPlaceSearchRequest, QPlaceManager
32*/
33
34/*!
35 Constructs a search reply with a given \a parent.
36*/
37QPlaceSearchReply::QPlaceSearchReply(QObject *parent)
38 : QPlaceReply(new QPlaceSearchReplyPrivate, parent)
39{
40}
41
42/*!
43 Destroys the search reply.
44*/
45QPlaceSearchReply::~QPlaceSearchReply()
46{
47}
48
49/*!
50 Returns the type of reply.
51*/
52QPlaceReply::Type QPlaceSearchReply::type() const
53{
54 return QPlaceReply::SearchReply;
55}
56
57 /*!
58 Returns a list of search results;
59*/
60QList<QPlaceSearchResult> QPlaceSearchReply::results() const
61{
62 Q_D(const QPlaceSearchReply);
63 return d->results;
64}
65
66/*!
67 Sets the list of search \a results.
68*/
69void QPlaceSearchReply::setResults(const QList<QPlaceSearchResult> &results)
70{
71 Q_D(QPlaceSearchReply);
72 d->results = results;
73}
74
75/*!
76 Returns the search request that was used to generate this reply.
77*/
78QPlaceSearchRequest QPlaceSearchReply::request() const
79{
80 Q_D(const QPlaceSearchReply);
81 return d->searchRequest;
82}
83
84/*!
85 Returns a place search request which can be used to request the previous page of search
86 results. An empty place search request is returned if there is no previous page of results.
87
88 \sa nextPageRequest(), setPreviousPageRequest()
89*/
90QPlaceSearchRequest QPlaceSearchReply::previousPageRequest() const
91{
92 Q_D(const QPlaceSearchReply);
93 return d->previousPageRequest;
94}
95
96/*!
97 Returns a place search request which can be used to request the next page of search results. An
98 empty place search request is returned if there is no next page of results.
99
100 \sa previousPageRequest(), setNextPageRequest()
101*/
102QPlaceSearchRequest QPlaceSearchReply::nextPageRequest() const
103{
104 Q_D(const QPlaceSearchReply);
105 return d->nextPageRequest;
106}
107
108/*!
109 Sets the search \a request used to generate this reply.
110*/
111void QPlaceSearchReply::setRequest(const QPlaceSearchRequest &request)
112{
113 Q_D(QPlaceSearchReply);
114 d->searchRequest = request;
115}
116
117/*!
118 Sets the previous page of search results request to \a previous.
119
120 \sa previousPageRequest()
121*/
122void QPlaceSearchReply::setPreviousPageRequest(const QPlaceSearchRequest &previous)
123{
124 Q_D(QPlaceSearchReply);
125 d->previousPageRequest = previous;
126}
127
128/*!
129 Sets the next page of search results request to \a next.
130
131 \sa nextPageRequest()
132*/
133void QPlaceSearchReply::setNextPageRequest(const QPlaceSearchRequest &next)
134{
135 Q_D(QPlaceSearchReply);
136 d->nextPageRequest = next;
137}
138
139QT_END_NAMESPACE