@@ -1349,34 +1349,37 @@ QWidget* QgsAttributeEditor::createWidgetFromDef( const QgsAttributeEditorElemen
1349
1349
int fldIdx = fieldDef->idx ();
1350
1350
newWidget = createAttributeEditor ( parent, 0 , vl, fldIdx, attrs.value ( fldIdx, QVariant () ), proxyWidgets );
1351
1351
1352
- if ( vl-> editType ( fldIdx ) != QgsVectorLayer::Immutable )
1352
+ if ( newWidget )
1353
1353
{
1354
- if ( newWidget-> isEnabled () && vl->isEditable () && vl-> fieldEditable ( fldIdx ) )
1354
+ if ( vl->editType ( fldIdx ) != QgsVectorLayer::Immutable )
1355
1355
{
1356
- newWidget->setEnabled ( true );
1357
- }
1358
- else if ( vl->editType ( fldIdx ) == QgsVectorLayer::Photo )
1359
- {
1360
- foreach ( QWidget *w, newWidget->findChildren <QWidget *>() )
1356
+ if ( newWidget->isEnabled () && vl->isEditable () && vl->fieldEditable ( fldIdx ) )
1361
1357
{
1362
- w ->setEnabled ( qobject_cast<QLabel *>( w ) ? true : false );
1358
+ newWidget ->setEnabled ( true );
1363
1359
}
1364
- }
1365
- else if ( vl->editType ( fldIdx ) == QgsVectorLayer::WebView )
1366
- {
1367
- foreach ( QWidget *w, newWidget->findChildren <QWidget *>() )
1360
+ else if ( vl->editType ( fldIdx ) == QgsVectorLayer::Photo )
1368
1361
{
1369
- if ( qobject_cast<QWebView *>( w ) )
1370
- w->setEnabled ( true );
1371
- else if ( qobject_cast<QPushButton *>( w ) && w->objectName () == " openUrl" )
1372
- w->setEnabled ( true );
1373
- else
1374
- w->setEnabled ( false );
1362
+ foreach ( QWidget *w, newWidget->findChildren <QWidget *>() )
1363
+ {
1364
+ w->setEnabled ( qobject_cast<QLabel *>( w ) ? true : false );
1365
+ }
1366
+ }
1367
+ else if ( vl->editType ( fldIdx ) == QgsVectorLayer::WebView )
1368
+ {
1369
+ foreach ( QWidget *w, newWidget->findChildren <QWidget *>() )
1370
+ {
1371
+ if ( qobject_cast<QWebView *>( w ) )
1372
+ w->setEnabled ( true );
1373
+ else if ( qobject_cast<QPushButton *>( w ) && w->objectName () == " openUrl" )
1374
+ w->setEnabled ( true );
1375
+ else
1376
+ w->setEnabled ( false );
1377
+ }
1378
+ }
1379
+ else
1380
+ {
1381
+ newWidget->setEnabled ( false );
1375
1382
}
1376
- }
1377
- else
1378
- {
1379
- newWidget->setEnabled ( false );
1380
1383
}
1381
1384
}
1382
1385
0 commit comments