QGIS/python/gui/attributetable/qgsattributetablemodel.sip

313 lines
7.3 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
\brief
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
{
SortRole,
FeatureIdRole,
2017-06-08 15:51:05 +02:00
FieldIndexRole,
UserRole
};
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
: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
:param parent: parent index
:rtype: int
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
:param parent: parent index
:rtype: int
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
:param section: required section
:param orientation: horizontal or vertical orientation
:param role: data role
:rtype: QVariant
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
:param index: model index
:param role: data role
:rtype: QVariant
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
:param index: model index
:param value: new data value
:param role: data role
:rtype: bool
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
:param index: model index
:rtype: Qt.ItemFlags
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
: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
:rtype: bool
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
:param id: feature id
:rtype: int
2017-06-08 15:51:05 +02:00
%End
QModelIndex idToIndex( QgsFeatureId id ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
:rtype: QModelIndex
2017-06-08 15:51:05 +02:00
%End
QModelIndexList idToIndexList( QgsFeatureId id ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
:rtype: QModelIndexList
2017-06-08 15:51:05 +02:00
%End
int fieldIdx( int col ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
get field index from column
:rtype: int
2017-06-08 15:51:05 +02:00
%End
int fieldCol( int idx ) const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
get column from field index
:rtype: int
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
:param row: row number
:rtype: QgsFeatureId
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
: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.
:rtype: QgsVectorLayer
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.
:rtype: QgsVectorLayerCache
2017-06-08 15:51:05 +02:00
%End
2017-06-08 15:51:05 +02:00
void executeAction( const QUuid &action, const QModelIndex &idx ) const;
%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-15 10:36:55 -04:00
Execute a 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
2017-12-15 10:36:55 -04:00
Return the feature attributes at given model index
:return: feature attributes at given model index
:rtype: QgsFeature
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 );
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Prefetches the entire data for one expression. Based on this cached information
the sorting can later be done in a performant way.
2017-06-08 15:51:05 +02:00
2017-12-15 10:36:55 -04:00
:param expression: The expression to cache
2017-06-08 15:51:05 +02:00
%End
QString sortCacheExpression() const;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
The expression which was used to fill the sorting cache
:rtype: str
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;
2017-06-08 15:51:05 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
:rtype: QgsFeatureRequest
2017-06-08 15:51:05 +02:00
%End
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
:rtype: QgsAttributeEditorContext
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.
:rtype: int
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.
: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 *
************************************************************************/