33     : mCurrentSortColumn( 0 )
    41   return ( mAscending ? 
qgsVariantLessThan( m1[mCurrentSortColumn], m2[mCurrentSortColumn] )
    51     , mSource( LayerAttributes )
    52     , mCurrentAtlasLayer( nullptr )
    53     , mComposerMap( nullptr )
    54     , mMaximumNumberOfFeatures( 30 )
    55     , mShowUniqueRowsOnly( false )
    56     , mShowOnlyVisibleFeatures( false )
    57     , mFilterToAtlasIntersection( false )
    58     , mFilterFeatures( false )
    59     , mFeatureFilter( 
"" )
    64   for ( ; mapIt != layerMap.
constEnd(); ++mapIt )
   101   return tr( 
"<attribute table>" );
   106   if ( layer == mVectorLayer.
get() )
   136   if ( relationId == mRelationId )
   166 void QgsComposerAttributeTableV2::atlasLayerChanged( 
QgsVectorLayer *layer )
   175   if ( mCurrentAtlasLayer )
   181   mCurrentAtlasLayer = layer;
   218   if ( map == mComposerMap )
   241   if ( features == mMaximumNumberOfFeatures )
   246   mMaximumNumberOfFeatures = features;
   253   if ( uniqueOnly == mShowUniqueRowsOnly )
   258   mShowUniqueRowsOnly = uniqueOnly;
   265   if ( visibleOnly == mShowOnlyVisibleFeatures )
   270   mShowOnlyVisibleFeatures = visibleOnly;
   277   if ( filterToAtlas == mFilterToAtlasIntersection )
   282   mFilterToAtlasIntersection = filterToAtlas;
   289   if ( filter == mFilterFeatures )
   294   mFilterFeatures = filter;
   301   if ( expression == mFeatureFilter )
   306   mFeatureFilter = expression;
   328     for ( ; attIt != attr.
constEnd(); ++attIt )
   330       int attrIdx = ( *attIt );
   331       if ( !fields.
exists( attrIdx ) )
   346     Q_FOREACH ( 
const QgsField& field, fields )
   379     Q_FOREACH ( 
const QString& field, fields )
   396     Q_FOREACH ( 
const QgsField& field, layerFields )
   413 void QgsComposerAttributeTableV2::restoreFieldAliasMap( 
const QMap<int, QString>& map )
   424     int attrIdx = source->
fieldNameIndex(( *columnIt )->attribute() );
   427       ( *columnIt )->setHeading( map.
value( attrIdx ) );
   456   context->setFields( layer->
fields() );
   460   bool activeFilter = 
false;
   461   if ( mFilterFeatures && !mFeatureFilter.
isEmpty() )
   464     if ( !filterExpression->hasParserError() )
   471   if ( mComposerMap && mShowOnlyVisibleFeatures )
   499   if ( !selectionRect.
isEmpty() )
   516   while ( fit.
nextFeature( f ) && counter < mMaximumNumberOfFeatures )
   518     context->setFeature( f );
   520     if ( activeFilter && !filterExpression.
isNull() )
   522       QVariant result = filterExpression->evaluate( context.
data() );
   530     if ( mFilterToAtlasIntersection )
   553         currentRow << replaceWrapChar( f.
attributes().
at( idx ) );
   568       contents << currentRow;
   576   for ( 
int i = sortColumns.
size() - 1; i >= 0; --i )
   580     qStableSort( contents.
begin(), contents.
end(), c );
   599 QVariant QgsComposerAttributeTableV2::replaceWrapChar( 
const QVariant &variant )
 const   606   replaced.
replace( mWrapString, 
"\n" );
   617       return mVectorLayer.
get();
   627 void QgsComposerAttributeTableV2::removeLayer( 
const QString& layerId )
   631     if ( layerId == mVectorLayer->
id() )
   643   return a.second->sortByRank() < b.second->sortByRank();
   654     if (( *columnIt )->sortByRank() > 0 )
   656       sortedColumns.
append( qMakePair( idx, *columnIt ) );
   667   for ( ; sortedColumnIt != sortedColumns.
constEnd(); ++sortedColumnIt )
   670     attributesBySortRank.append( qMakePair(( *sortedColumnIt ).first,
   671                                            ( *sortedColumnIt ).second->sortOrder() == Qt::AscendingOrder ) );
   673   return attributesBySortRank;
   678   if ( wrapString == mWrapString )
   692   composerTableElem.
setAttribute( 
"relationId", mRelationId );
   693   composerTableElem.
setAttribute( 
"showUniqueRowsOnly", mShowUniqueRowsOnly );
   694   composerTableElem.
setAttribute( 
"showOnlyVisibleFeatures", mShowOnlyVisibleFeatures );
   695   composerTableElem.
setAttribute( 
"filterToAtlasIntersection", mFilterToAtlasIntersection );
   696   composerTableElem.
setAttribute( 
"maxFeatures", mMaximumNumberOfFeatures );
   697   composerTableElem.
setAttribute( 
"filterFeatures", mFilterFeatures ? 
"true" : 
"false" );
   698   composerTableElem.
setAttribute( 
"featureFilter", mFeatureFilter );
   699   composerTableElem.
setAttribute( 
"wrapString", mWrapString );
   703     composerTableElem.
setAttribute( 
"composerMap", mComposerMap->
id() );
   745   mRelationId = itemElem.
attribute( 
"relationId", 
"" );
   752   mShowUniqueRowsOnly = itemElem.
attribute( 
"showUniqueRowsOnly", 
"0" ).
toInt();
   753   mShowOnlyVisibleFeatures = itemElem.
attribute( 
"showOnlyVisibleFeatures", 
"1" ).
toInt();
   754   mFilterToAtlasIntersection = itemElem.
attribute( 
"filterToAtlasIntersection", 
"0" ).
toInt();
   755   mFilterFeatures = itemElem.
attribute( 
"filterFeatures", 
"false" ) == 
"true" ? true : 
false;
   756   mFeatureFilter = itemElem.
attribute( 
"featureFilter", 
"" );
   757   mMaximumNumberOfFeatures = itemElem.
attribute( 
"maxFeatures", 
"5" ).
toInt();
   758   mWrapString = itemElem.
attribute( 
"wrapString" );
   761   int composerMapId = itemElem.
attribute( 
"composerMap", 
"-1" ).
toInt();
   762   if ( composerMapId == -1 )
   764     mComposerMap = 
nullptr;
   773     mComposerMap = 
nullptr;
   787   mVectorLayer = 
QgsVectorLayerRef( layerId, layerName, layerSource, layerProvider );
   808   if ( recalcFrameSizes )
   816   if ( source == mSource )
   825   if ( newLayer != prevLayer )
   837       mCurrentAtlasLayer = newLayer;
 void setFilterToAtlasFeature(const bool filterToAtlas)
Sets attribute table to only show features which intersect the current atlas feature. 
 
Class for parsing and evaluation of expressions (formerly called "search strings"). 
 
Wrapper for iterator of features from vector data provider or vector layer. 
 
void setAttribute(const QString &attribute)
Sets the attribute name or expression used for the column's values. 
 
Single variable definition for use within a QgsExpressionContextScope. 
 
QgsVectorLayer * sourceLayer()
Returns the source layer for the table, considering the table source mode. 
 
virtual QgsExpressionContext * createExpressionContext() const override
Creates an expression context relating to the objects' current state. 
 
A rectangle specified with double values. 
 
QgsAttributes attributes() const
Returns the feature's attributes. 
 
const QgsComposerMap * getComposerMapById(const int id) const
Returns the composer map with specified id. 
 
bool intersects(const QgsRectangle &r) const
Test for intersection with a rectangle (uses GEOS) 
 
bool contains(const Key &key) const
 
Q_DECL_DEPRECATED QVariant evaluate(const QgsFeature *f)
Evaluate the feature and return the result. 
 
Helper class for sorting tables, takes into account sorting column and ascending / descending...
 
QDomNode appendChild(const QDomNode &newChild)
 
void append(const T &value)
 
Use exact geometry intersection (slower) instead of bounding boxes. 
 
void push_back(const T &value)
 
QString attribute(const QString &name, const QString &defValue) const
 
Q_DECL_DEPRECATED bool prepare(const QgsFields &fields)
Get the expression ready for evaluation - find out column indexes. 
 
bool exists(int i) const
Return if a field index is valid. 
 
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request. 
 
void setWrapString(const QString &wrapString)
Sets a string to wrap the contents of the table cells by. 
 
const_iterator constEnd() const
 
const_iterator constBegin() const
 
const T & at(int i) const
 
const QgsCoordinateReferenceSystem & crs() const
Returns layer's spatial reference system. 
 
virtual bool writeXML(QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const override
Stores state information about multiframe in DOM element. 
 
bool hasCrsTransformEnabled() const
returns true if projections are enabled for this layer set 
 
int id() const
Get identification number. 
 
Container of fields for a vector layer. 
 
QMap< QString, QgsMapLayer * > mapLayers() const
Returns a map of all registered layers by layer ID. 
 
virtual bool writeXML(QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const override
Writes properties specific to attribute tables. 
 
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature. 
 
void setComposerMap(const QgsComposerMap *map)
Sets the composer map to use to limit the extent of features shown in the attribute table...
 
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
 
QgsRelationManager * relationManager() const
 
void recalculateTableSize()
Recalculates and updates the size of the table and all table frames. 
 
bool qgsVariantGreaterThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is greater than the second. 
 
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
QString tr(const char *sourceText, const char *disambiguation, int n)
 
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) override
Reads the properties specific to an attribute table from xml. 
 
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second. 
 
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1) 
 
QgsFields fields() const
Returns the list of fields of this layer. 
 
const char * name() const
 
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Set feature ID that should be fetched. 
 
QString number(int n, int base)
 
void append(const T &value)
 
QString provider
Weak reference to layer provider. 
 
bool contentsContainsRow(const QgsComposerTableContents &contents, const QgsComposerTableRow &row) const
Checks whether a table contents contains a given row. 
 
QString layerId
Original layer ID. 
 
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry. 
 
TYPE * resolveWeakly()
Resolves the map layer by attempting to find a matching layer in the map layer registry using a weak ...
 
void setHeading(const QString &heading)
Sets the heading for a column, which is the value displayed in the columns header cell...
 
void setFilterFeatures(const bool filter)
Sets whether the feature filter is active for the attribute table. 
 
bool isEmpty() const
test if rectangle is empty. 
 
void setAttribute(const QString &name, const QString &value)
 
void setSortColumn(int col)
Sets column number to sort by. 
 
int toInt(bool *ok, int base) const
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
QList< QgsComposerFrame * > mFrameItems
 
QString name
Weak reference to layer name. 
 
const_iterator constEnd() const
 
void setFeatureFilter(const QString &expression)
Sets the expression used for filtering features in the table. 
 
void addComposerTableFrame(QgsComposerAttributeTableV2 *table, QgsComposerFrame *frame)
Adds composer tablev2 frame and advises composer to create a widget for it (through signal) ...
 
This class wraps a request for features to a vector layer (or directly its vector data provider)...
 
A class to display a table in the print composer, and allow the table to span over multiple frames...
 
ContentSource source() const
Returns the source for attributes shown in the table body. 
 
void recalculateFrameSizes() override
 
const_iterator constEnd() const
 
QgsFeatureRequest & setFlags(const QgsFeatureRequest::Flags &flags)
Set flags that affect how features will be fetched. 
 
bool operator()(const QgsComposerTableRow &m1, const QgsComposerTableRow &m2)
 
Encapsulate a field in an attribute table or data source. 
 
void setRelationId(const QString &relationId)
Sets the relation id from which to display child features. 
 
QgsFeatureRequest getRelatedFeaturesRequest(const QgsFeature &feature) const
Creates a request to return all the features on the referencing (child) layer which have a foreign ke...
 
Stores properties of a column in a QgsComposerTable. 
 
void setLayer(TYPE *l)
Sets the reference to point to a specified layer. 
 
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) override
Reads multiframe state information from a DOM element. 
 
