Skip to content
Permalink
Browse files

Remove QgsEditorWidgetConfig

This is replaced with a QVariantMap. It was never really more than this in the
past and with the switch to QgsConfigurationProperties, there is really no
longer any reason to assume that this will change.
  • Loading branch information
m-kuhn committed Dec 20, 2016
1 parent ab0dccf commit 9fd08029395d26a30d13b429060a9fe4f91cfc76
Showing with 213 additions and 294 deletions.
  1. +0 −1 python/core/core.sip
  2. +1 −1 python/core/fieldkit/qgskeyvaluefieldkit.sip
  3. +3 −21 python/core/fieldkit/qgsrelationreferencefieldkit.sip
  4. +3 −3 python/core/fieldkit/qgsvaluerelationfieldkit.sip
  5. +2 −2 python/core/qgseditformconfig.sip
  6. +0 −14 python/core/qgseditorwidgetconfig.sip
  7. +2 −2 python/core/qgseditorwidgetsetup.sip
  8. +2 −2 python/gui/editorwidgets/core/qgseditorconfigwidget.sip
  9. +7 −7 python/gui/editorwidgets/core/qgseditorwidgetfactory.sip
  10. +2 −2 python/gui/editorwidgets/core/qgseditorwidgetregistry.sip
  11. +2 −2 python/gui/editorwidgets/core/qgswidgetwrapper.sip
  12. +1 −1 python/gui/qgsattributeformeditorwidget.sip
  13. +3 −3 src/app/qgsattributetypedialog.cpp
  14. +3 −3 src/app/qgsattributetypedialog.h
  15. +1 −1 src/app/qgsfieldsproperties.cpp
  16. +0 −1 src/core/CMakeLists.txt
  17. +4 −4 src/core/qgseditformconfig.cpp
  18. +2 −3 src/core/qgseditformconfig.h
  19. +1 −1 src/core/qgseditformconfig_p.h
  20. +0 −37 src/core/qgseditorwidgetconfig.h
  21. +4 −4 src/core/qgseditorwidgetsetup.h
  22. +0 −1 src/core/qgsvectorlayer.h
  23. +1 −1 src/core/qgsvectorlayerundocommand.h
  24. +3 −3 src/gui/attributetable/qgsattributetablemodel.cpp
  25. +1 −1 src/gui/attributetable/qgsattributetablemodel.h
  26. +2 −3 src/gui/editorwidgets/core/qgseditorconfigwidget.h
  27. +2 −2 src/gui/editorwidgets/core/qgseditorwidgetautoconf.cpp
  28. +6 −6 src/gui/editorwidgets/core/qgseditorwidgetfactory.cpp
  29. +7 −8 src/gui/editorwidgets/core/qgseditorwidgetfactory.h
  30. +3 −3 src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp
  31. +2 −3 src/gui/editorwidgets/core/qgseditorwidgetregistry.h
  32. +0 −1 src/gui/editorwidgets/core/qgssearchwidgetwrapper.h
  33. +2 −2 src/gui/editorwidgets/core/qgswidgetwrapper.cpp
  34. +3 −4 src/gui/editorwidgets/core/qgswidgetwrapper.h
  35. +3 −3 src/gui/editorwidgets/qgscheckboxconfigdlg.cpp
  36. +2 −2 src/gui/editorwidgets/qgscheckboxconfigdlg.h
  37. +3 −3 src/gui/editorwidgets/qgscheckboxwidgetfactory.cpp
  38. +2 −2 src/gui/editorwidgets/qgscheckboxwidgetfactory.h
  39. +3 −3 src/gui/editorwidgets/qgsdatetimeeditconfig.cpp
  40. +2 −2 src/gui/editorwidgets/qgsdatetimeeditconfig.h
  41. +1 −1 src/gui/editorwidgets/qgsdatetimeeditfactory.cpp
  42. +3 −3 src/gui/editorwidgets/qgsdummyconfigdlg.cpp
  43. +2 −2 src/gui/editorwidgets/qgsdummyconfigdlg.h
  44. +3 −3 src/gui/editorwidgets/qgsexternalresourceconfigdlg.cpp
  45. +2 −2 src/gui/editorwidgets/qgsexternalresourceconfigdlg.h
  46. +3 −3 src/gui/editorwidgets/qgsexternalresourcewidgetfactory.cpp
  47. +2 −2 src/gui/editorwidgets/qgsexternalresourcewidgetfactory.h
  48. +3 −3 src/gui/editorwidgets/qgskeyvaluewidgetfactory.cpp
  49. +2 −2 src/gui/editorwidgets/qgskeyvaluewidgetfactory.h
  50. +3 −3 src/gui/editorwidgets/qgslistwidgetfactory.cpp
  51. +2 −2 src/gui/editorwidgets/qgslistwidgetfactory.h
  52. +3 −3 src/gui/editorwidgets/qgsphotoconfigdlg.cpp
  53. +2 −2 src/gui/editorwidgets/qgsphotoconfigdlg.h
  54. +3 −3 src/gui/editorwidgets/qgsphotowidgetfactory.cpp
  55. +2 −2 src/gui/editorwidgets/qgsphotowidgetfactory.h
  56. +3 −3 src/gui/editorwidgets/qgsrangeconfigdlg.cpp
  57. +2 −2 src/gui/editorwidgets/qgsrangeconfigdlg.h
  58. +3 −3 src/gui/editorwidgets/qgsrangewidgetfactory.cpp
  59. +2 −2 src/gui/editorwidgets/qgsrangewidgetfactory.h
  60. +3 −3 src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp
  61. +2 −2 src/gui/editorwidgets/qgsrelationreferenceconfigdlg.h
  62. +3 −3 src/gui/editorwidgets/qgsrelationreferencefactory.cpp
  63. +3 −3 src/gui/editorwidgets/qgsrelationreferencefactory.h
  64. +3 −4 src/gui/editorwidgets/qgstexteditconfigdlg.cpp
  65. +2 −2 src/gui/editorwidgets/qgstexteditconfigdlg.h
  66. +3 −3 src/gui/editorwidgets/qgstexteditwidgetfactory.cpp
  67. +2 −2 src/gui/editorwidgets/qgstexteditwidgetfactory.h
  68. +3 −3 src/gui/editorwidgets/qgsuniquevaluesconfigdlg.cpp
  69. +2 −2 src/gui/editorwidgets/qgsuniquevaluesconfigdlg.h
  70. +3 −3 src/gui/editorwidgets/qgsuniquevaluewidgetfactory.cpp
  71. +2 −2 src/gui/editorwidgets/qgsuniquevaluewidgetfactory.h
  72. +4 −4 src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp
  73. +2 −2 src/gui/editorwidgets/qgsvaluemapconfigdlg.h
  74. +2 −2 src/gui/editorwidgets/qgsvaluemapsearchwidgetwrapper.cpp
  75. +4 −4 src/gui/editorwidgets/qgsvaluemapwidgetfactory.cpp
  76. +2 −2 src/gui/editorwidgets/qgsvaluemapwidgetfactory.h
  77. +2 −2 src/gui/editorwidgets/qgsvaluemapwidgetwrapper.cpp
  78. +3 −3 src/gui/editorwidgets/qgsvaluerelationconfigdlg.cpp
  79. +2 −2 src/gui/editorwidgets/qgsvaluerelationconfigdlg.h
  80. +3 −3 src/gui/editorwidgets/qgsvaluerelationwidgetfactory.cpp
  81. +2 −2 src/gui/editorwidgets/qgsvaluerelationwidgetfactory.h
  82. +3 −3 src/gui/editorwidgets/qgswebviewconfigdlg.cpp
  83. +2 −2 src/gui/editorwidgets/qgswebviewconfigdlg.h
  84. +3 −3 src/gui/editorwidgets/qgswebviewwidgetfactory.cpp
  85. +2 −2 src/gui/editorwidgets/qgswebviewwidgetfactory.h
  86. +1 −2 src/gui/qgsattributeformeditorwidget.cpp
  87. +1 −2 src/gui/qgsattributeformeditorwidget.h
  88. +1 −1 src/providers/postgres/qgspostgresprovider.cpp
  89. +1 −1 src/server/qgsserverprojectparser.cpp
  90. +1 −1 tests/src/core/testqgsfield.cpp
  91. +3 −3 tests/src/gui/testqgseditorwidgetregistry.cpp
  92. +2 −2 tests/src/python/acceptable_missing_doc.py
