Skip to content

Commit

Permalink
Remove deprecated QgsAttributeEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 15, 2016
1 parent fe65063 commit 2a9e520
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 231 deletions.
1 change: 1 addition & 0 deletions doc/api_break.dox
Expand Up @@ -178,6 +178,7 @@ This page tries to maintain a list with incompatible changes that happened in pr

<ul>
<li>QgsAttributeAction was removed, and replaced by QgsActionManager.</li>
<li>QgsAttributeEditor was removed. Use QgsEditorWidgetRegistry::create() instead.</li>
<li>QgsColorbutton was removed. QgsColorButtonV2 has now been renamed to QgsColorButton. Hence, QgsColorButtonV2 does not exist anymore.</li>
<li>QgsColorDialog was removed, and QgsColorDialogV2 was renamed to QgsColorDialog. Hence, QgsColorButtonV2 does not exist anymore.
All the functionality from the old QgsColorDialog has been moved to the new class.</li>
Expand Down
1 change: 0 additions & 1 deletion python/gui/gui.sip
Expand Up @@ -28,7 +28,6 @@
%Include qgsadvanceddigitizingdockwidget.sip
%Include qgsannotationitem.sip
%Include qgsattributedialog.sip
%Include qgsattributeeditor.sip
%Include qgsattributeeditorcontext.sip
%Include qgsattributeform.sip
%Include qgsattributeformeditorwidget.sip
Expand Down
36 changes: 0 additions & 36 deletions python/gui/qgsattributeeditor.sip

This file was deleted.

26 changes: 15 additions & 11 deletions src/app/qgsmergeattributesdialog.cpp
Expand Up @@ -19,13 +19,13 @@
#include "qgsmergeattributesdialog.h"
#include "qgisapp.h"
#include "qgsapplication.h"
#include "qgseditorwidgetwrapper.h"
#include "qgsfeatureiterator.h"
#include "qgsfield.h"
#include "qgsmapcanvas.h"
#include "qgsrubberband.h"
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"
#include "qgsattributeeditor.h"
#include "qgsstatisticalsummary.h"
#include "qgseditorwidgetregistry.h"

Expand Down Expand Up @@ -142,6 +142,8 @@ void QgsMergeAttributesDialog::createTableWidgetContents()
QStringList verticalHeaderLabels; //the id column is in the
verticalHeaderLabels << tr( "Id" );

QgsAttributeEditorContext context;

for ( int i = 0; i < mFeatureList.size(); ++i )
{
verticalHeaderLabels << FID_TO_STRING( mFeatureList[i].id() );
Expand All @@ -155,8 +157,12 @@ void QgsMergeAttributesDialog::createTableWidgetContents()
QTableWidgetItem* attributeValItem = new QTableWidgetItem( attrs.at( idx ).toString() );
attributeValItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mTableWidget->setItem( i + 1, j, attributeValItem );
QWidget* attributeWidget = QgsAttributeEditor::createAttributeEditor( mTableWidget, nullptr, mVectorLayer, idx, attrs.at( idx ) );
mTableWidget->setCellWidget( i + 1, j, attributeWidget );
QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( mVectorLayer, idx, nullptr, mTableWidget, context );
if ( eww )
{
eww->setValue( attrs.at( idx ) );
}
mTableWidget->setCellWidget( i + 1, j, eww->widget() );
}
}

Expand Down Expand Up @@ -329,16 +335,14 @@ QVariant QgsMergeAttributesDialog::featureAttribute( QgsFeatureId featureId, int
for ( i = 0; i < mFeatureList.size() && mFeatureList.at( i ).id() != featureId; i++ )
;

QVariant value;
if ( i < mFeatureList.size() &&
QgsAttributeEditor::retrieveValue( mTableWidget->cellWidget( i + 1, col ), mVectorLayer, fieldIdx, value ) )
if ( i < mFeatureList.size() )
{
return value;
}
else
{
return QVariant( mVectorLayer->fields().at( fieldIdx ).type() );
QgsEditorWidgetWrapper* wrapper = QgsEditorWidgetWrapper::fromWidget( mTableWidget->cellWidget( i + 1, col ) );
if ( wrapper )
return wrapper->value();
}

return QVariant( mVectorLayer->fields().at( fieldIdx ).type() );
}


Expand Down
2 changes: 0 additions & 2 deletions src/gui/CMakeLists.txt
Expand Up @@ -166,7 +166,6 @@ SET(QGIS_GUI_SRCS
qgsadvanceddigitizingdockwidget.cpp
qgsannotationitem.cpp
qgsattributedialog.cpp
qgsattributeeditor.cpp
qgsattributeform.cpp
qgsattributeformeditorwidget.cpp
qgsattributeforminterface.cpp
Expand Down Expand Up @@ -332,7 +331,6 @@ SET(QGIS_GUI_MOC_HDRS
qgsactionmenu.h
qgsadvanceddigitizingdockwidget.h
qgsattributedialog.h
qgsattributeeditor.h
qgsattributeform.h
qgsattributeformeditorwidget.h
qgsattributetypeloaddialog.h
Expand Down
93 changes: 0 additions & 93 deletions src/gui/qgsattributeeditor.cpp

This file was deleted.

86 changes: 0 additions & 86 deletions src/gui/qgsattributeeditor.h

This file was deleted.

11 changes: 9 additions & 2 deletions src/gui/qgsformannotationitem.cpp
Expand Up @@ -16,7 +16,9 @@
***************************************************************************/

#include "qgsformannotationitem.h"
#include "qgsattributeeditor.h"
#include "qgsattributeeditorcontext.h"
#include "qgseditorwidgetregistry.h"
#include "qgseditorwidgetwrapper.h"
#include "qgsfeature.h"
#include "qgsfeatureiterator.h"
#include "qgslogger.h"
Expand Down Expand Up @@ -89,6 +91,7 @@ QWidget* QgsFormAnnotationItem::createDesignerWidget( const QString& filePath )
file.close();

//get feature and set attribute information
QgsAttributeEditorContext context;
if ( mVectorLayer && mHasAssociatedFeature )
{
QgsFeature f;
Expand All @@ -103,7 +106,11 @@ QWidget* QgsFormAnnotationItem::createDesignerWidget( const QString& filePath )
QWidget* attWidget = widget->findChild<QWidget*>( fields.at( i ).name() );
if ( attWidget )
{
QgsAttributeEditor::createAttributeEditor( widget, attWidget, mVectorLayer, i, attrs.at( i ) );
QgsEditorWidgetWrapper* eww = QgsEditorWidgetRegistry::instance()->create( mVectorLayer, i, attWidget, widget, context );
if ( eww )
{
eww->setValue( attrs.at( i ) );
}
}
}
}
Expand Down

0 comments on commit 2a9e520

Please sign in to comment.