QString source
Weak reference to layer public source. 
 
Graphics scene for map printing. 
 
const QgsMapSettings & mapSettings() const
Return setting of QGIS map canvas. 
 
Object representing map window. 
 
Frame item for a composer multiframe item. 
 
QgsFeatureId id() const
Get the feature ID for this feature. 
 
int fieldNameIndex(const QString &fieldName) const
Look up field's index from name also looks up case-insensitive if there is no match otherwise...
 
bool contains(QChar ch, Qt::CaseSensitivity cs) const
 
Q_DECL_DEPRECATED void setDisplayAttributes(const QSet< int > &attr, bool refresh=true)
Sets the attributes to display in the table. 
 
void setSource(const ContentSource source)
Sets the source for attributes to show in table body. 
 
bool getTableContents(QgsComposerTableContents &contents) override
Queries the attribute table's vector layer for attributes to show in the table. 
 
const_iterator constBegin() const
 
QList< QPair< int, bool > > sortAttributes() const
Returns the attributes used to sort the table's features. 
 
QgsComposition * mComposition
 
~QgsComposerAttributeTableV2()
 
QString & replace(int position, int n, QChar after)
 
QgsComposerTableColumns mColumns
Columns to show in table. 
 
void setVectorLayer(QgsVectorLayer *layer)
Sets the vector layer from which to display feature attributes. 
 