@@ -47,7 +47,6 @@
%Include qgsdbfilterproxymodel.sip
%Include qgsdistancearea.sip
%Include qgseditformconfig.sip
%Include qgseditorwidgetconfig.sip
%Include qgseditorwidgetsetup.sip
%Include qgserror.sip
%Include qgsexpression.sip
@@ -16,7 +16,7 @@
class QgsKeyValueFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgskeyvaluefieldkit"
#include "qgskeyvaluefieldkit.h"
%End
public:
QgsKeyValueFieldKit();
@@ -1,30 +1,12 @@
/***************************************************************************
qgsrelationreferencefieldkit.sip - QgsRelationReferenceFieldKit

---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

class QgsRelationReferenceFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgsrelationreferencefieldkit"
#include "qgsrelationreferencefieldkit.h"
%End
public:
QgsRelationReferenceFieldKit();

QString id() const;

virtual QString representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const override;

virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap&config, const QVariant& cache, const QVariant& value ) const override;
virtual QString representValue( QgsVectorLayer* layer, int fieldIndex, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;
virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap&config, const QVariant& cache, const QVariant& value ) const;
};
@@ -16,7 +16,7 @@
class QgsValueRelationFieldKit : QgsFieldKit
{
%TypeHeaderCode
#include "qgsvaluerelationfieldkit"
#include "qgsvaluerelationfieldkit.h"
%End

public:
@@ -30,7 +30,7 @@ class QgsValueRelationFieldKit : QgsFieldKit
QString value;
};

typedef QVector < ValueRelationItem > ValueRelationCache;
typedef QVector < QgsValueRelationFieldKit::ValueRelationItem > ValueRelationCache;

QgsValueRelationFieldKit();

@@ -41,5 +41,5 @@ class QgsValueRelationFieldKit : QgsFieldKit

QVariant createCache( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;

static ValueRelationCache createCache( const QVariantMap& config );
static QgsValueRelationFieldKit::ValueRelationCache createCache( const QVariantMap& config );
};
@@ -166,7 +166,7 @@ class QgsEditFormConfig
*
* @note not available in python bindings
*/
void setWidgetConfig( const QString& fieldName, const QgsEditorWidgetConfig& config );
void setWidgetConfig( const QString& fieldName, const QVariantMap& config );

