Skip to content

Commit

Permalink
Fix #10548 (crash using custom forms)
Browse files Browse the repository at this point in the history
When using a custom UI file, the widget is created beforehand,
and the code was failing to initialize it.
  • Loading branch information
wonder-sk committed Jun 12, 2014
1 parent 4f91399 commit d43d306
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gui/editorwidgets/core/qgswidgetwrapper.cpp
Expand Up @@ -23,16 +23,20 @@ QgsWidgetWrapper::QgsWidgetWrapper( QgsVectorLayer* vl, QWidget* editor, QWidget
, mWidget( editor )
, mParent( parent )
, mLayer( vl )
, mInitialized( false )
{
}

QWidget* QgsWidgetWrapper::widget()
{
if ( !mWidget )
{
mWidget = createWidget( mParent );

if ( !mInitialized )
{
mWidget->setProperty( "EWV2Wrapper", QVariant::fromValue<QgsWidgetWrapper*>( this ) );
initWidget( mWidget );
mInitialized = true;
}

return mWidget;
Expand Down
1 change: 1 addition & 0 deletions src/gui/editorwidgets/core/qgswidgetwrapper.h
Expand Up @@ -163,6 +163,7 @@ class GUI_EXPORT QgsWidgetWrapper : public QObject
QWidget* mWidget;
QWidget* mParent;
QgsVectorLayer* mLayer;
bool mInitialized;
};

// We'll use this class inside a QVariant in the widgets properties
Expand Down

0 comments on commit d43d306

Please sign in to comment.