QGIS API Documentation
3.39.0-Master (bca3cdb6021)
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 :
[email protected]
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 <QObject>
22
23
#include "qgis_core.h"
24
#include "
qgscoordinatereferencesystem.h
"
25
#include "
qgscoordinatetransformcontext.h
"
26
#include "
qgsrectangle.h
"
27
28
class
QItemSelection;
29
30
class
QgsLocatorResult
;
31
class
QgsLocator
;
32
class
QgsLocatorContext
;
33
class
QgsLocatorModel
;
34
class
QgsLocatorProxyModel
;
35
36
43
class
CORE_EXPORT
QgsLocatorModelBridge
:
public
QObject
44
{
45
Q_OBJECT
46
Q_PROPERTY(
bool
isRunning READ isRunning NOTIFY isRunningChanged )
47
public
:
49
explicit
QgsLocatorModelBridge
( QObject *parent =
nullptr
);
50
virtual
~QgsLocatorModelBridge
() =
default
;
51
53
Q_INVOKABLE
void
performSearch(
const
QString &text );
54
56
QgsLocator
*locator()
const
;
57
59
Q_INVOKABLE
QgsLocatorProxyModel
*proxyModel()
const
;
60
62
bool
hasQueueRequested()
const
;
63
65
bool
isRunning()
const
;
66
68
void
triggerResult(
const
QModelIndex &index,
const
int
actionId = -1 );
69
77
QgsCoordinateTransformContext
transformContext
()
const
{
return
mTransformContext; }
78
86
void
setTransformContext
(
const
QgsCoordinateTransformContext
&context ) { mTransformContext = context; }
87
88
signals:
90
void
resultAdded
();
91
93
void
isRunningChanged
();
94
96
void
resultsCleared
();
97
98
public
slots:
100
void
invalidateResults();
101
103
void
updateCanvasExtent(
const
QgsRectangle
&extent );
104
106
void
updateCanvasCrs(
const
QgsCoordinateReferenceSystem
&
crs
);
107
112
void
selectionChanged(
const
QItemSelection &selected,
const
QItemSelection &deselected );
113
114
private
slots:
115
void
searchFinished();
116
void
addResult(
const
QgsLocatorResult
&result );
117
118
private
:
119
QgsLocatorContext
createContext();
120
void
setIsRunning(
bool
isRunning );
121
122
QgsLocator
*mLocator =
nullptr
;
123
QgsLocatorModel
*mLocatorModel =
nullptr
;
124
QgsLocatorProxyModel
*mProxyModel =
nullptr
;
125
126
QString mNextRequestedString;
127
bool
mHasQueuedRequest =
false
;
128
bool
mIsRunning =
false
;
129
130
// keep track of map canvas extent and CRS
131
// if much if needed, it would be possible to add
132
// a QgsMapCanvasController in core to achieve this
133
// see discussion in https://github.com/qgis/QGIS/pull/8404
134
QgsRectangle
mCanvasExtent;
135
QgsCoordinateReferenceSystem
mCanvasCrs;
136
QgsCoordinateTransformContext
mTransformContext;
137
};
138
139
#endif
// QGSLOCATORMODELBRIDGE_H
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:212
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition
qgscoordinatetransformcontext.h:57
QgsLocatorContext
Encapsulates the properties relating to the context of a locator search.
Definition
qgslocatorcontext.h:32
QgsLocatorModelBridge
The QgsLocatorModelBridge class provides the core functionality to be used in a locator widget.
Definition
qgslocatormodelbridge.h:44
QgsLocatorModelBridge::isRunningChanged
void isRunningChanged()
Emitted when the running status changes.
QgsLocatorModelBridge::resultAdded
void resultAdded()
Emitted when a result is added.
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:86
QgsLocatorModelBridge::transformContext
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which should be used whenever the locator constructs a coor...
Definition
qgslocatormodelbridge.h:77
QgsLocatorModelBridge::resultsCleared
void resultsCleared()
Emitted when the results are cleared.
QgsLocatorModelBridge::~QgsLocatorModelBridge
virtual ~QgsLocatorModelBridge()=default
QgsLocatorModel
An abstract list model for displaying the results of locator searches.
Definition
qgslocatormodel.h:42
QgsLocatorProxyModel
A sort proxy model for QgsLocatorModel, which automatically sorts results by precedence.
Definition
qgslocatormodel.h:213
QgsLocatorResult
Encapsulates properties of an individual matching result found by a QgsLocatorFilter.
Definition
qgslocatorfilter.h:38
QgsLocator
Handles the management of QgsLocatorFilter objects and async collection of search results from them.
Definition
qgslocator.h:61
QgsRectangle
A rectangle specified with double values.
Definition
qgsrectangle.h:42
qgscoordinatereferencesystem.h
qgscoordinatetransformcontext.h
qgsrectangle.h
crs
const QgsCoordinateReferenceSystem & crs
Definition
qgswfsgetfeature.cpp:53
Generated on Wed Oct 9 2024 13:41:01 for QGIS API Documentation by
1.9.8