Skip to content
Permalink
Browse files

Fix widget to wrapper converter code

Fixes #10337
  • Loading branch information
m-kuhn committed May 25, 2014
1 parent 2c51dcb commit 2700bcd5dd5d254917dfe27e1718303570b8816e
@@ -37,7 +37,7 @@ QgsField QgsEditorWidgetWrapper::field()

QgsEditorWidgetWrapper* QgsEditorWidgetWrapper::fromWidget( QWidget* widget )
{
return widget->property( "EWV2Wrapper" ).value<QgsEditorWidgetWrapper*>();
return qobject_cast<QgsEditorWidgetWrapper*>( widget->property( "EWV2Wrapper" ).value<QgsWidgetWrapper*>() );
}

void QgsEditorWidgetWrapper::setFeature( const QgsFeature& feature )
@@ -31,7 +31,7 @@ QWidget* QgsWidgetWrapper::widget()
if ( !mWidget )
{
mWidget = createWidget( mParent );
mWidget->setProperty( "EWV2Wrapper", QVariant::fromValue( this ) );
mWidget->setProperty( "EWV2Wrapper", QVariant::fromValue<QgsWidgetWrapper*>( this ) );
initWidget( mWidget );
}

@@ -41,12 +41,6 @@ QWidget* QgsWidgetWrapper::widget()
void QgsWidgetWrapper::setConfig( const QgsEditorWidgetConfig& config )
{
mConfig = config;
// If an editor widget was supplied, we can initialize this now
if ( mWidget )
{
mWidget->setProperty( "EWV2Wrapper", QVariant::fromValue( this ) );
initWidget( mWidget );
}
}

void QgsWidgetWrapper::setContext( const QgsAttributeEditorContext& context )

0 comments on commit 2700bcd

Please sign in to comment.
You can’t perform that action at this time.