Skip to content
Permalink
Browse files
Fix #10548 (crash using custom forms)
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 d43d3065e912ba78f581c39dfa5159953b88c2e8
Showing with 6 additions and 1 deletion.
  1. +5 −1 src/gui/editorwidgets/core/qgswidgetwrapper.cpp
  2. +1 −0 src/gui/editorwidgets/core/qgswidgetwrapper.h
@@ -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;
@@ -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

0 comments on commit d43d306

Please sign in to comment.