Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 30cf2d3
Show file tree
Hide file tree
Showing 12 changed files with 530 additions and 107 deletions.
2 changes: 2 additions & 0 deletions python/core/auto_generated/locator/qgslocatormodel.sip.in
Expand Up @@ -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 Qt::ItemFlags flags( const QModelIndex &index ) const;


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



public slots: public slots:


Expand Down
104 changes: 104 additions & 0 deletions python/core/auto_generated/locator/qgslocatormodelbridge.sip.in
@@ -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 *
************************************************************************/
98 changes: 98 additions & 0 deletions python/core/auto_generated/locator/qgslocatorwidgetcore.sip.in
@@ -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 *
************************************************************************/
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -382,6 +382,7 @@
%Include auto_generated/locator/qgslocator.sip %Include auto_generated/locator/qgslocator.sip
%Include auto_generated/locator/qgslocatorfilter.sip %Include auto_generated/locator/qgslocatorfilter.sip
%Include auto_generated/locator/qgslocatormodel.sip %Include auto_generated/locator/qgslocatormodel.sip
%Include auto_generated/locator/qgslocatormodelbridge.sip
%Include auto_generated/processing/qgsprocessingalgrunnertask.sip %Include auto_generated/processing/qgsprocessingalgrunnertask.sip
%Include auto_generated/processing/qgsprocessingfeedback.sip %Include auto_generated/processing/qgsprocessingfeedback.sip
%Include auto_generated/processing/qgsprocessingprovider.sip %Include auto_generated/processing/qgsprocessingprovider.sip
Expand Down
1 change: 0 additions & 1 deletion python/gui/auto_generated/locator/qgslocatorwidget.sip.in
Expand Up @@ -64,7 +64,6 @@ Emitted when the configure option is triggered in the widget.
%End %End


protected: protected:

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




Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -109,6 +109,7 @@ SET(QGIS_CORE_SRCS
locator/qgslocator.cpp locator/qgslocator.cpp
locator/qgslocatorfilter.cpp locator/qgslocatorfilter.cpp
locator/qgslocatormodel.cpp locator/qgslocatormodel.cpp
locator/qgslocatormodelbridge.cpp


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


processing/qgsprocessingalgrunnertask.h processing/qgsprocessingalgrunnertask.h
processing/qgsprocessingfeedback.h processing/qgsprocessingfeedback.h
Expand Down
13 changes: 13 additions & 0 deletions src/core/locator/qgslocatormodel.cpp
Expand Up @@ -179,6 +179,19 @@ Qt::ItemFlags QgsLocatorModel::flags( const QModelIndex &index ) const
return flags; 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 ) void QgsLocatorModel::addResult( const QgsLocatorResult &result )
{ {
mDeferredClearTimer.stop(); mDeferredClearTimer.stop();
Expand Down
1 change: 1 addition & 0 deletions src/core/locator/qgslocatormodel.h
Expand Up @@ -81,6 +81,7 @@ class CORE_EXPORT QgsLocatorModel : public QAbstractTableModel
int columnCount( const QModelIndex &parent = QModelIndex() ) const override; int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override; QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
Qt::ItemFlags flags( const QModelIndex &index ) const override; Qt::ItemFlags flags( const QModelIndex &index ) const override;
QHash<int, QByteArray> roleNames() const override;


public slots: public slots:


Expand Down

0 comments on commit 30cf2d3

Please sign in to comment.