Marble

SearchBackend.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2015 Gábor Péterffy <peterffy95@gmail.com>
4//
5
6#ifndef MARBLE_SEARCHBACKEND_H
7#define MARBLE_SEARCHBACKEND_H
8
9#include <QObject>
10#include <QSortFilterProxyModel>
11
12#include "MarbleQuickItem.h"
13#include "MarblePlacemarkModel.h"
14#include "Placemark.h"
15
16class QCompleter;
17
18namespace Marble
19{
20class SearchRunnerManager;
21
22class SearchBackend : public QObject
23{
25
26 Q_PROPERTY(QObject *marbleQuickItem READ marbleQuickItem WRITE setMarbleQuickItem NOTIFY marbleQuickItemChanged)
27 Q_PROPERTY(MarblePlacemarkModel *completionModel READ completionModel NOTIFY completionModelChanged)
28 Q_PROPERTY(Placemark* selectedPlacemark READ selectedPlacemark NOTIFY selectedPlacemarkChanged)
29
30public:
31 explicit SearchBackend(QObject *parent = nullptr);
32 Q_INVOKABLE void search(const QString &place);
33 Q_INVOKABLE void setCompletionPrefix(const QString &prefix);
34 QObject *marbleQuickItem();
35 MarblePlacemarkModel *completionModel();
36 const QObject* marbleQuickItem() const;
37 Placemark* selectedPlacemark();
38
40 void marbleQuickItemChanged(QObject *marbleQuickItem);
41 void completionModelChanged(MarblePlacemarkModel *model);
42 void searchResultChanged(MarblePlacemarkModel *model);
43 void searchFinished(const QString &searchTerm);
44 void selectedPlacemarkChanged(Placemark * selectedPlacemark);
45
46public Q_SLOTS:
47 Q_INVOKABLE void setSelectedPlacemark(int placemarkIndex);
48 void setMarbleQuickItem(QObject *marbleQuickItem);
49 void updateSearchResult(QAbstractItemModel *result);
50
51private:
52 static GeoDataPlacemark *placemarkFromQVariant(const QVariant &data);
54 SearchRunnerManager *m_searchManager;
55 MarbleQuickItem *m_marbleQuickItem;
56 MarblePlacemarkModel *m_placemarkModel;
57 QCompleter *m_completer;
58 MarblePlacemarkModel *m_completionModel;
59 QVector<GeoDataPlacemark*> *m_completionContainer;
60 Placemark m_selectedPlacemark;
61 QString m_lastSuccessfulCompletion;
62};
63
64}
65#endif
Binds a QML item to a specific geodetic location in screen coordinates.
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:06 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.