@@ -323,7 +323,7 @@ void QgsRelationReferenceWidget::deleteForeignKey()
323
323
emit foreignKeyChanged ( QVariant ( QVariant::Int ) );
324
324
}
325
325
326
- QgsFeature QgsRelationReferenceWidget::referencedFeature ()
326
+ QgsFeature QgsRelationReferenceWidget::referencedFeature () const
327
327
{
328
328
QgsFeature f;
329
329
if ( mReferencedLayer )
@@ -356,7 +356,7 @@ void QgsRelationReferenceWidget::showIndeterminateState()
356
356
updateAttributeEditorFrame ( QgsFeature () );
357
357
}
358
358
359
- QVariant QgsRelationReferenceWidget::foreignKey ()
359
+ QVariant QgsRelationReferenceWidget::foreignKey () const
360
360
{
361
361
if ( mReadOnlySelector )
362
362
{
@@ -557,6 +557,7 @@ void QgsRelationReferenceWidget::init()
557
557
558
558
// Only connect after iterating, to have only one iterator on the referenced table at once
559
559
connect ( mComboBox , SIGNAL ( currentIndexChanged ( int ) ), this , SLOT ( comboReferenceChanged ( int ) ) );
560
+ updateAttributeEditorFrame ( mFeature );
560
561
QApplication::restoreOverrideCursor ();
561
562
}
562
563
}
@@ -706,13 +707,11 @@ void QgsRelationReferenceWidget::comboReferenceChanged( int index )
706
707
707
708
void QgsRelationReferenceWidget::updateAttributeEditorFrame ( const QgsFeature& feature )
708
709
{
710
+ mOpenFormButton ->setEnabled ( feature.isValid () );
709
711
// Check if we're running with an embedded frame we need to update
710
- if ( mAttributeEditorFrame )
712
+ if ( mAttributeEditorFrame && mReferencedAttributeForm )
711
713
{
712
- if ( mReferencedAttributeForm )
713
- {
714
- mReferencedAttributeForm ->setFeature ( feature );
715
- }
714
+ mReferencedAttributeForm ->setFeature ( feature );
716
715
}
717
716
}
718
717
0 commit comments