/**
* Get the configuration for the editor widget used to represent the field with the given name
@@ -175,7 +175,7 @@ class QgsEditFormConfig
*
* @return The configuration for the editor widget or an empty config if the field does not exist
*/
QgsEditorWidgetConfig widgetConfig( const QString& fieldName ) const;
QVariantMap widgetConfig( const QString& fieldName ) const;

/**
* Remove the configuration for the editor widget used to represent the field with the given name

This file was deleted.

@@ -10,7 +10,7 @@ class QgsEditorWidgetSetup
/**
* Constructor
*/
QgsEditorWidgetSetup( const QString& type, const QgsEditorWidgetConfig& config );
QgsEditorWidgetSetup( const QString& type, const QVariantMap& config );
QgsEditorWidgetSetup();

/**
@@ -21,7 +21,7 @@ class QgsEditorWidgetSetup
/**
* @return the widget configuration to used
*/
QgsEditorWidgetConfig config() const;
QVariantMap config() const;

/**
* @return true if there is no widget configured.
@@ -36,8 +36,8 @@ class QgsEditorConfigWidget : QWidget
*/
QgsVectorLayer* layer();

virtual QgsEditorWidgetConfig config() = 0;
virtual void setConfig( const QgsEditorWidgetConfig& config ) = 0;
virtual QVariantMap config() = 0;
virtual void setConfig( const QVariantMap& config ) = 0;

signals:

@@ -68,15 +68,15 @@ class QgsEditorWidgetFactory
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}.
* Read the config from an XML file and map it to a proper {@link QVariantMap}.
*
* @param configElement The configuration element from the project file
* @param layer The layer for which this configuration applies
* @param fieldIdx The field on the layer for which this configuration applies
*
* @return A configuration object. This will be passed to your widget wrapper later on
*/
QgsEditorWidgetConfig readEditorConfig( const QDomElement& configElement, QgsVectorLayer* layer, int fieldIdx );
QVariantMap readEditorConfig( const QDomElement& configElement, QgsVectorLayer* layer, int fieldIdx );

/**
* Serialize your configuration and save it in a xml doc.
@@ -87,7 +87,7 @@ class QgsEditorWidgetFactory
* @param layer The layer for which this configuration applies
* @param fieldIdx The field on the layer for which this configuration applies
*/
virtual void writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx );
virtual void writeConfig( const QVariantMap& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx );

