Make sure a widget is initialized when creating a widget wrapper

Fix #10357
This commit is contained in:
Matthias Kuhn 2014-05-27 19:06:23 +02:00
parent 644dd13c3a
commit 37c1cad11a
2 changed files with 5 additions and 1 deletions

View File

@ -44,10 +44,14 @@ QgsEditorWidgetWrapper* QgsEditorWidgetRegistry::create( const QString& widgetId
if ( mWidgetFactories.contains( widgetId ) )
{
QgsEditorWidgetWrapper* ww = mWidgetFactories[widgetId]->create( vl, fieldIdx, editor, parent );
if ( ww )
{
ww->setConfig( config );
ww->setContext( context );
// Make sure that there is a widget created at this point
// so setValue() et al won't crash
ww->widget();
return ww;
}
}

View File

@ -62,7 +62,7 @@ const QgsEditorWidgetConfig QgsWidgetWrapper::config()
return mConfig;
}
const QgsAttributeEditorContext&QgsWidgetWrapper::context()
const QgsAttributeEditorContext& QgsWidgetWrapper::context()
{
return mContext;
}