19#include "moc_qgsvirtuallayertask.cpp"
24 : mDefinition( definition )
28 mLayer = std::make_unique<QgsVectorLayer>( mDefinition.
toString(), QStringLiteral(
"layer" ), QLatin1String(
"virtual" ), options );
37 rc = mLayer->isValid();
39 catch ( std::exception &e )
41 QgsDebugError( QStringLiteral(
"Reload error: %1" ).arg( e.what() ) );
60 return mLayer.release();
65 mLayer->dataProvider()->cancelReload();
71 return mExceptionText;
Contains information about the context in which a coordinate transform is executed.
virtual void cancel()
Notifies the task that it should terminate.
Represents a vector layer which manages a vector based data sets.
Class to manipulate the definition of a virtual layer.
void setLazy(bool lazy)
Sets the lazy mode.
QString toString() const
Convert into a QString that can be read by the virtual layer provider.
QgsVectorLayer * takeLayer()
Returns the underlying virtual layer and ownership.
QString exceptionText() const
Returns the exception text or an empty string if no exceptions were raised.
void cancel() override
Cancels the pending query and the parent task.
bool run() override
Reloads the data.
QgsVectorLayer * layer()
Returns the underlying virtual layer.
QgsVirtualLayerDefinition definition() const
Returns the virtual layer definition.
QgsVirtualLayerTask(const QgsVirtualLayerDefinition &definition)
Constructor.
void setExceptionText(const QString &exceptionText)
Sets the exceptionText.
#define QgsDebugError(str)
Setting options for loading vector layers.