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
qdeclarativesearchsuggestionmodel_p.h
Go to the documentation of this file.
1// Copyright (C) 2015 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 QDECLARATIVESEARCHSUGGESTIONMODEL_P_H
5#define QDECLARATIVESEARCHSUGGESTIONMODEL_P_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 <QtLocation/private/qdeclarativesearchmodelbase_p.h>
20
21#include <QtCore/QStringList>
22
23QT_BEGIN_NAMESPACE
24
25class QDeclarativeGeoServiceProvider;
26class QGeoServiceProvider;
27
28class Q_LOCATION_EXPORT QDeclarativeSearchSuggestionModel : public QDeclarativeSearchModelBase
29{
30 Q_OBJECT
31 QML_NAMED_ELEMENT(PlaceSearchSuggestionModel)
32 QML_ADDED_IN_VERSION(5, 0)
33
34 Q_PROPERTY(QString searchTerm READ searchTerm WRITE setSearchTerm NOTIFY searchTermChanged)
35 Q_PROPERTY(QStringList suggestions READ suggestions NOTIFY suggestionsChanged)
36
37public:
38 explicit QDeclarativeSearchSuggestionModel(QObject *parent = nullptr);
39 ~QDeclarativeSearchSuggestionModel();
40
41 QString searchTerm() const;
42 void setSearchTerm(const QString &searchTerm);
43
44 QStringList suggestions() const;
45
46 void clearData(bool suppressSignal = false) override;
47
48 // From QAbstractListModel
49 int rowCount(const QModelIndex &parent) const override;
50 QVariant data(const QModelIndex &index, int role) const override;
51 QHash<int, QByteArray> roleNames() const override;
52
53 enum Roles {
54 SearchSuggestionRole = Qt::UserRole
55 };
56
57protected Q_SLOTS:
58 void queryFinished() override;
59
60Q_SIGNALS:
61 void searchTermChanged();
62 void suggestionsChanged();
63
64protected:
65 QPlaceReply *sendQuery(QPlaceManager *manager, const QPlaceSearchRequest &request) override;
66
67private:
68 QStringList m_suggestions;
69};
70
71QT_END_NAMESPACE
72
73#endif