/**
* Check if this editor widget type supports a certain field.
@@ -111,15 +111,15 @@ class QgsEditorWidgetFactory
//virtual QHash<const char*, int> supportedWidgetTypes();

/**
* Read the config from an XML file and map it to a proper {@link QgsEditorWidgetConfig}.
* Read the config from an XML file and map it to a proper {@link QVariantMap}.
*
* @param configElement The configuration element from the project file
* @param layer The layer for which this configuration applies
* @param fieldIdx The field on the layer for which this configuration applies
*
* @return A configuration object. This will be passed to your widget wrapper later on
*/
virtual QgsEditorWidgetConfig readConfig( const QDomElement& configElement, QgsVectorLayer* layer, int fieldIdx );
virtual QVariantMap readConfig( const QDomElement& configElement, QgsVectorLayer* layer, int fieldIdx );

/**
* This method allows disabling this editor widget type for a certain field.
@@ -146,10 +146,10 @@ class QgsEditorWidgetFactory
/**
* Copy the given config element to a XML attribute.
*/
static void config2xml( const QgsEditorWidgetConfig& config, QDomElement& configElement, const QString& fieldName );
static void config2xml( const QVariantMap& config, QDomElement& configElement, const QString& fieldName );

/**
* Copy the given XML attribute to the configuration element.
*/
static void xml2config( const QDomElement& configElement, QgsEditorWidgetConfig& config, const QString& fieldName );
static void xml2config( const QDomElement& configElement, QVariantMap& config, const QString& fieldName );
};
@@ -72,15 +72,15 @@ class QgsEditorWidgetRegistry : QObject
QgsEditorWidgetWrapper* create( const QString& widgetId,
QgsVectorLayer* vl,
int fieldIdx,
const QgsEditorWidgetConfig& config,
const QVariantMap& config,
QWidget* editor,
QWidget* parent /TransferThis/,
const QgsAttributeEditorContext& context = QgsAttributeEditorContext() ) /Factory/;

QgsSearchWidgetWrapper* createSearchWidget( const QString& widgetId,
QgsVectorLayer* vl,
int fieldIdx,
const QgsEditorWidgetConfig& config,
const QVariantMap& config,
QWidget* parent /TransferThis/,
const QgsAttributeEditorContext& context = QgsAttributeEditorContext() ) /Factory/;

@@ -69,7 +69,7 @@ class QgsWidgetWrapper : QObject
*
* @param config The config for this wrapper
*/
void setConfig( const QgsEditorWidgetConfig& config );
void setConfig( const QVariantMap& config );

/**
* Set the context in which this widget is shown
@@ -93,7 +93,7 @@ class QgsWidgetWrapper : QObject
*
* @return The configuration
*/
QgsEditorWidgetConfig config() const;
QVariantMap config() const;

/**
* Returns information about the context in which this widget is shown
@@ -38,7 +38,7 @@ class QgsAttributeFormEditorWidget : QWidget
* @param context editor context (not available in python bindings)
*/
void createSearchWidgetWrappers( const QString& widgetId, int fieldIdx,
const QgsEditorWidgetConfig& config,
const QVariantMap& config,
const QgsAttributeEditorContext &context = QgsAttributeEditorContext() );

