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