1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/gui/processing/qgsprocessingaggregatewidgets.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12 13 14class QgsAggregateMappingModel: QAbstractTableModel 15{ 16%Docstring(signature="appended") 17The :py:class:`QgsAggregateMappingModel` holds mapping information for defining sets of aggregates of 18fields from a :py:class:`QgsFields` object. 19 20.. versionadded:: 3.14 21%End 22 23%TypeHeaderCode 24#include "qgsprocessingaggregatewidgets.h" 25%End 26 public: 27 28 enum class ColumnDataIndex 29 { 30 SourceExpression, 31 Aggregate, 32 Delimiter, 33 DestinationName, 34 DestinationType, 35 DestinationLength, 36 DestinationPrecision, 37 }; 38 39 40 struct Aggregate 41 { 42 QString source; 43 44 QString aggregate; 45 46 QString delimiter; 47 48 QgsField field; 49 50 }; 51 52 QgsAggregateMappingModel( const QgsFields &sourceFields = QgsFields(), 53 QObject *parent = 0 ); 54%Docstring 55Constructs a QgsAggregateMappingModel from a set of ``sourceFields``. 56A ``parent`` object can be also specified. 57%End 58 59 QgsFields sourceFields() const; 60%Docstring 61Returns a list of source fields 62%End 63 64 QList<QgsAggregateMappingModel::Aggregate> mapping() const; 65%Docstring 66Returns a list of Aggregate objects representing the current status of the model 67%End 68 69 void setMapping( const QList<QgsAggregateMappingModel::Aggregate> &mapping ); 70%Docstring 71Sets the ``mapping`` to show in the model. 72%End 73 74 void appendField( const QgsField &field, const QString &source = QString(), const QString &aggregate = QString() ); 75%Docstring 76Appends a new ``field`` to the model, with an optional ``source`` and ``aggregate`` 77%End 78 79 bool removeField( const QModelIndex &index ); 80%Docstring 81Removes the field at ``index`` from the model, returns ``True`` on success 82%End 83 84 bool moveUp( const QModelIndex &index ); 85%Docstring 86Moves down the field at ``index`` 87%End 88 89 bool moveDown( const QModelIndex &index ); 90%Docstring 91Moves up the field at ``index`` 92%End 93 94 void setSourceFields( const QgsFields &sourceFields ); 95%Docstring 96Set source fields to ``sourceFields`` 97%End 98 99 QgsExpressionContextGenerator *contextGenerator() const; 100%Docstring 101Returns the context generator with the source fields 102%End 103 104 void setBaseExpressionContextGenerator( const QgsExpressionContextGenerator *generator ); 105%Docstring 106Sets the base expression context ``generator``, which will generate the expression 107contexts for expression based widgets used by the model. 108%End 109 110 virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; 111 112 virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; 113 114 virtual QVariant data( const QModelIndex &index, int role ) const; 115 116 virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const; 117 118 virtual Qt::ItemFlags flags( const QModelIndex &index ) const; 119 120 virtual bool setData( const QModelIndex &index, const QVariant &value, int role ); 121 122 123}; 124 125class QgsAggregateMappingWidget : QgsPanelWidget 126{ 127%Docstring(signature="appended") 128The :py:class:`QgsAggregateMappingWidget` class creates a mapping for defining sets of aggregates of 129fields from a :py:class:`QgsFields` object. 130 131.. versionadded:: 3.14 132%End 133 134%TypeHeaderCode 135#include "qgsprocessingaggregatewidgets.h" 136%End 137 public: 138 139 explicit QgsAggregateMappingWidget( QWidget *parent = 0, 140 const QgsFields &sourceFields = QgsFields() ); 141%Docstring 142Constructs a QgsAggregateMappingWidget from a set of ``sourceFields``. A ``parent`` object 143can also be specified. 144%End 145 146 QgsAggregateMappingModel *model() const; 147%Docstring 148Returns the underlying mapping model 149%End 150 151 QList<QgsAggregateMappingModel::Aggregate> mapping() const; 152%Docstring 153Returns a list of Aggregate objects representing the current status of the underlying mapping model 154%End 155 156 void setMapping( const QList<QgsAggregateMappingModel::Aggregate> &mapping ); 157%Docstring 158Sets the ``mapping`` to show in the model. 159%End 160 161 QItemSelectionModel *selectionModel(); 162%Docstring 163Returns the selection model 164%End 165 166 void setSourceFields( const QgsFields &sourceFields ); 167%Docstring 168Set source fields of the underlying mapping model to ``sourceFields`` 169%End 170 171 void setSourceLayer( QgsVectorLayer *layer ); 172%Docstring 173Sets a source ``layer`` to use when generating expression previews in the widget. 174 175.. versionadded:: 3.16 176%End 177 178 QgsVectorLayer *sourceLayer(); 179%Docstring 180Returns the source layer for use when generating expression previews. 181 182Returned value may be ``None``. 183 184.. versionadded:: 3.16 185%End 186 187 void scrollTo( const QModelIndex &index ) const; 188%Docstring 189Scroll the fields view to ``index`` 190%End 191 192 void registerExpressionContextGenerator( const QgsExpressionContextGenerator *generator ); 193%Docstring 194Register an expression context ``generator`` class that will be used to retrieve 195an expression context for the widget. 196%End 197 198 signals: 199 200 void changed(); 201%Docstring 202Emitted when the aggregates defined in the widget are changed. 203%End 204 205 public slots: 206 207 void appendField( const QgsField &field, const QString &source = QString(), const QString &aggregate = QString() ); 208%Docstring 209Appends a new ``field`` to the model, with an optional ``source`` and ``aggregate`` 210%End 211 212 bool removeSelectedFields( ); 213%Docstring 214Removes the currently selected field from the model 215%End 216 217 bool moveSelectedFieldsUp( ); 218%Docstring 219Moves up currently selected field 220%End 221 222 bool moveSelectedFieldsDown( ); 223%Docstring 224Moves down currently selected field 225%End 226 227 public: 228}; 229 230 231/************************************************************************ 232 * This file has been generated automatically from * 233 * * 234 * src/gui/processing/qgsprocessingaggregatewidgets.h * 235 * * 236 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 237 ************************************************************************/ 238