Skip to content

Commit

Permalink
rename QgsLocatorWidgetCore to QgsLocatorModelBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 6, 2018
1 parent c1bfd64 commit 107e646
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 59 deletions.
98 changes: 98 additions & 0 deletions python/core/auto_generated/locator/qgslocatormodelbridge.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 *
************************************************************************/
14 changes: 7 additions & 7 deletions python/core/auto_generated/locator/qgslocatorwidgetcore.sip.in
@@ -1,7 +1,7 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/locator/qgslocatorwidgetcore.h *
* src/core/locator/qgslocatormodelbridge.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
Expand All @@ -12,22 +12,22 @@



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

.. versionadded:: 3.6
%End

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

void performSearch( const QString &text );
Expand Down Expand Up @@ -92,7 +92,7 @@ Update the canvas CRS used to create search context
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/locator/qgslocatorwidgetcore.h *
* src/core/locator/qgslocatormodelbridge.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2 changes: 1 addition & 1 deletion python/core/core_auto.sip
Expand Up @@ -382,7 +382,7 @@
%Include auto_generated/locator/qgslocator.sip
%Include auto_generated/locator/qgslocatorfilter.sip
%Include auto_generated/locator/qgslocatormodel.sip
%Include auto_generated/locator/qgslocatorwidgetcore.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
Expand Down
4 changes: 2 additions & 2 deletions src/core/CMakeLists.txt
Expand Up @@ -109,7 +109,7 @@ SET(QGIS_CORE_SRCS
locator/qgslocator.cpp
locator/qgslocatorfilter.cpp
locator/qgslocatormodel.cpp
locator/qgslocatorwidgetcore.cpp
locator/qgslocatormodelbridge.cpp

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

processing/qgsprocessingalgrunnertask.h
processing/qgsprocessingfeedback.h
Expand Down
@@ -1,5 +1,5 @@
/***************************************************************************
qgslocatorwidgetcore.cpp
qgslocatormodelbridge.cpp
------------------
begin : November 2018
copyright : (C) 2018 by Denis Rouzaud
Expand All @@ -15,29 +15,29 @@
* *
***************************************************************************/

#include "qgslocatorwidgetcore.h"
#include "qgslocatormodelbridge.h"
#include "qgslocator.h"
#include "qgslocatormodel.h"
#include "qgsmapsettings.h"

QgsLocatorWidgetCore::QgsLocatorWidgetCore( QObject *parent )
QgsLocatorModelBridge::QgsLocatorModelBridge( QObject *parent )
: QObject( parent )
, mLocator( new QgsLocator( this ) )
, mLocatorModel( new QgsLocatorModel( this ) )
{
mProxyModel = new QgsLocatorProxyModel( mLocatorModel );
mProxyModel->setSourceModel( mLocatorModel );

connect( mLocator, &QgsLocator::foundResult, this, &QgsLocatorWidgetCore::addResult );
connect( mLocator, &QgsLocator::finished, this, &QgsLocatorWidgetCore::searchFinished );
connect( mLocator, &QgsLocator::foundResult, this, &QgsLocatorModelBridge::addResult );
connect( mLocator, &QgsLocator::finished, this, &QgsLocatorModelBridge::searchFinished );
}

bool QgsLocatorWidgetCore::isRunning() const
bool QgsLocatorModelBridge::isRunning() const
{
return mIsRunning;
}

void QgsLocatorWidgetCore::setIsRunning( bool isRunning )
void QgsLocatorModelBridge::setIsRunning( bool isRunning )
{
if ( mIsRunning == isRunning )
return;
Expand All @@ -46,30 +46,30 @@ void QgsLocatorWidgetCore::setIsRunning( bool isRunning )
emit isRunningChanged();
}

void QgsLocatorWidgetCore::invalidateResults()
void QgsLocatorModelBridge::invalidateResults()
{
mLocator->cancelWithoutBlocking();
mLocatorModel->clear();
}

void QgsLocatorWidgetCore::updateCanvasExtent( const QgsRectangle &extent )
void QgsLocatorModelBridge::updateCanvasExtent( const QgsRectangle &extent )
{
mCanvasExtent = extent;
}

void QgsLocatorWidgetCore::updateCanvasCrs( const QgsCoordinateReferenceSystem &crs )
void QgsLocatorModelBridge::updateCanvasCrs( const QgsCoordinateReferenceSystem &crs )
{
mCanvasCrs = crs;
}

void QgsLocatorWidgetCore::addResult( const QgsLocatorResult &result )
void QgsLocatorModelBridge::addResult( const QgsLocatorResult &result )
{
mLocatorModel->addResult( result );
emit resultAdded();
}


void QgsLocatorWidgetCore::searchFinished()
void QgsLocatorModelBridge::searchFinished()
{
if ( mHasQueuedRequest )
{
Expand All @@ -86,7 +86,7 @@ void QgsLocatorWidgetCore::searchFinished()
}
}

void QgsLocatorWidgetCore::performSearch( const QString &text )
void QgsLocatorModelBridge::performSearch( const QString &text )
{
setIsRunning( true );
if ( mLocator->isRunning() )
Expand All @@ -107,22 +107,22 @@ void QgsLocatorWidgetCore::performSearch( const QString &text )
}
}

