Skip to content
Permalink
Browse files

pass QgsAttributeEditorContext from QgisApp

  • Loading branch information
signedav committed Jul 1, 2020
1 parent 059f9fa commit a360f537736a4863099236ec3a75c8997c3493a4
Showing with 14 additions and 9 deletions.
  1. +8 −1 src/app/qgisapp.cpp
  2. +4 −6 src/app/qgsfixattributedialog.cpp
  3. +2 −2 src/app/qgsfixattributedialog.h
@@ -10214,7 +10214,14 @@ void QgisApp::pasteFromClipboard( QgsMapLayer *destinationLayer )
{
newFeatures.clear();

QgsFixAttributeDialog *dialog = new QgsFixAttributeDialog( pasteVectorLayer, invalidFeatures, this );
QgsAttributeEditorContext context( createAttributeEditorContext() );
context.setAllowCustomUi( false );
context.setFormMode( QgsAttributeEditorContext::StandaloneDialog );
context.setVectorLayerTools( mVectorLayerTools );
context.setCadDockWidget( mAdvancedDigitizingDockWidget );
context.setMapCanvas( mMapCanvas );

QgsFixAttributeDialog *dialog = new QgsFixAttributeDialog( pasteVectorLayer, invalidFeatures, this, context );
int feedback = dialog->exec();

switch ( feedback )
@@ -20,21 +20,19 @@

#include <QtWidgets/QPushButton>

QgsFixAttributeDialog::QgsFixAttributeDialog( QgsVectorLayer *vl, QgsFeatureList &features, QWidget *parent )

QgsFixAttributeDialog::QgsFixAttributeDialog( QgsVectorLayer *vl, QgsFeatureList &features, QWidget *parent, const QgsAttributeEditorContext &context )
: QDialog( parent )
, mFeatures( features )
{
init( vl );
init( vl, context );
}

void QgsFixAttributeDialog::init( QgsVectorLayer *layer )
void QgsFixAttributeDialog::init( QgsVectorLayer *layer, const QgsAttributeEditorContext &context )
{
QgsAttributeEditorContext context;
setWindowTitle( tr( "%1 - Fix Pasted Features" ).arg( layer->name() ) );
setLayout( new QGridLayout() );
layout()->setMargin( 0 );
context.setFormMode( QgsAttributeEditorContext::StandaloneDialog );
context.setVectorLayerTools( QgisApp::instance()->vectorLayerTools() );

mUnfixedFeatures = mFeatures;
mCurrentFeature = mFeatures.begin();
@@ -52,7 +52,7 @@ class APP_EXPORT QgsFixAttributeDialog : public QDialog
/**
* Constructor for QgsFixAttributeDialog
*/
QgsFixAttributeDialog( QgsVectorLayer *vl, QgsFeatureList &features, QWidget *parent SIP_TRANSFERTHIS = nullptr );
QgsFixAttributeDialog( QgsVectorLayer *vl, QgsFeatureList &features, QWidget *parent SIP_TRANSFERTHIS = nullptr, const QgsAttributeEditorContext &context = QgsAttributeEditorContext() );

/**
* Returns fixed features
@@ -69,7 +69,7 @@ class APP_EXPORT QgsFixAttributeDialog : public QDialog
void reject() override;

private:
void init( QgsVectorLayer *layer );
void init( QgsVectorLayer *layer, const QgsAttributeEditorContext &context );
QString descriptionText();

QgsFeatureList mFeatures;

0 comments on commit a360f53

Please sign in to comment.
You can’t perform that action at this time.