18#ifndef QGSLOCATORMODEL_H
19#define QGSLOCATORMODEL_H
24#include <QAbstractListModel>
26#include <QSortFilterProxyModel>
67 ResultFilterGroupTitle,
68 ResultFilterGroupScore,
93 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
94 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
95 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
96 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
97 QHash<int, QByteArray> roleNames()
const override;
115 enum class EntryType :
int
124 EntryType type = EntryType::Result;
125 QgsLocatorResult result;
127 QgsLocatorFilter *filter =
nullptr;
128 QString groupTitle = QString();
129 double groupScore = UnorderedGroup;
132 QList<Entry> mResults;
133 QSet<QString> mFoundResultsFromFilterNames;
135 QMap<QgsLocatorFilter *, QList<std::pair<QString, double>>> mFoundResultsFilterGroups;
136 bool mDeferredClear =
false;
137 QTimer mDeferredClearTimer;
183 void search(
const QString &
string );
194 void searchFinished();
199 QString mNextRequestedString;
200 bool mHasQueuedRequest =
false;
218 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
QgsLocator * locator()
Returns a pointer to the locator utilized by this model.
QgsLocatorAutomaticModel(QgsLocator *locator)
Constructor for QgsLocatorAutomaticModel, linked with the specified locator.
void search(const QString &string)
Enqueues a search for a specified string within the model.
virtual QgsLocatorContext createContext()
Returns a new locator context for searches.
Encapsulates the properties relating to the context of a locator search.
An abstract list model for displaying the results of locator searches.
CustomRole
Custom model roles.
QgsLocatorModel(QObject *parent=nullptr)
Constructor for QgsLocatorModel.
static const int UnorderedGroup
A sort proxy model for QgsLocatorModel, which automatically sorts results by precedence.
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
QgsLocatorProxyModel(QObject *parent=nullptr)
Constructor for QgsLocatorProxyModel, with the specified parent object.
Encapsulates properties of an individual matching result found by a QgsLocatorFilter.
Handles the management of QgsLocatorFilter objects and async collection of search results from them.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)