QGIS/python/gui/auto_generated/attributetable/qgsattributetablemodel.sip.in

284 lines
7.2 KiB
Plaintext
Raw Normal View History

2017-06-08 15:51:05 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/attributetable/qgsattributetablemodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsAttributeTableModel: QAbstractTableModel
{
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
A model backed by a QgsVectorLayerCache which is able to provide
feature/attribute information to a QAbstractItemView.
2017-06-08 15:51:05 +02:00
2017-12-15 10:36:55 -04:00
Is able to generate editor widgets for its QModelIndexes as well.
Is mostly referred to as "master model" within this doc and the source.
2017-06-08 15:51:05 +02:00
2017-12-15 10:36:55 -04:00
\see <a href="http://doc.qt.digia.com/qt/model-view-programming.html">Qt Model View Programming</a>
2017-06-08 15:51:05 +02:00
%End
%TypeHeaderCode
2017-06-08 15:51:05 +02:00
#include "qgsattributetablemodel.h"
%End
public:
enum Role
{
FeatureIdRole,
2017-06-08 15:51:05 +02:00
FieldIndexRole,
UserRole,
2018-09-10 11:11:56 -04:00
// Insert new values here, SortRole needs to be the last one
SortRole,
};
public:
2017-06-08 15:51:05 +02:00
QgsAttributeTableModel( QgsVectorLayerCache *layerCache, QObject *parent = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor
2017-12-15 21:36:08 -04:00
:param layerCache: A layer cache to use as backend
:param parent: The parent QObject (owner)
2017-06-08 15:51:05 +02:00
%End
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the number of rows
2017-12-15 21:36:08 -04:00
:param parent: parent index
2017-06-08 15:51:05 +02:00
%End
virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the number of columns
2017-12-15 21:36:08 -04:00
:param parent: parent index
2017-06-08 15:51:05 +02:00
%End
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns header data
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param section: required section
:param orientation: horizontal or vertical orientation
:param role: data role
2017-06-08 15:51:05 +02:00
%End
virtual QVariant data( const QModelIndex &index, int role ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns data on the given index
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: model index
:param role: data role
2017-06-08 15:51:05 +02:00
%End
virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Updates data on given index
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: model index
:param value: new data value
:param role: data role
2017-06-08 15:51:05 +02:00
%End
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns item flags for the index
2017-12-15 21:36:08 -04:00
:param index: model index
2017-06-08 15:51:05 +02:00
%End
void reload( const QModelIndex &index1, const QModelIndex &index2 );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Reloads the model data between indices
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index1: start index
:param index2: end index
2017-06-08 15:51:05 +02:00
%End
virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Remove rows
2017-06-08 15:51:05 +02:00
%End
void resetModel();
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Resets the model
2017-06-08 15:51:05 +02:00
2017-12-15 10:36:55 -04:00
Alias to loadLayer()
2017-06-08 15:51:05 +02:00
%End
int idToRow( QgsFeatureId id ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Maps feature id to table row
2017-12-15 21:36:08 -04:00
:param id: feature id
2017-06-08 15:51:05 +02:00
%End
QModelIndex idToIndex( QgsFeatureId id ) const;
QModelIndexList idToIndexList( QgsFeatureId id ) const;
int fieldIdx( int col ) const;
2017-06-08 15:51:05 +02:00
%Docstring
Gets field index from column
2017-06-08 15:51:05 +02:00
%End
int fieldCol( int idx ) const;
2017-06-08 15:51:05 +02:00
%Docstring
Gets column from field index
2017-06-08 15:51:05 +02:00
%End
QgsFeatureId rowToId( int row ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Maps row to feature id
2017-12-15 21:36:08 -04:00
:param row: row number
2017-06-08 15:51:05 +02:00
%End
void swapRows( QgsFeatureId a, QgsFeatureId b );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Swaps two rows
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param a: first row
:param b: second row
2017-06-08 15:51:05 +02:00
%End
QgsVectorLayer *layer() const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the layer this model uses as backend. Retrieved from the layer cache.
2017-06-08 15:51:05 +02:00
%End
QgsVectorLayerCache *layerCache() const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the layer cache this model uses as backend.
2017-06-08 15:51:05 +02:00
%End
void executeAction( QUuid action, const QModelIndex &idx ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Execute an action
2017-06-08 15:51:05 +02:00
%End
void executeMapLayerAction( QgsMapLayerAction *action, const QModelIndex &idx ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-19 11:43:52 -04:00
Execute a :py:class:`QgsMapLayerAction`
2017-06-08 15:51:05 +02:00
%End
QgsFeature feature( const QModelIndex &idx ) const;
2017-06-08 15:51:05 +02:00
%Docstring
Returns the feature attributes at given model index
2017-12-15 10:36:55 -04:00
:return: feature attributes at given model index
2017-06-08 15:51:05 +02:00
%End
void prefetchColumnData( int column );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Caches the entire data for one column. This should be called prior to sorting,
so the data does not have to be fetched for every single comparison.
Specify -1 as column to invalidate the cache
2017-06-08 15:51:05 +02:00
2017-12-15 10:36:55 -04:00
:param column: The column index of the field to catch
2017-06-08 15:51:05 +02:00
%End
void prefetchSortData( const QString &expression, unsigned long cacheIndex = 0 );
2017-06-08 15:51:05 +02:00
%Docstring
2018-05-17 13:51:43 +02:00
Prefetches the entire data for an ``expression``. Based on this cached information
2018-05-17 08:57:06 +02:00
the sorting can later be done in a performant way. A ``cacheIndex`` can be specified
if multiple caches should be filled. In this case, the caches will be available
as ``QgsAttributeTableModel.SortRole + cacheIndex``.
2017-06-08 15:51:05 +02:00
%End
2018-05-17 08:57:06 +02:00
QString sortCacheExpression( unsigned long cacheIndex = 0 ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2018-05-17 13:40:02 +02:00
The expression which was used to fill the sorting cache at index ``cacheIndex``.
2018-05-17 08:57:06 +02:00
.. seealso:: :py:func:`prefetchSortData`
2017-06-08 15:51:05 +02:00
%End
void setRequest( const QgsFeatureRequest &request );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set a request that will be used to fill this attribute table model.
In contrast to a filter, the request will constrain the data shown without the possibility
to dynamically adjust it.
2017-06-08 15:51:05 +02:00
2017-12-15 10:36:55 -04:00
:param request: The request to use to fill this table model.
2017-06-08 15:51:05 +02:00
%End
2014-01-27 09:22:24 +01:00
const QgsFeatureRequest &request() const;
void setEditorContext( const QgsAttributeEditorContext &context );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the context in which this table is shown.
Will be forwarded to any editor widget created when editing data on this model.
2017-06-08 15:51:05 +02:00
2017-12-15 10:36:55 -04:00
:param context: The context
2017-06-08 15:51:05 +02:00
%End
2015-02-03 02:21:52 +01:00
const QgsAttributeEditorContext &editorContext() const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the context in which this table is shown.
Will be forwarded to any editor widget created when editing data on this model.
:return: The context
2017-06-08 15:51:05 +02:00
%End
2015-02-03 02:21:52 +01:00
2016-05-11 09:21:08 +02:00
int extraColumns() const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Empty extra columns to announce from this model.
Any extra columns need to be implemented by proxy models in front of this model.
2017-06-08 15:51:05 +02:00
%End
2016-05-11 09:21:08 +02:00
void setExtraColumns( int extraColumns );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Empty extra columns to announce from this model.
Any extra columns need to be implemented by proxy models in front of this model.
2017-06-08 15:51:05 +02:00
%End
2016-05-11 09:21:08 +02:00
public slots:
virtual void loadLayer();
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Loads the layer into the model
Preferably to be called, before using this model as source for any other proxy model
2017-06-08 15:51:05 +02:00
%End
void fieldConditionalStyleChanged( const QString &fieldName );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Handles updating the model when the conditional style for a field changes.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param fieldName: name of field whose conditional style has changed
2017-06-08 15:51:05 +02:00
.. versionadded:: 2.12
%End
signals:
2017-06-08 15:51:05 +02:00
void modelChanged();
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Model has been changed
2017-06-08 15:51:05 +02:00
%End
void finished();
2017-06-08 15:51:05 +02:00
};
2017-06-08 15:51:05 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/attributetable/qgsattributetablemodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/