18#ifndef QGSLOCATORMODEL_H
19#define QGSLOCATORMODEL_H
24#include <QAbstractListModel>
26#include <QSortFilterProxyModel>
68 ResultFilterGroupTitle,
69 ResultFilterGroupScore,
94 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
95 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
96 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
97 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
98 QHash<int, QByteArray> roleNames()
const override;
117 enum class EntryType :
int
126 EntryType type = EntryType::Result;
127 QgsLocatorResult result;
129 QgsLocatorFilter *filter =
nullptr;
130 QString groupTitle = QString();
131 double groupScore = UnorderedGroup;
134 QList<Entry> mResults;
135 QSet<QString> mFoundResultsFromFilterNames;
137 QMap<QgsLocatorFilter *, QList<std::pair<QString, double>>> mFoundResultsFilterGroups;
138 bool mDeferredClear =
false;
139 QTimer mDeferredClearTimer;
186 void search(
const QString &
string );
197 void searchFinished();
203 QString mNextRequestedString;
204 bool mHasQueuedRequest =
false;
223 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)