Skip to content
Permalink
Browse files

use of QVariantList instead of QList<QVariant>

  • Loading branch information
signedav committed Dec 19, 2019
1 parent 3da65e0 commit 9e5657c8fe94fc1691662a36e4ddbff40f3d7642
@@ -40,7 +40,7 @@ Default constructor of field formatter for a relation reference field.



virtual QList<QVariant> availableValues( const QVariantMap &config, int countLimit ) const;
virtual QVariantList availableValues( const QVariantMap &config, int countLimit ) const;



@@ -47,7 +47,7 @@ Default constructor of field formatter for a value map field.
virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;


virtual QList<QVariant> availableValues( const QVariantMap &config, int countLimit ) const;
virtual QVariantList availableValues( const QVariantMap &config, int countLimit ) const;

};

@@ -129,7 +129,7 @@ Returns the (possibly NULL) layer from the widget's ``config`` and ``project``
%End


virtual QList<QVariant> availableValues( const QVariantMap &config, int countLimit ) const;
virtual QVariantList availableValues( const QVariantMap &config, int countLimit ) const;

};

@@ -94,7 +94,7 @@ make use of a cache if present.
%End


virtual QList<QVariant> availableValues( const QVariantMap &config, int countLimit ) const;
virtual QVariantList availableValues( const QVariantMap &config, int countLimit ) const;
%Docstring
Returns a list of the values that would be possible to select with this widget type
On a RelationReference that would be the parents ids or on ValueMap all the configured keys
@@ -180,9 +180,9 @@ QList<QgsVectorLayerRef> QgsRelationReferenceFieldFormatter::layerDependencies(
return result;
}

QList<QVariant> QgsRelationReferenceFieldFormatter::availableValues( const QVariantMap &config, int countLimit ) const
QVariantList QgsRelationReferenceFieldFormatter::availableValues( const QVariantMap &config, int countLimit ) const
{
QList<QVariant> values;
QVariantList values;

const QgsVectorLayer *referencedLayer = QgsProject::instance()->relationManager()->relation( config[QStringLiteral( "Relation" )].toString() ).referencedLayer();
if ( referencedLayer )
@@ -46,7 +46,7 @@ class CORE_EXPORT QgsRelationReferenceFieldFormatter : public QgsFieldFormatter

QList<QgsVectorLayerRef> layerDependencies( const QVariantMap &config ) const override SIP_SKIP;

QList<QVariant> availableValues( const QVariantMap &config, int countLimit ) const override;
QVariantList availableValues( const QVariantMap &config, int countLimit ) const override;

//friend class TestQgsRelationReferenceFieldFormatter;

@@ -68,9 +68,9 @@ QVariant QgsValueMapFieldFormatter::sortValue( QgsVectorLayer *layer, int fieldI
return representValue( layer, fieldIndex, config, cache, value );
}

QList<QVariant> QgsValueMapFieldFormatter::availableValues( const QVariantMap &config, int countLimit ) const
QVariantList QgsValueMapFieldFormatter::availableValues( const QVariantMap &config, int countLimit ) const
{
QList<QVariant> values;
QVariantList values;
const QList<QVariant> valueList = config.value( QStringLiteral( "map" ) ).toList();
for ( const QVariant &item : valueList )
{
@@ -57,7 +57,7 @@ class CORE_EXPORT QgsValueMapFieldFormatter : public QgsFieldFormatter

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

QList<QVariant> availableValues( const QVariantMap &config, int countLimit ) const override;
QVariantList availableValues( const QVariantMap &config, int countLimit ) const override;
};

#endif // QGSVALUEMAPFIELDKIT_H
@@ -188,9 +188,9 @@ QList<QgsVectorLayerRef> QgsValueRelationFieldFormatter::layerDependencies( cons
return result;
}

QList<QVariant> QgsValueRelationFieldFormatter::availableValues( const QVariantMap &config, int countLimit ) const
QVariantList QgsValueRelationFieldFormatter::availableValues( const QVariantMap &config, int countLimit ) const
{
QList<QVariant> values;
QVariantList values;

const QgsVectorLayer *referencedLayer = qobject_cast<QgsVectorLayer *>( QgsProject::instance()->mapLayer( config[QStringLiteral( "Layer" )].toString() ) );
if ( referencedLayer )
@@ -127,7 +127,7 @@ class CORE_EXPORT QgsValueRelationFieldFormatter : public QgsFieldFormatter

QList<QgsVectorLayerRef> layerDependencies( const QVariantMap &config ) const override SIP_SKIP;

QList<QVariant> availableValues( const QVariantMap &config, int countLimit ) const override;
QVariantList availableValues( const QVariantMap &config, int countLimit ) const override;
};

Q_DECLARE_METATYPE( QgsValueRelationFieldFormatter::ValueRelationCache )
@@ -69,12 +69,12 @@ QList<QgsVectorLayerRef> QgsFieldFormatter::layerDependencies( const QVariantMap
return QList<QgsVectorLayerRef>();
}

QList<QVariant> QgsFieldFormatter::availableValues( const QVariantMap &config, int countLimit ) const
QVariantList QgsFieldFormatter::availableValues( const QVariantMap &config, int countLimit ) const
{
Q_UNUSED( config )
Q_UNUSED( countLimit )

return QList<QVariant>();
return QVariantList();
}

void QgsFieldFormatter::setFlags( const Flags &flags )
@@ -125,7 +125,7 @@ class CORE_EXPORT QgsFieldFormatter
* according to the settings in the \a config
* \since QGIS 3.12
*/
virtual QList<QVariant> availableValues( const QVariantMap &config, int countLimit ) const;
virtual QVariantList availableValues( const QVariantMap &config, int countLimit ) const;

/**
* Returns the flags
@@ -472,7 +472,7 @@ void QgsExpressionBuilderWidget::fillFieldValues( const QString &fieldName, int
const QgsEditorWidgetSetup setup = fields.at( fieldIndex ).editorWidgetSetup();
const QgsFieldFormatter *formatter = QgsApplication::fieldFormatterRegistry()->fieldFormatter( setup.type() );

QList<QVariant> values;
QVariantList values;
if ( cbxValuesInUse->isVisible() && !cbxValuesInUse->isChecked() && !forceUsedValues )
{
values = formatter->availableValues( setup.config(), countLimit );

0 comments on commit 9e5657c

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