/** Sets the current mode for the widget. The widget will adapt its state and visible widgets to
@@ -126,7 +126,7 @@ const QString QgsAttributeTypeDialog::editorWidgetText()
}
}

const QgsEditorWidgetConfig QgsAttributeTypeDialog::editorWidgetConfig()
const QVariantMap QgsAttributeTypeDialog::editorWidgetConfig()
{
QListWidgetItem* item = selectionListWidget->currentItem();
if ( item )
@@ -139,7 +139,7 @@ const QgsEditorWidgetConfig QgsAttributeTypeDialog::editorWidgetConfig()
}
}

return QgsEditorWidgetConfig();
return QVariantMap();
}

void QgsAttributeTypeDialog::setWidgetType( const QString& type )
@@ -181,7 +181,7 @@ void QgsAttributeTypeDialog::setWidgetType( const QString& type )
defaultExpressionChanged();
}

void QgsAttributeTypeDialog::setWidgetConfig( const QgsEditorWidgetConfig& config )
void QgsAttributeTypeDialog::setWidgetConfig( const QVariantMap& config )
{
mWidgetConfig = config;
}
@@ -45,9 +45,9 @@ class APP_EXPORT QgsAttributeTypeDialog: public QDialog, private Ui::QgsAttribut

void setWidgetType( const QString& type );

const QgsEditorWidgetConfig editorWidgetConfig();
const QVariantMap editorWidgetConfig();

void setWidgetConfig( const QgsEditorWidgetConfig& config );
void setWidgetConfig( const QVariantMap& config );

/**
* Setter for checkbox to label on top
@@ -176,7 +176,7 @@ class APP_EXPORT QgsAttributeTypeDialog: public QDialog, private Ui::QgsAttribut
QgsVectorLayer *mLayer;
int mFieldIdx;

QgsEditorWidgetConfig mWidgetConfig;
QVariantMap mWidgetConfig;

//! Cached configuration dialog (lazy loaded)
QMap< QString, QgsEditorConfigWidget* > mEditorConfigWidgets;
@@ -1057,7 +1057,7 @@ void QgsFieldsProperties::apply()
// relations
for ( int i = 0; i < mRelationsList->rowCount(); ++i )
{
QgsEditorWidgetConfig cfg;
QVariantMap cfg;

QComboBox* cb = qobject_cast<QComboBox*>( mRelationsList->cellWidget( i, RelNmCol ) );
QVariant otherRelation = cb->currentData();
@@ -659,7 +659,6 @@ SET(QGIS_CORE_HDRS
qgsdiagramrenderer.h
qgsdistancearea.h
qgseditformconfig.h
qgseditorwidgetconfig.h
qgseditorwidgetsetup.h
qgsfeaturefilterprovider.h
qgserror.h
@@ -34,7 +34,7 @@ QString QgsEditFormConfig::widgetType( const QString& fieldName ) const
return d->mEditorWidgetTypes.value( fieldName );
}

QgsEditorWidgetConfig QgsEditFormConfig::widgetConfig( const QString& fieldName ) const
QVariantMap QgsEditFormConfig::widgetConfig( const QString& fieldName ) const
{
return d->mWidgetConfigs.value( fieldName );
}
@@ -74,7 +74,7 @@ void QgsEditFormConfig::setWidgetType( const QString& widgetName, const QString&
d->mEditorWidgetTypes[widgetName] = widgetType;
}

void QgsEditFormConfig::setWidgetConfig( const QString& widgetName, const QgsEditorWidgetConfig& config )
void QgsEditFormConfig::setWidgetConfig( const QString& widgetName, const QVariantMap& config )
{
d.detach();
d->mWidgetConfigs[widgetName] = config;
@@ -429,7 +429,7 @@ void QgsEditFormConfig::writeXml( QDomNode& node ) const

QDomElement widgetsElem = doc.createElement( QStringLiteral( "widgets" ) );

QMap<QString, QgsEditorWidgetConfig >::ConstIterator configIt( d->mWidgetConfigs.constBegin() );
QMap<QString, QVariantMap >::ConstIterator configIt( d->mWidgetConfigs.constBegin() );

while ( configIt != d->mWidgetConfigs.constEnd() )
{
@@ -442,7 +442,7 @@ void QgsEditFormConfig::writeXml( QDomNode& node ) const
QDomElement configElem = doc.createElement( QStringLiteral( "config" ) );
widgetElem.appendChild( configElem );

QgsEditorWidgetConfig::ConstIterator cfgIt( configIt.value().constBegin() );
QVariantMap::ConstIterator cfgIt( configIt.value().constBegin() );

while ( cfgIt != configIt.value().constEnd() )
{
@@ -22,7 +22,6 @@
#include <QDomElement>
#include <QDomDocument>

#include "qgseditorwidgetconfig.h"
#include "qgsattributeeditorelement.h"

class QgsRelationManager;
@@ -200,7 +199,7 @@ class CORE_EXPORT QgsEditFormConfig
*
* @note not available in python bindings
*/
void setWidgetConfig( const QString& fieldName, const QgsEditorWidgetConfig& config );
void setWidgetConfig( const QString& fieldName, const QVariantMap& config );

/**
* Get the configuration for the editor widget used to represent the field with the given name
@@ -210,7 +209,7 @@ class CORE_EXPORT QgsEditFormConfig
*
* @return The configuration for the editor widget or an empty config if the field does not exist
*/
QgsEditorWidgetConfig widgetConfig( const QString& fieldName ) const;
QVariantMap widgetConfig( const QString& fieldName ) const;

/**
* Remove the configuration for the editor widget used to represent the field with the given name
@@ -66,7 +66,7 @@ class QgsEditFormConfigPrivate : public QSharedData
QMap< QString, bool> mLabelOnTop;

QMap<QString, QString> mEditorWidgetTypes;
QMap<QString, QgsEditorWidgetConfig > mWidgetConfigs;
QMap<QString, QVariantMap > mWidgetConfigs;

//! Defines the default layout to use for the attribute editor (Drag and drop, UI File, Generated)
QgsEditFormConfig::EditorLayout mEditorLayout;

0 comments on commit 9fd0802

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