Skip to content

Commit 4739463

Browse files
committed
use initialized for complete init() function
not only for the feature part
1 parent 386817b commit 4739463

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/gui/editorwidgets/qgsrelationreferencewidget.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ void QgsRelationReferenceWidget::showEvent( QShowEvent *e )
460460
Q_UNUSED( e )
461461

462462
mShown = true;
463-
464-
init();
463+
if ( !mInitialized )
464+
init();
465465
}
466466

467467
void QgsRelationReferenceWidget::init()
@@ -555,14 +555,12 @@ void QgsRelationReferenceWidget::init()
555555

556556
// Only connect after iterating, to have only one iterator on the referenced table at once
557557
connect( mComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsRelationReferenceWidget::comboReferenceChanged );
558+
//call it for the first time
559+
emit mComboBox->currentIndexChanged( mComboBox->currentIndex() );
558560

559-
if ( !mFeatureInitialized )
560-
{
561-
//call it for the first initialization
562-
emit mComboBox->currentIndexChanged( mComboBox->currentIndex() );
563-
mFeatureInitialized = true;
564-
}
565561
QApplication::restoreOverrideCursor();
562+
563+
mInitialized = true;
566564
}
567565
}
568566

src/gui/editorwidgets/qgsrelationreferencewidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
222222
bool mIsEditable = true;
223223
QStringList mFilterFields;
224224
QMap<QString, QMap<QString, QSet<QString> > > mFilterCache;
225-
bool mFeatureInitialized = false;
225+
bool mInitialized = false;
226226

227227
// Q_PROPERTY
228228
bool mEmbedForm = false;

0 commit comments

Comments
 (0)