QgsLocator *QgsLocatorWidgetCore::locator() const
QgsLocator *QgsLocatorModelBridge::locator() const
{
return mLocator;
}

QgsLocatorProxyModel *QgsLocatorWidgetCore::proxyModel() const
QgsLocatorProxyModel *QgsLocatorModelBridge::proxyModel() const
{
return mProxyModel;
}

bool QgsLocatorWidgetCore::hasQueueRequested() const
bool QgsLocatorModelBridge::hasQueueRequested() const
{
return mHasQueuedRequest;
}

QgsLocatorContext QgsLocatorWidgetCore::createContext()
QgsLocatorContext QgsLocatorModelBridge::createContext()
{
QgsLocatorContext context;
context.targetExtent = mCanvasExtent;
Expand Down
@@ -1,5 +1,5 @@
/***************************************************************************
qgslocatorwidgetcore.h
qgslocatormodelbridge.h
------------------
begin : November 2018
copyright : (C) 2018 by Denis Rouzaud
Expand All @@ -15,8 +15,8 @@
* *
***************************************************************************/

#ifndef QGSLOCATORWIDGETCORE_H
#define QGSLOCATORWIDGETCORE_H
#ifndef QGSLOCATORMODELBRIDGE_H
#define QGSLOCATORMODELBRIDGE_H

#include <QObject>

Expand All @@ -33,17 +33,17 @@ class QgsLocatorProxyModel;

/**
* \ingroup core
* The QgsLocatorWidgetCore class provides the core functionality
* The QgsLocatorModelBridge class provides the core functionality
* to be used in a locator widget.
* \since QGIS 3.6
*/
class CORE_EXPORT QgsLocatorWidgetCore : public QObject
class CORE_EXPORT QgsLocatorModelBridge : public QObject
{
Q_OBJECT
Q_PROPERTY( bool isRunning READ isRunning NOTIFY isRunningChanged )
public:
//! Constructor of QgsLocatorWidgetCore
explicit QgsLocatorWidgetCore( QObject *parent = nullptr );
//! Constructor of QgsLocatorModelBridge
explicit QgsLocatorModelBridge( QObject *parent = nullptr );

//! Perform a search
Q_INVOKABLE void performSearch( const QString &text );
Expand Down Expand Up @@ -104,4 +104,4 @@ class CORE_EXPORT QgsLocatorWidgetCore : public QObject
QgsCoordinateReferenceSystem mCanvasCrs;
};

#endif // QGSLOCATORWIDGETCORE_H
#endif // QGSLOCATORMODELBRIDGE_H

0 comments on commit 107e646

Please sign in to comment.