const T & at(int i) const
 
QgsComposerAttributeTableCompareV2()
 
QgsVectorLayer * referencingLayer() const
Access the referencing (child) layer This is the layer which has the field(s) which point to another ...
 
const_iterator constBegin() const
 
virtual void addFrame(QgsComposerFrame *frame, bool recalcFrameSizes=true) override
Adds a frame to the multiframe. 
 
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call. 
 
void resetColumns()
Resets the attribute table's columns to match the vector layer's fields. 
 
ContentSource
Specifies the content source for the attribute table. 
 
void setDisplayedFields(const QStringList &fields, bool refresh=true)
Sets the attributes to display in the table. 
 
void setMaximumNumberOfFeatures(const int features)
Sets the maximum number of features shown by the table. 
 
QgsComposition * composition()
Returns the parent composition for the multiframe. 
 
virtual void refreshAttributes()
Refreshes the contents shown in the table by querying for new data. 
 
static bool columnsBySortRank(QPair< int, QgsComposerTableColumn * > a, QPair< int, QgsComposerTableColumn * > b)
 
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context. 
 
static QgsProject * instance()
Returns the QgsProject singleton instance. 
 
void setUniqueRowsOnly(const bool uniqueOnly)
Sets attribute table to only show unique rows. 
 
_LayerRef< QgsVectorLayer > QgsVectorLayerRef
 
