QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
locator
qgslocatormodelbridge.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgslocatormodelbridge.h
3
------------------
4
begin : November 2018
5
copyright : (C) 2018 by Denis Rouzaud
6
email : denis@opengis.ch
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSLOCATORMODELBRIDGE_H
19
#define QGSLOCATORMODELBRIDGE_H
20
21
#include "qgis_core.h"
22
#include "
qgscoordinatereferencesystem.h
"
23
#include "
qgscoordinatetransformcontext.h
"
24
#include "
qgsrectangle.h
"
25
26
#include <QObject>
27
28
class
QItemSelection;
29
30
class
QgsLocatorResult
;
31
class
QgsLocator
;
32
class
QgsLocatorContext
;
33
class
QgsLocatorModel
;
34
class
QgsLocatorProxyModel
;
35
36
42
class
CORE_EXPORT
QgsLocatorModelBridge
:
public
QObject
43
{
44
Q_OBJECT
45
Q_PROPERTY(
bool
isRunning
READ
isRunning
NOTIFY
isRunningChanged
)
46
public
:
48
explicit
QgsLocatorModelBridge
( QObject *parent =
nullptr
);
49
~QgsLocatorModelBridge
()
override
=
default
;
50
52
Q_INVOKABLE
void
performSearch
(
const
QString &text );
53
55
QgsLocator
*
locator
()
const
;
56
58
Q_INVOKABLE
QgsLocatorProxyModel
*
proxyModel
()
const
;
59
61
bool
hasQueueRequested
()
const
;
62
64
bool
isRunning
()
const
;
65
67
void
triggerResult
(
const
QModelIndex &index,
const
int
actionId = -1 );
68
76
QgsCoordinateTransformContext
transformContext
()
const
{
return
mTransformContext; }
77
85
void
setTransformContext
(
const
QgsCoordinateTransformContext
&context ) { mTransformContext = context; }
86
87
signals:
89
void
resultAdded
();
90
92
void
isRunningChanged
();
93
95
void
resultsCleared
();
96
97
public
slots:
99
void
invalidateResults
();
100
102
void
updateCanvasExtent
(
const
QgsRectangle
&extent );
103
105
void
updateCanvasCrs
(
const
QgsCoordinateReferenceSystem
&crs );
106
111
void
selectionChanged
(
const
QItemSelection &selected,
const
QItemSelection &deselected );
112
113
private
slots:
114
void
searchFinished();
115
void
addResult(
const
QgsLocatorResult
&result );
116
117
private
:
118
QgsLocatorContext
createContext();
119
void
setIsRunning(
bool
isRunning
);
120
121
QgsLocator
*mLocator =
nullptr
;
122
QgsLocatorModel
*mLocatorModel =
nullptr
;
123
QgsLocatorProxyModel
*mProxyModel =
nullptr
;
124
125
QString mNextRequestedString;
126
bool
mHasQueuedRequest =
false
;
127
bool
mIsRunning =
false
;
128
129
// keep track of map canvas extent and CRS
130
// if much if needed, it would be possible to add
131
// a QgsMapCanvasController in core to achieve this
132
// see discussion in https://github.com/qgis/QGIS/pull/8404
133
QgsRectangle
mCanvasExtent;
134
QgsCoordinateReferenceSystem
mCanvasCrs;
135
QgsCoordinateTransformContext
mTransformContext;
136
};
137
138
#endif
// QGSLOCATORMODELBRIDGE_H
QgsCoordinateReferenceSystem
Represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:216
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition
qgscoordinatetransformcontext.h:61
QgsLocatorContext
Encapsulates the properties relating to the context of a locator search.
Definition
qgslocatorcontext.h:32
QgsLocatorModelBridge::QgsLocatorModelBridge
QgsLocatorModelBridge(QObject *parent=nullptr)
Constructor of QgsLocatorModelBridge.
Definition
qgslocatormodelbridge.cpp:28
QgsLocatorModelBridge::proxyModel
Q_INVOKABLE QgsLocatorProxyModel * proxyModel() const
Returns the proxy model.
Definition
qgslocatormodelbridge.cpp:157
QgsLocatorModelBridge::isRunning
bool isRunning
Definition
qgslocatormodelbridge.h:45
QgsLocatorModelBridge::selectionChanged
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
This will call filters implementation of selection/deselection of results.
Definition
qgslocatormodelbridge.cpp:58
QgsLocatorModelBridge::~QgsLocatorModelBridge
~QgsLocatorModelBridge() override=default
QgsLocatorModelBridge::isRunningChanged
void isRunningChanged()
Emitted when the running status changes.
QgsLocatorModelBridge::resultAdded
void resultAdded()
Emitted when a result is added.
QgsLocatorModelBridge::triggerResult
void triggerResult(const QModelIndex &index, const int actionId=-1)
Triggers the result at given index and with optional actionId if an additional action was triggered.
Definition
qgslocatormodelbridge.cpp:45
QgsLocatorModelBridge::setTransformContext
void setTransformContext(const QgsCoordinateTransformContext &context)
Sets the coordinate transform context, which should be used whenever the locator constructs a coordin...
Definition
qgslocatormodelbridge.h:85
QgsLocatorModelBridge::transformContext
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which should be used whenever the locator constructs a coor...
Definition
qgslocatormodelbridge.h:76
QgsLocatorModelBridge::locator
QgsLocator * locator() const
Returns the locator.
Definition
qgslocatormodelbridge.cpp:152
QgsLocatorModelBridge::hasQueueRequested
bool hasQueueRequested() const
Returns true if some text to be search is pending in the queue.
Definition
qgslocatormodelbridge.cpp:162
QgsLocatorModelBridge::performSearch
Q_INVOKABLE void performSearch(const QString &text)
Perform a search.
Definition
qgslocatormodelbridge.cpp:130
QgsLocatorModelBridge::resultsCleared
void resultsCleared()
Emitted when the results are cleared.
QgsLocatorModelBridge::updateCanvasCrs
void updateCanvasCrs(const QgsCoordinateReferenceSystem &crs)
Update the canvas CRS used to create search context.
Definition
qgslocatormodelbridge.cpp:101
QgsLocatorModelBridge::updateCanvasExtent
void updateCanvasExtent(const QgsRectangle &extent)
Update the canvas extent used to create search context.
Definition
qgslocatormodelbridge.cpp:96
QgsLocatorModelBridge::invalidateResults
void invalidateResults()
This will invalidate current search results.
Definition
qgslocatormodelbridge.cpp:90
QgsLocatorModel
An abstract list model for displaying the results of locator searches.
Definition
qgslocatormodel.h:43
QgsLocatorProxyModel
A sort proxy model for QgsLocatorModel, which automatically sorts results by precedence.
Definition
qgslocatormodel.h:210
QgsLocatorResult
Encapsulates properties of an individual matching result found by a QgsLocatorFilter.
Definition
qgslocatorfilter.h:41
QgsLocator
Handles the management of QgsLocatorFilter objects and async collection of search results from them.
Definition
qgslocator.h:65
QgsRectangle
A rectangle specified with double values.
Definition
qgsrectangle.h:47
qgscoordinatereferencesystem.h
qgscoordinatetransformcontext.h
qgsrectangle.h
Generated on
for QGIS API Documentation by
1.17.0