Fix memory leak and pass ownership of py editor widgets to C++

This commit is contained in:
Matthias Kuhn 2014-08-03 18:49:02 +02:00
parent 44bed005f1
commit f63a01cc7c
3 changed files with 5 additions and 3 deletions

View File

@ -44,7 +44,7 @@ class QgsEditorWidgetFactory
*
* @return A new widget wrapper
*/
virtual QgsEditorWidgetWrapper* create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const = 0;
virtual QgsEditorWidgetWrapper* create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const = 0 /Factory/;
/**
* Return The human readable identifier name of this widget type
@ -63,7 +63,7 @@ class QgsEditorWidgetFactory
*
* @return A configuration widget
*/
virtual QgsEditorConfigWidget* configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const = 0;
virtual QgsEditorConfigWidget* configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const = 0 /Factory/;
/**
* Read the config from an XML file and map it to a proper {@link QgsEditorWidgetConfig}.

View File

@ -72,7 +72,7 @@ class QgsEditorWidgetWrapper : QObject
static QgsEditorWidgetWrapper* fromWidget( QWidget* widget );
protected:
virtual QWidget* createWidget( QWidget* parent ) = 0 /Factory/;
virtual QWidget* createWidget( QWidget* parent ) = 0;
virtual void initWidget( QWidget* editor );

View File

@ -77,6 +77,8 @@ QgsAttributeTypeDialog::~QgsAttributeTypeDialog()
{
QSettings settings;
settings.setValue( "/Windows/QgsAttributeTypeDialog/geometry", saveGeometry() );
qDeleteAll( mEditorConfigWidgets.values() );
}
const QString QgsAttributeTypeDialog::editorWidgetV2Type()