Skip to content
Permalink
Browse files

Merge pull request #8404 from 3nids/locator_core

Move parts of QgsLocatorFilter to core
  • Loading branch information
3nids committed Nov 9, 2018
2 parents 9e78b82 + fe6f99a commit 30cf2d37bc6b66a75e4313dc2752cb5e0de3e3c8
@@ -67,6 +67,8 @@ which may occur if the model is being updated quickly multiple times as a result

virtual Qt::ItemFlags flags( const QModelIndex &index ) const;

virtual QHash<int, QByteArray> roleNames() const;


public slots:

@@ -0,0 +1,104 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/locator/qgslocatormodelbridge.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/







class QgsLocatorModelBridge : QObject
{
%Docstring
The QgsLocatorModelBridge class provides the core functionality
to be used in a locator widget.

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgslocatormodelbridge.h"
%End
public:
explicit QgsLocatorModelBridge( QObject *parent = 0 );
%Docstring
Constructor of QgsLocatorModelBridge
%End
virtual ~QgsLocatorModelBridge();

void performSearch( const QString &text );
%Docstring
Perform a search
%End

QgsLocator *locator() const;
%Docstring
Returns the locator
%End

QgsLocatorProxyModel *proxyModel() const;
%Docstring
Returns the proxy model
%End

bool hasQueueRequested() const;
%Docstring
Returns true if some text to be search is pending in the queue
%End

bool isRunning() const;
%Docstring
Returns true if the a search is currently running
%End

void triggerResult( const QModelIndex &index );
%Docstring
Triggers the result at given index
%End

signals:
void resultAdded();
%Docstring
Emitted when a result is added
%End

void isRunningChanged();
%Docstring
Emitted when the running status changes
%End

void resultsCleared();
%Docstring
Emitted when the results are cleared
%End

public slots:
void invalidateResults();
%Docstring
This will invalidate current search results
%End

void updateCanvasExtent( const QgsRectangle &extent );
%Docstring
Update the canvas extent used to create search context
%End

void updateCanvasCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
Update the canvas CRS used to create search context
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/locator/qgslocatormodelbridge.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,98 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/locator/qgslocatormodelbridge.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/







class QgsLocatorModelBridge : QObject
{
%Docstring
The QgsLocatorModelBridge class provides the core functionality
to be used in a locator widget.

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgslocatormodelbridge.h"
%End
public:
explicit QgsLocatorModelBridge( QObject *parent = 0 );
%Docstring
Constructor of QgsLocatorModelBridge
%End

void performSearch( const QString &text );
%Docstring
Perform a search
%End

QgsLocator *locator() const;
%Docstring
Returns the locator
%End

QgsLocatorProxyModel *proxyModel() const;
%Docstring
Returns the proxy model
%End

bool hasQueueRequested() const;
%Docstring
Returns true if some text to be search is pending in the queue
%End

bool isRunning() const;
%Docstring
Returns true if the a search is currently running
%End

signals:
void resultAdded();
%Docstring
Emitted when a result is added
%End

void isRunningChanged();
%Docstring
Emitted when the running status changes
%End

void resultsCleared();
%Docstring
Emitted when the results are cleared
%End

public slots:
void invalidateResults();
%Docstring
This will invalidate current search results
%End

void updateCanvasExtent( const QgsRectangle &extent );
%Docstring
Update the canvas extent used to create search context
%End

void updateCanvasCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
Update the canvas CRS used to create search context
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/locator/qgslocatormodelbridge.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -382,6 +382,7 @@
%Include auto_generated/locator/qgslocator.sip
%Include auto_generated/locator/qgslocatorfilter.sip
%Include auto_generated/locator/qgslocatormodel.sip
%Include auto_generated/locator/qgslocatormodelbridge.sip
%Include auto_generated/processing/qgsprocessingalgrunnertask.sip
%Include auto_generated/processing/qgsprocessingfeedback.sip
%Include auto_generated/processing/qgsprocessingprovider.sip
@@ -64,7 +64,6 @@ Emitted when the configure option is triggered in the widget.
%End

protected:

virtual bool eventFilter( QObject *obj, QEvent *event );


@@ -109,6 +109,7 @@ SET(QGIS_CORE_SRCS
locator/qgslocator.cpp
locator/qgslocatorfilter.cpp
locator/qgslocatormodel.cpp
locator/qgslocatormodelbridge.cpp

processing/qgsprocessingalgorithm.cpp
processing/qgsprocessingalgrunnertask.cpp
@@ -681,6 +682,7 @@ SET(QGIS_CORE_MOC_HDRS
locator/qgslocator.h
locator/qgslocatorfilter.h
locator/qgslocatormodel.h
locator/qgslocatormodelbridge.h

processing/qgsprocessingalgrunnertask.h
processing/qgsprocessingfeedback.h
@@ -179,6 +179,19 @@ Qt::ItemFlags QgsLocatorModel::flags( const QModelIndex &index ) const
return flags;
}

QHash<int, QByteArray> QgsLocatorModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[ResultDataRole] = "ResultData";
roles[ResultTypeRole] = "ResultType";
roles[ResultFilterPriorityRole] = "ResultFilterPriority";
roles[ResultScoreRole] = "ResultScore";
roles[ResultFilterNameRole] = "ResultFilterName";
roles[ResultFilterGroupSortingRole] = "ResultFilterGroupSorting";
roles[Qt::DisplayRole] = "Text";
return roles;
}

void QgsLocatorModel::addResult( const QgsLocatorResult &result )
{
mDeferredClearTimer.stop();
@@ -81,6 +81,7 @@ class CORE_EXPORT QgsLocatorModel : public QAbstractTableModel
int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
Qt::ItemFlags flags( const QModelIndex &index ) const override;
QHash<int, QByteArray> roleNames() const override;

public slots:

0 comments on commit 30cf2d3

Please sign in to comment.
You can’t perform that action at this time.