Skip to content

Commit

Permalink
Fix widget to wrapper converter code
Browse files Browse the repository at this point in the history
Fixes #10337
  • Loading branch information
m-kuhn committed May 25, 2014
1 parent 2c51dcb commit 2700bcd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
8 changes: 1 addition & 7 deletions src/gui/editorwidgets/core/qgswidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand All @@ -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 )
Expand Down

0 comments on commit 2700bcd

Please sign in to comment.