@@ -334,6 +334,7 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
334
334
connect ( mCollapseAction , &QAction::triggered, this , &QgsIdentifyResultsDialog::mCollapseAction_triggered );
335
335
connect ( mActionCopy , &QAction::triggered, this , &QgsIdentifyResultsDialog::mActionCopy_triggered );
336
336
connect ( mActionAutoFeatureForm , &QAction::toggled, this , &QgsIdentifyResultsDialog::mActionAutoFeatureForm_toggled );
337
+ connect ( mActionHideDerivedAttributes , &QAction::toggled, this , &QgsIdentifyResultsDialog::mActionHideDerivedAttributes_toggled );
337
338
338
339
mOpenFormAction ->setDisabled ( true );
339
340
@@ -433,6 +434,9 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
433
434
434
435
settingsMenu->addAction ( mActionAutoFeatureForm );
435
436
mActionAutoFeatureForm ->setChecked ( mySettings.value ( QStringLiteral ( " Map/identifyAutoFeatureForm" ), false ).toBool () );
437
+ settingsMenu->addAction ( mActionHideDerivedAttributes );
438
+ mActionHideDerivedAttributes ->setChecked ( mySettings.value ( QStringLiteral ( " Map/hideDerivedAttributes" ), false ).toBool () );
439
+
436
440
}
437
441
438
442
QgsIdentifyResultsDialog::~QgsIdentifyResultsDialog ()
@@ -609,7 +613,7 @@ QgsIdentifyResultsFeatureItem *QgsIdentifyResultsDialog::createFeatureItem( QgsV
609
613
featItem->setData ( 0 , FeatureRole, f );
610
614
parentItem->addChild ( featItem );
611
615
612
- if ( !derivedAttributes.empty () )
616
+ if ( !derivedAttributes.empty () && ! QgsSettings (). value ( QStringLiteral ( " /Map/hideDerivedAttributes " ), false ). toBool () )
613
617
{
614
618
QgsTreeWidgetItem *derivedItem = new QgsTreeWidgetItem ( QStringList () << tr ( " (Derived)" ) );
615
619
derivedItem->setData ( 0 , Qt::UserRole, " derived" );
@@ -626,7 +630,7 @@ QgsIdentifyResultsFeatureItem *QgsIdentifyResultsDialog::createFeatureItem( QgsV
626
630
QList< QgsMapLayerAction * > registeredActions = QgsGui::mapLayerActionRegistry ()->mapLayerActions ( vlayer );
627
631
QList<QgsAction> actions = vlayer->actions ()->actions ( QStringLiteral ( " Feature" ) );
628
632
629
- if ( !vlayer->fields ().isEmpty () || !actions.isEmpty () || !registeredActions.isEmpty () )
633
+ if ( ( !vlayer->fields ().isEmpty () || !actions.isEmpty () || !registeredActions.isEmpty () ) && ! QgsSettings (). value ( QStringLiteral ( " /Map/hideDerivedAttributes " ), false ). toBool () )
630
634
{
631
635
QgsTreeWidgetItem *actionItem = new QgsTreeWidgetItem ( QStringList () << tr ( " (Actions)" ) );
632
636
actionItem->setData ( 0 , Qt::UserRole, " actions" );
@@ -1063,7 +1067,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
1063
1067
}
1064
1068
}
1065
1069
1066
- if ( derivedAttributes.size () >= 0 )
1070
+ if ( derivedAttributes.size () >= 0 && ! QgsSettings (). value ( QStringLiteral ( " /Map/hideDerivedAttributes " ), false ). toBool () )
1067
1071
{
1068
1072
QgsTreeWidgetItem *derivedItem = new QgsTreeWidgetItem ( QStringList () << tr ( " (Derived)" ) );
1069
1073
derivedItem->setData ( 0 , Qt::UserRole, " derived" );
@@ -1135,6 +1139,12 @@ void QgsIdentifyResultsDialog::addFeature( QgsMeshLayer *layer,
1135
1139
connect ( layer, &QgsMapLayer::crsChanged, this , &QgsIdentifyResultsDialog::layerDestroyed );
1136
1140
}
1137
1141
1142
+ // for Mesh layers it looks like it is best to hide the 'Geometry' feature, but keep the actual 'derived' attributes
1143
+ if ( label == tr ( " Geometry" ) && QgsSettings ().value ( QStringLiteral ( " /Map/hideDerivedAttributes" ), false ).toBool () )
1144
+ {
1145
+ return ;
1146
+ }
1147
+
1138
1148
QgsIdentifyResultsFeatureItem *featItem = new QgsIdentifyResultsFeatureItem ( QgsFields (),
1139
1149
QgsFeature (),
1140
1150
layer->crs (),
@@ -1197,7 +1207,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorTileLayer *layer,
1197
1207
: QString ();
1198
1208
layItem->setText ( 0 , QStringLiteral ( " %1 %2" ).arg ( layer->name (), countSuffix ) );
1199
1209
1200
- if ( derivedAttributes.size () >= 0 )
1210
+ if ( derivedAttributes.size () >= 0 && ! QgsSettings (). value ( QStringLiteral ( " /Map/hideDerivedAttributes " ), false ). toBool () )
1201
1211
{
1202
1212
QgsTreeWidgetItem *derivedItem = new QgsTreeWidgetItem ( QStringList () << tr ( " (Derived)" ) );
1203
1213
derivedItem->setData ( 0 , Qt::UserRole, " derived" );
@@ -2270,6 +2280,12 @@ void QgsIdentifyResultsDialog::mActionAutoFeatureForm_toggled( bool checked )
2270
2280
settings.setValue ( QStringLiteral ( " Map/identifyAutoFeatureForm" ), checked );
2271
2281
}
2272
2282
2283
+ void QgsIdentifyResultsDialog::mActionHideDerivedAttributes_toggled ( bool checked )
2284
+ {
2285
+ QgsSettings settings;
2286
+ settings.setValue ( QStringLiteral ( " Map/hideDerivedAttributes" ), checked );
2287
+ }
2288
+
2273
2289
void QgsIdentifyResultsDialog::mExpandNewAction_triggered ( bool checked )
2274
2290
{
2275
2291
QgsSettings settings;
0 commit comments