QString relationId() const
Returns the relation id which the table displays child features from. 
 
QgsVectorLayer * coverageLayer() const
Returns the coverage layer used for the atlas features. 
 
QgsAtlasComposition & atlasComposition()
 
QgsFeature feature() const
Returns the current atlas feature. 
 
QString wrapString() const
Returns the string used to wrap the contents of the table cells by. 
 
Custom exception class for Coordinate Reference System related exceptions. 
 
void setAscending(bool asc)
Sets sort order for column sorting. 
 
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer. 
 
const_iterator constEnd() const
 
QDomElement createElement(const QString &tagName)
 
bool nextFeature(QgsFeature &f)
 
const_iterator constBegin() const
 
QgsRelation relation(const QString &id) const
Get access to a relation by its id. 
 
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
Represents a vector layer which manages a vector based data sets. 
 
TYPE * get() const
Returns a pointer to the layer, or nullptr if the reference has not yet been matched to a layer...
 
QgsComposerTableContents * contents()
Returns the current contents of the table. 
 
QgsComposerFrame * frame(int i) const
Returns a child frame from the multiframe. 
 
QString attributeDisplayName(int attributeIndex) const
Convenience function that returns the attribute alias if defined or the field name else...
 
const QgsRectangle * currentMapExtent() const
Returns a pointer to the current map extent, which is either the original user specified extent or th...
 
virtual QString displayName() const override
Get multiframe display name. 
 
const QgsCoordinateReferenceSystem & destinationCrs() const
returns CRS of destination coordinate reference system 
 
void setDisplayOnlyVisibleFeatures(const bool visibleOnly)
Sets attribute table to only show features which are visible in a composer map item. 
 
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken. 
 
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist. 
 
bool enabled() const
Returns whether the atlas generation is enabled. 
 
virtual QgsExpressionContext * createExpressionContext() const
Creates an expression context relating to the objects' current state. 
 
QgsComposerAttributeTableV2(QgsComposition *composition, bool createUndoCommands)
 
void changed()
Emitted when the properties of a multi frame have changed, and the GUI item widget must be updated...
 
const T value(const Key &key) const