Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
JSON widget as default for QVariant::Map and consequently jsonb types
  • Loading branch information
domi4484 committed Jul 21, 2021
1 parent 279f82f commit 595f829
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsjsoneditwidgetfactory.cpp
Expand Up @@ -40,7 +40,7 @@ unsigned int QgsJsonEditWidgetFactory::fieldScore( const QgsVectorLayer *vl, int
switch ( type )
{
case QVariant::Map:
return 15;
return 20;
break;
case QVariant::List:
return 10;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgskeyvaluewidgetfactory.cpp
Expand Up @@ -43,5 +43,5 @@ QgsEditorConfigWidget *QgsKeyValueWidgetFactory::configWidget( QgsVectorLayer *v
unsigned int QgsKeyValueWidgetFactory::fieldScore( const QgsVectorLayer *vl, int fieldIdx ) const
{
const QgsField field = vl->fields().field( fieldIdx );
return field.type() == QVariant::Map && field.subType() != QVariant::Invalid ? 20 : 0;
return field.type() == QVariant::Map && field.subType() != QVariant::Invalid ? 15 : 0;
}
9 changes: 8 additions & 1 deletion src/gui/editorwidgets/qgslistwidgetfactory.cpp
Expand Up @@ -41,5 +41,12 @@ QgsEditorConfigWidget *QgsListWidgetFactory::configWidget( QgsVectorLayer *vl, i
unsigned int QgsListWidgetFactory::fieldScore( const QgsVectorLayer *vl, int fieldIdx ) const
{
const QgsField field = vl->fields().field( fieldIdx );
return ( field.type() == QVariant::List || field.type() == QVariant::StringList || field.type() == QVariant::Map ) && field.subType() != QVariant::Invalid ? 20 : 0;

if ( ( field.type() == QVariant::List || field.type() == QVariant::StringList ) && field.subType() != QVariant::Invalid )
return 20;

if ( ( field.type() == QVariant::Map ) && field.subType() != QVariant::Invalid )
return 15;

return 0;
}

0 comments on commit 595f829

Please sign in to comment.