27 , mPyFunctionName( function )
28 , mPyFormVarName( pyFormName )
30 static int sLayerCounter = 0;
31 mPyLayerVarName = QStringLiteral(
"_qgis_layer_%1_%2" ).arg( form->
layer()->
id() ).arg( sLayerCounter++ );
32 mPyLayerVarName.replace( QRegExp(
"[^a-zA-Z0-9_]" ), QStringLiteral(
"_" ) );
34 QString initLayer = QStringLiteral(
"%1 = sip.wrapinstance( %2, qgis.core.QgsVectorLayer )" )
35 .arg( mPyLayerVarName )
36 .arg( ( quint64 ) form->
layer() );
43 QString delLayer = QStringLiteral(
"del %1" ).arg( mPyLayerVarName );
49 QDialogButtonBox *buttonBox =
form()->findChild<QDialogButtonBox *>();
54 QObject::disconnect( buttonBox, SIGNAL( accepted() ),
form(), SLOT( accept() ) );
55 QObject::connect( buttonBox, SIGNAL( accepted() ),
form(), SLOT( accept() ) );
60 QDateTime dt = QDateTime::currentDateTime();
61 QString pyFeatureVarName = QStringLiteral(
"_qgis_feature_%1" ).arg( dt.toString( QStringLiteral(
"yyyyMMddhhmmsszzz" ) ) );
62 QString initFeature = QStringLiteral(
"%1 = sip.wrapinstance( %2, qgis.core.QgsFeature )" )
63 .arg( pyFeatureVarName )
68 QString expr = QStringLiteral(
"%1( %2, %3, %4)" )
69 .arg( mPyFunctionName,
76 QString delFeature = QStringLiteral(
"del %1" ).arg( pyFeatureVarName );
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
static bool run(const QString &command, const QString &messageOnError=QString())
Execute a Python statement.