Skip to content

Commit

Permalink
Debug commit, should be reverted
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus committed Jan 20, 2021
1 parent ecd616b commit 703555a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gui/qgsabstractrelationeditorwidget.cpp
Expand Up @@ -27,6 +27,7 @@
#include "qgsproject.h"
#include "qgstransactiongroup.h"
#include "qgsvectorlayerutils.h"
#include "qgsmessagelog.h"

#include <QMessageBox>
#include <QPushButton>
Expand Down Expand Up @@ -258,8 +259,15 @@ void QgsAbstractRelationEditorWidget::addFeature( const QgsGeometry &geometry )
for ( const QgsRelation::FieldPair &fieldPair : constFieldPairs )
{
keyAttrs.insert( fields.indexFromName( fieldPair.referencingField() ), mFeature.attribute( fieldPair.referencedField() ) );
Q_ASSERT( vlTools->addFeature( mRelation.referencingLayer(), keyAttrs, geometry ) );
}

QgsMessageLog::logMessage( QStringLiteral( "ADDED FEATURES1 %1 %2" ).arg( mRelation.referencingLayer()->name() ).arg( mRelation.referencingLayer()->featureCount() ) );

Q_ASSERT( vlTools->addFeature( mRelation.referencingLayer(), keyAttrs, geometry ) );

QgsMessageLog::logMessage( QStringLiteral( "ADDED FEATURES2 %1 %2" ).arg( mRelation.referencingLayer()->name() ).arg( mRelation.referencingLayer()->featureCount() ) );
mRelation.referencingLayer()->dataProvider()->reloadData();
QgsMessageLog::logMessage( QStringLiteral( "ADDED FEATURES3 %1 %2" ).arg( mRelation.referencingLayer()->name() ).arg( mRelation.referencingLayer()->featureCount() ) );
}
}

Expand Down
4 changes: 4 additions & 0 deletions tests/src/python/test_qgsrelationeditwidget.py
Expand Up @@ -337,7 +337,11 @@ def addFeature(self, layer, defaultValues, defaultGeometry):
self.assertTrue(self.mapCanvas.mapTool())
feature = QgsFeature(vl_leaks.fields())
feature.setGeometry(QgsGeometry.fromWkt('POINT(0 0.8)'))
for f in vl_leaks.getFeatures():
print('FEATURE_ID ONE: ', f.id(), f.geometry())
self.mapCanvas.mapTool().digitizingCompleted.emit(feature)
for f in vl_leaks.getFeatures():
print('FEATURE_ID TWO: ', f.id(), f.geometry())
self.assertEqual(table_view.model().rowCount(), 2)
self.assertEqual(vl_leaks.featureCount(), 4)
request = QgsFeatureRequest()
Expand Down

0 comments on commit 703555a

Please sign in to comment.