Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
add logMessage method to locator filter (#7222)
to discourage from using Python print()
- Loading branch information
|
@@ -241,6 +241,19 @@ custom configuration widget. |
|
|
hasConfigWidget() must return true to indicate that the filter supports configuration. |
|
|
%End |
|
|
|
|
|
void logMessage( const QString &message, Qgis::MessageLevel level = Qgis::Info ); |
|
|
%Docstring |
|
|
Logs a ``message`` to the log panel |
|
|
|
|
|
.. warning:: |
|
|
|
|
|
in Python, do not use print() method as it might result in crashes |
|
|
since fetching results does not happen in the main thread. |
|
|
|
|
|
.. versionadded:: 3.2 |
|
|
%End |
|
|
|
|
|
|
|
|
signals: |
|
|
|
|
|
void finished(); |
|
|
|
@@ -20,6 +20,7 @@ |
|
|
#include "qgslocatorfilter.h" |
|
|
#include "qgsstringutils.h" |
|
|
#include "qgsfeedback.h" |
|
|
#include "qgsmessagelog.h" |
|
|
|
|
|
|
|
|
QgsLocatorFilter::QgsLocatorFilter( QObject *parent ) |
|
@@ -80,3 +81,8 @@ void QgsLocatorFilter::setActivePrefix( const QString &activePrefix ) |
|
|
mActivePrefifx = activePrefix; |
|
|
} |
|
|
|
|
|
void QgsLocatorFilter::logMessage( const QString &message, Qgis::MessageLevel level ) |
|
|
{ |
|
|
QgsMessageLog::logMessage( QString( "%1: %2" ).arg( name(), message ), QStringLiteral( "Locator bar" ), level ); |
|
|
} |
|
|
|
|
@@ -271,6 +271,15 @@ class CORE_EXPORT QgsLocatorFilter : public QObject |
|
|
*/ |
|
|
virtual void openConfigWidget( QWidget *parent = nullptr ); |
|
|
|
|
|
/** |
|
|
* Logs a \a message to the log panel |
|
|
* \warning in Python, do not use print() method as it might result in crashes |
|
|
* since fetching results does not happen in the main thread. |
|
|
* \since QGIS 3.2 |
|
|
*/ |
|
|
void logMessage( const QString &message, Qgis::MessageLevel level = Qgis::Info ); |
|
|
|
|
|
|
|
|
signals: |
|
|
|
|
|
/** |
|
|