mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-13 00:07:27 -05:00
Previously the widget would always just use a generic hardcoded list of field types. This isn't appropriate for all destination providers, which may not support certain field types. Add API so that an explicit list of supported destination field types can be set for the widget, restricting the choices available to users for destination fields.
185 lines
5.7 KiB
Plaintext
185 lines
5.7 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/gui/qgsfieldmappingwidget.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
class QgsFieldMappingWidget : QgsPanelWidget
|
|
{
|
|
%Docstring(signature="appended")
|
|
The :py:class:`QgsFieldMappingWidget` class creates a mapping from one set of :py:class:`QgsFields` to another,
|
|
for each set of "destination" fields an expression defines how to obtain the values of the
|
|
"destination" fields.
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsfieldmappingwidget.h"
|
|
%End
|
|
public:
|
|
explicit QgsFieldMappingWidget(
|
|
QWidget *parent = 0,
|
|
const QgsFields &sourceFields = QgsFields(),
|
|
const QgsFields &destinationFields = QgsFields(),
|
|
const QMap<QString, QString> &expressions = QMap<QString, QString>(),
|
|
const QList< QgsVectorDataProvider::NativeType > &nativeTypes = QList< QgsVectorDataProvider::NativeType >()
|
|
);
|
|
%Docstring
|
|
Constructs a QgsFieldMappingWidget from a set of ``sourceFields``
|
|
and ``destinationFields``, initial values for the expressions can be
|
|
optionally specified through ``expressions`` which is a map from the original
|
|
field name to the corresponding expression. A ``parent`` object
|
|
can also be specified.
|
|
|
|
Since QGIS 3.44, the ``nativeTypes`` argument can be used to specify the list of
|
|
field types natively supported by a data provider. If this list is non-empty, then
|
|
the destination field types will be populated accordingly. If the list is empty,
|
|
then a set of default native types will be used instead.
|
|
%End
|
|
|
|
void setDestinationEditable( bool editable );
|
|
%Docstring
|
|
Sets the destination fields editable state to ``editable``
|
|
%End
|
|
|
|
bool destinationEditable() const;
|
|
%Docstring
|
|
Returns ``True`` if the destination fields are editable in the model
|
|
%End
|
|
|
|
QgsFieldMappingModel *model() const;
|
|
%Docstring
|
|
Returns the underlying mapping model
|
|
%End
|
|
|
|
QList<QgsFieldMappingModel::Field> mapping() const;
|
|
%Docstring
|
|
Returns a list of Field objects representing the current status of the underlying mapping model
|
|
%End
|
|
|
|
QMap<QString, QgsProperty> fieldPropertyMap() const;
|
|
%Docstring
|
|
Returns a map of destination field name to :py:class:`QgsProperty` definition for field value,
|
|
representing the current status of the widget.
|
|
|
|
.. seealso:: :py:func:`setFieldPropertyMap`
|
|
%End
|
|
|
|
void setFieldPropertyMap( const QMap<QString, QgsProperty> &map );
|
|
%Docstring
|
|
Sets a map of destination field name to :py:class:`QgsProperty` definition for field value.
|
|
|
|
.. seealso:: :py:func:`fieldPropertyMap`
|
|
%End
|
|
|
|
QItemSelectionModel *selectionModel();
|
|
%Docstring
|
|
Returns the selection model
|
|
%End
|
|
|
|
void setSourceFields( const QgsFields &sourceFields );
|
|
%Docstring
|
|
Set source fields of the underlying mapping model to ``sourceFields``
|
|
%End
|
|
|
|
void setSourceLayer( QgsVectorLayer *layer );
|
|
%Docstring
|
|
Sets a source ``layer`` to use when generating expression previews in the widget.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
QgsVectorLayer *sourceLayer();
|
|
%Docstring
|
|
Returns the source layer for use when generating expression previews.
|
|
|
|
Returned value may be ``None``.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
void setDestinationFields( const QgsFields &destinationFields, const QMap<QString, QString> &expressions = QMap<QString, QString>() );
|
|
%Docstring
|
|
Set destination fields to ``destinationFields`` in the underlying model,
|
|
initial values for the expressions can be optionally specified through
|
|
``expressions`` which is a map from the original field name to the
|
|
corresponding expression.
|
|
%End
|
|
|
|
void setNativeTypes( const QList< QgsVectorDataProvider::NativeType > &nativeTypes );
|
|
%Docstring
|
|
Sets the list of ``nativeTypes`` supported by a data provider.
|
|
|
|
If this list is non-empty, then the destination field types will be populated
|
|
accordingly. If the list is empty, then a set of default native types will be
|
|
used instead.
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
void scrollTo( const QModelIndex &index ) const;
|
|
%Docstring
|
|
Scroll the fields view to ``index``
|
|
%End
|
|
|
|
void registerExpressionContextGenerator( const QgsExpressionContextGenerator *generator );
|
|
%Docstring
|
|
Register an expression context ``generator`` class that will be used to retrieve
|
|
an expression context for the widget.
|
|
%End
|
|
|
|
signals:
|
|
|
|
void changed();
|
|
%Docstring
|
|
Emitted when the fields defined in the widget are changed.
|
|
%End
|
|
|
|
public slots:
|
|
|
|
void appendField( const QgsField &field, const QString &expression = QString() );
|
|
%Docstring
|
|
Appends a new ``field`` to the model, with an optional ``expression``
|
|
%End
|
|
|
|
bool removeSelectedFields();
|
|
%Docstring
|
|
Removes the currently selected field from the model
|
|
%End
|
|
|
|
bool moveSelectedFieldsUp();
|
|
%Docstring
|
|
Moves up currently selected field
|
|
%End
|
|
|
|
bool moveSelectedFieldsDown();
|
|
%Docstring
|
|
Moves down the currently selected field
|
|
%End
|
|
|
|
void invertSelection();
|
|
%Docstring
|
|
Invert the field selection state.
|
|
|
|
.. versionadded:: 3.32
|
|
%End
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/gui/qgsfieldmappingwidget.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|