Skip to content

Commit

Permalink
Display a disabled checkbox when update/delete/insert are not possibl…
Browse files Browse the repository at this point in the history
…e due to provider limitations
  • Loading branch information
pblottiere authored and nyalldawson committed Oct 6, 2023
1 parent f5230b1 commit 4301244
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/app/qgsprojectproperties.cpp
Expand Up @@ -919,29 +919,35 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
psb->setValue( QgsProject::instance()->readNumEntry( QStringLiteral( "WFSLayersPrecision" ), "/" + currentLayer->id(), 8 ) );
twWFSLayers->setCellWidget( j, 2, psb );

QCheckBox *cbu = new QCheckBox();
cbu->setEnabled(false);
if ( ( provider->capabilities() & QgsVectorDataProvider::ChangeAttributeValues ) )
{
if ( ! currentLayer->isSpatial() or ( provider->capabilities() & QgsVectorDataProvider::ChangeGeometries ) )
{
QCheckBox *cbu = new QCheckBox();
cbu->setEnabled(true);
cbu->setChecked( wfstUpdateLayerIdList.contains( currentLayer->id() ) );
twWFSLayers->setCellWidget( j, 3, cbu );
}
}
twWFSLayers->setCellWidget( j, 3, cbu );

QCheckBox *cbi = new QCheckBox();
cbi->setEnabled(false);
if ( ( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) )
{
QCheckBox *cbi = new QCheckBox();
cbi->setEnabled(true);
cbi->setChecked( wfstInsertLayerIdList.contains( currentLayer->id() ) );
twWFSLayers->setCellWidget( j, 4, cbi );
}
twWFSLayers->setCellWidget( j, 4, cbi );

QCheckBox *cbd = new QCheckBox();
cbd->setEnabled(false);
if ( ( provider->capabilities() & QgsVectorDataProvider::DeleteFeatures ) )
{
QCheckBox *cbd = new QCheckBox();
cbd->setEnabled(true);
cbd->setChecked( wfstDeleteLayerIdList.contains( currentLayer->id() ) );
twWFSLayers->setCellWidget( j, 5, cbd );
}
twWFSLayers->setCellWidget( j, 5, cbd );

j++;
}
Expand Down

0 comments on commit 4301244

Please sign in to comment.