QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
Utility class for running Python commands from various parts of QGIS. More...
#include <qgspythonrunner.h>
Static Public Member Functions | |
static bool | eval (const QString &command, QString &result) |
Eval a Python statement. | |
static bool | isValid () |
Returns true if the runner has an instance (and thus is able to run commands) | |
static bool | run (const QString &command, const QString &messageOnError=QString()) |
Execute a Python statement. | |
static void | setInstance (QgsPythonRunner *runner) |
Assign an instance of Python runner so that run() can be used. | |
Protected Member Functions | |
QgsPythonRunner ()=default | |
Protected constructor: can be instantiated only from children. | |
virtual | ~QgsPythonRunner ()=default |
virtual bool | evalCommand (QString command, QString &result)=0 |
virtual bool | runCommand (QString command, QString messageOnError=QString())=0 |
Static Protected Attributes | |
static QgsPythonRunner * | sInstance = nullptr |
Utility class for running Python commands from various parts of QGIS.
There is no direct Python support in the core library, so it is expected that application with Python support creates a subclass that implements pure virtual function(s) during the initialization. The static methods will then work as expected.
Definition at line 32 of file qgspythonrunner.h.
|
protecteddefault |
Protected constructor: can be instantiated only from children.
|
protectedvirtualdefault |
|
static |
Eval a Python statement.
Definition at line 42 of file qgspythonrunner.cpp.
|
protectedpure virtual |
|
static |
Returns true
if the runner has an instance (and thus is able to run commands)
Definition at line 23 of file qgspythonrunner.cpp.
|
static |
Execute a Python statement.
Definition at line 28 of file qgspythonrunner.cpp.
|
protectedpure virtual |
|
static |
Assign an instance of Python runner so that run() can be used.
This method should be called during app initialization. Takes ownership of the object, deletes previous instance.
Definition at line 55 of file qgspythonrunner.cpp.
|
staticprotected |
Definition at line 64 of file qgspythonrunner.h.