Skip to content
Permalink
Browse files

relation editor: use a public constructor, remove UI file

rename file according to class name
  • Loading branch information
3nids authored and m-kuhn committed Aug 20, 2014
1 parent 4b8288c commit c243c587c8d93a0514541db435da3c6925e76305
@@ -202,7 +202,7 @@ qgsrasterformatsaveoptionswidget.cpp
qgsrasterlayersaveasdialog.cpp
qgsrasterpyramidsoptionswidget.cpp
qgsrelationadddlg.cpp
qgsrelationeditor.cpp
qgsrelationeditorwidget.cpp
qgsrelationmanagerdialog.cpp
qgsrubberband.cpp
qgsscalecombobox.cpp
@@ -392,7 +392,7 @@ qgsrasterformatsaveoptionswidget.h
qgsrasterlayersaveasdialog.h
qgsrasterpyramidsoptionswidget.h
qgsrelationadddlg.h
qgsrelationeditor.h
qgsrelationeditorwidget.h
qgsrelationmanagerdialog.h
qgsscalecombobox.h
qgsscalerangewidget.h
@@ -467,7 +467,7 @@ qgsmessageviewer.h
qgsoptionsdialogbase.h
qgsowssourceselect.h
qgsprojectionselector.h
qgsrelationeditor.h
qgsrelationeditorwidget.h
qgsrubberband.h
qgsscalecombobox.h
qgsscalerangewidget.h
@@ -15,31 +15,38 @@

#include "qgsrelationwidgetwrapper.h"

#include "qgsrelationeditor.h"
#include "qgsrelationeditorwidget.h"

#include <QWidget>

QgsRelationWidgetWrapper::QgsRelationWidgetWrapper( QgsVectorLayer* vl, const QgsRelation& relation, QWidget* editor, QWidget* parent )
: QgsWidgetWrapper( vl, editor, parent )
, mRelation( relation )
, mRelationWidget( 0 )
, mWidget( NULL )
{
initWidget(editor);
}

QWidget* QgsRelationWidgetWrapper::createWidget( QWidget* parent )
{
return new QWidget( parent );
return new QgsRelationEditorWidget( parent );
}

void QgsRelationWidgetWrapper::setFeature( const QgsFeature& feature )
{
delete( mRelationWidget );
mRelationWidget = QgsRelationEditorWidget::createRelationEditor( mRelation, feature, context(), widget() );
widget()->layout()->addWidget( mRelationWidget );
if ( mWidget )
mWidget->setRelationFeature( mRelation, feature, context() );
}

void QgsRelationWidgetWrapper::initWidget( QWidget* editor )
{
if ( !editor->layout() )
editor->setLayout( new QGridLayout( editor ) );
QgsRelationEditorWidget* w = dynamic_cast<QgsRelationEditorWidget*>( editor );

// if the editor cannot be cast to relation editor, insert a new one
if ( !w )
{
w = new QgsRelationEditorWidget( editor );
}

mWidget = w;
}
@@ -36,7 +36,7 @@ class GUI_EXPORT QgsRelationWidgetWrapper : public QgsWidgetWrapper

private:
QgsRelation mRelation;
QgsRelationEditorWidget* mRelationWidget;
QgsRelationEditorWidget* mWidget;
};

#endif // QGSRELATIONWIDGETWRAPPER_H
@@ -32,7 +32,7 @@
#include "qgslonglongvalidator.h"
#include "qgsmaplayerregistry.h"
#include "qgsnetworkaccessmanager.h"
#include "qgsrelationeditor.h"
#include "qgsrelationeditorwidget.h"
#include "qgsrelationmanager.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"

This file was deleted.

0 comments on commit c243c58

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