QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Types | Public Member Functions | List of all members
QgsComposerAttributeTableV2 Class Reference

A table that displays attributes from a vector layer. More...

#include <qgscomposerattributetablev2.h>

Inheritance diagram for QgsComposerAttributeTableV2:
Inheritance graph
[legend]

Public Types

enum  ContentSource { LayerAttributes = 0, AtlasFeature, RelationChildren }
 Specifies the content source for the attribute table. More...
 
- Public Types inherited from QgsComposerTableV2
enum  CellStyleGroup {
  OddColumns, EvenColumns, OddRows, EvenRows,
  FirstColumn, LastColumn, HeaderRow, FirstRow,
  LastRow
}
 Row or column groups for cell styling. More...
 
enum  EmptyTableMode { HeadersOnly = 0, HideTable, ShowMessage }
 Controls how empty tables are displayed. More...
 
enum  HeaderHAlignment { FollowColumn, HeaderLeft, HeaderCenter, HeaderRight }
 Controls how headers are horizontally aligned in a table. More...
 
enum  HeaderMode { FirstFrame = 0, AllFrames, NoHeaders }
 Controls where headers are shown in the table. More...
 
enum  WrapBehaviour { TruncateText = 0, WrapText }
 Controls how long strings in the table are handled. More...
 
- Public Types inherited from QgsComposerMultiFrame
enum  ResizeMode { UseExistingFrames = 0, ExtendToNextPage, RepeatOnEveryPage, RepeatUntilFinished }
 Specifies the behaviour for creating new frames to fit the multiframe's content. More...
 
- Public Types inherited from QgsComposerObject
enum  DataDefinedProperty {
  NoProperty = 0, AllProperties, TestProperty, PresetPaperSize,
  PaperWidth, PaperHeight, NumPages, PaperOrientation,
  PageNumber, PositionX, PositionY, ItemWidth,
  ItemHeight, ItemRotation, Transparency, BlendMode,
  ExcludeFromExports, MapRotation, MapScale, MapXMin,
  MapYMin, MapXMax, MapYMax, MapAtlasMargin,
  MapLayers, MapStylePreset, PictureSource, SourceUrl
}
 Data defined properties for different item types. More...
 
enum  PropertyValueType { EvaluatedValue = 0, OriginalValue }
 Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property. More...
 

Public Member Functions

 QgsComposerAttributeTableV2 (QgsComposition *composition, bool createUndoCommands)
 
 ~QgsComposerAttributeTableV2 ()
 
virtual void addFrame (QgsComposerFrame *frame, bool recalcFrameSizes=true) override
 Adds a frame to the multiframe. More...
 
const QgsComposerMapcomposerMap () const
 Returns the composer map whose extents are controlling the features shown in the table. More...
 
virtual QgsExpressionContextcreateExpressionContext () const override
 Creates an expression context relating to the objects' current state. More...
 
virtual QString displayName () const override
 Get multiframe display name. More...
 
bool displayOnlyVisibleFeatures () const
 Returns true if the table is set to show only features visible on a corresponding composer map item. More...
 
QString featureFilter () const
 Returns the current expression used to filter features for the table. More...
 
bool filterFeatures () const
 Returns true if a feature filter is active on the attribute table. More...
 
bool filterToAtlasFeature () const
 Returns true if the table is set to only show features which intersect the current atlas feature. More...
 
bool getTableContents (QgsComposerTableContents &contents) override
 Queries the attribute table's vector layer for attributes to show in the table. More...
 
int maximumNumberOfFeatures () const
 Returns the maximum number of features to be shown by the table. More...
 
virtual bool readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) override
 Reads the properties specific to an attribute table from xml. More...
 
QString relationId () const
 Returns the relation id which the table displays child features from. More...
 
void resetColumns ()
 Resets the attribute table's columns to match the vector layer's fields. More...
 
void setComposerMap (const QgsComposerMap *map)
 Sets the composer map to use to limit the extent of features shown in the attribute table. More...
 
Q_DECL_DEPRECATED void setDisplayAttributes (const QSet< int > &attr, bool refresh=true)
 Sets the attributes to display in the table. More...
 
void setDisplayedFields (const QStringList &fields, bool refresh=true)
 Sets the attributes to display in the table. More...
 
void setDisplayOnlyVisibleFeatures (const bool visibleOnly)
 Sets attribute table to only show features which are visible in a composer map item. More...
 
void setFeatureFilter (const QString &expression)
 Sets the expression used for filtering features in the table. More...
 
void setFilterFeatures (const bool filter)
 Sets whether the feature filter is active for the attribute table. More...
 
void setFilterToAtlasFeature (const bool filterToAtlas)
 Sets attribute table to only show features which intersect the current atlas feature. More...
 
void setMaximumNumberOfFeatures (const int features)
 Sets the maximum number of features shown by the table. More...
 
void setRelationId (const QString &relationId)
 Sets the relation id from which to display child features. More...
 
void setSource (const ContentSource source)
 Sets the source for attributes to show in table body. More...
 
void setUniqueRowsOnly (const bool uniqueOnly)
 Sets attribute table to only show unique rows. More...
 
void setVectorLayer (QgsVectorLayer *layer)
 Sets the vector layer from which to display feature attributes. More...
 
void setWrapString (const QString &wrapString)
 Sets a string to wrap the contents of the table cells by. More...
 
QList< QPair< int, bool > > sortAttributes () const
 Returns the attributes used to sort the table's features. More...
 
ContentSource source () const
 Returns the source for attributes shown in the table body. More...
 
QgsVectorLayersourceLayer ()
 Returns the source layer for the table, considering the table source mode. More...
 
bool uniqueRowsOnly () const
 Returns true if the table is set to show only unique rows. More...
 
QgsVectorLayervectorLayer () const
 Returns the vector layer the attribute table is currently using. More...
 
QString wrapString () const
 Returns the string used to wrap the contents of the table cells by. More...
 
virtual bool writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const override
 Writes properties specific to attribute tables. More...
 
- Public Member Functions inherited from QgsComposerTableV2
 QgsComposerTableV2 (QgsComposition *composition, bool createUndoCommands)
 
 QgsComposerTableV2 ()
 
virtual ~QgsComposerTableV2 ()
 
QColor backgroundColor () const
 Returns the color used for the background of the table. More...
 
double cellMargin () const
 Returns the margin distance between cell borders and their contents. More...
 
const QgsComposerTableStylecellStyle (CellStyleGroup group) const
 Returns the cell style for a cell group. More...
 
QgsComposerTableColumnscolumns ()
 Returns a pointer to the list of QgsComposerTableColumns shown in the table. More...
 
QFont contentFont () const
 Returns the font used to draw text in table body cells. More...
 
QColor contentFontColor () const
 Returns the color used to draw text in table body cells. More...
 
QgsComposerTableContentscontents ()
 Returns the current contents of the table. More...
 
EmptyTableMode emptyTableBehaviour () const
 Returns the behaviour mode for empty tables. More...
 
QString emptyTableMessage () const
 Returns the message for empty tables with no content rows. More...
 
virtual QSizeF fixedFrameSize (const int frameIndex=-1) const override
 Returns the fixed size for a frame, if desired. More...
 
QColor gridColor () const
 Returns the color used for grid lines in the table. More...
 
double gridStrokeWidth () const
 Returns the width of grid lines in the table. More...
 
QFont headerFont () const
 Returns the font used to draw header text in the table. More...
 
QColor headerFontColor () const
 Returns the color used to draw header text in the table. More...
 
HeaderHAlignment headerHAlignment () const
 Returns the horizontal alignment for table headers. More...
 
virtual QMap< int, QStringheaderLabels () const
 Returns the text used in the column headers for the table. More...
 
HeaderMode headerMode () const
 Returns the display mode for headers in the table. More...
 
virtual QSizeF minFrameSize (const int frameIndex=-1) const override
 Returns the minimum size for a frames, if desired. More...
 
virtual void render (QPainter *p, const QRectF &renderExtent, const int frameIndex) override
 Renders a portion of the multiframe's content into a painter. More...
 
void setBackgroundColor (const QColor &color)
 Sets color used for background of table. More...
 
void setCellMargin (const double margin)
 Sets the margin distance between cell borders and their contents. More...
 
void setCellStyle (CellStyleGroup group, const QgsComposerTableStyle &style)
 Sets the cell style for a cell group. More...
 
void setColumns (const QgsComposerTableColumns &columns)
 Replaces the columns in the table with a specified list of QgsComposerTableColumns. More...
 
void setContentFont (const QFont &font)
 Sets the font used to draw text in table body cells. More...
 
void setContentFontColor (const QColor &color)
 Sets the color used to draw text in table body cells. More...
 
void setEmptyTableBehaviour (const EmptyTableMode mode)
 Sets the behaviour for empty tables with no content rows. More...
 
void setEmptyTableMessage (const QString &message)
 Sets the message for empty tables with no content rows. More...
 
void setGridColor (const QColor &color)
 Sets color used for grid lines in the table. More...
 
void setGridStrokeWidth (const double width)
 Sets the width for grid lines in the table. More...
 
void setHeaderFont (const QFont &font)
 Sets the font used to draw header text in the table. More...
 
void setHeaderFontColor (const QColor &color)
 Sets the color used to draw header text in the table. More...
 
void setHeaderHAlignment (const HeaderHAlignment alignment)
 Sets the horizontal alignment for table headers. More...
 
void setHeaderMode (const HeaderMode mode)
 Sets the display mode for headers in the table. More...
 
void setShowEmptyRows (const bool showEmpty)
 Sets whether empty rows should be drawn. More...
 
void setShowGrid (const bool showGrid)
 Sets whether grid lines should be drawn in the table. More...
 
void setWrapBehaviour (WrapBehaviour behaviour)
 Sets the wrap behaviour for the table, which controls how text within cells is automatically wrapped. More...
 
bool showEmptyRows () const
 Returns whether empty rows are drawn in the table. More...
 
bool showGrid () const
 Returns whether grid lines are drawn in the table. More...
 
virtual QSizeF totalSize () const override
 Returns the total size of the multiframe's content. More...
 
WrapBehaviour wrapBehaviour () const
 Returns the wrap behaviour for the table, which controls how text within cells is automatically wrapped. More...
 
- Public Member Functions inherited from QgsComposerMultiFrame
 QgsComposerMultiFrame (QgsComposition *c, bool createUndoCommands)
 Construct a new multiframe item. More...
 
virtual ~QgsComposerMultiFrame ()
 
bool _readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)
 Restores state information about base multiframe object from a DOM element. More...
 
bool _writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const
 Stores state information about base multiframe object in DOM element. More...
 
QgsCompositioncomposition ()
 Returns the parent composition for the multiframe. More...
 
QgsComposerFramecreateNewFrame (QgsComposerFrame *currentFrame, QPointF pos, QSizeF size)
 Creates a new frame and adds it to the multi frame and composition. More...
 
bool createUndoCommands () const
 Returns whether undo commands should be created for interactions with the multiframe. More...
 
void deleteFrames ()
 Removes and deletes all child frames. More...
 
virtual double findNearbyPageBreak (double yPos)
 Finds the optimal position to break a frame at. More...
 
QgsComposerFrameframe (int i) const
 Returns a child frame from the multiframe. More...
 
int frameCount () const
 Returns the number of frames associated with this multiframe. More...
 
int frameIndex (QgsComposerFrame *frame) const
 Returns the index of a frame within the multiframe. More...
 
void removeFrame (int i, const bool removeEmptyPages=false)
 Removes a frame from the multiframe. More...
 
virtual Q_DECL_DEPRECATED void render (QPainter *p, const QRectF &renderExtent)
 Renders a portion of the multiframe's content into a painter. More...
 
ResizeMode resizeMode () const
 Returns the resize mode for the multiframe. More...
 
void setCreateUndoCommands (bool enabled)
 Sets whether undo commands should be created for interactions with the multiframe. More...
 
void setResizeMode (ResizeMode mode)
 Sets the resize mode for the multiframe, and recalculates frame sizes to match. More...
 
- Public Member Functions inherited from QgsComposerObject
 QgsComposerObject (QgsComposition *composition)
 Constructor. More...
 
virtual ~QgsComposerObject ()
 
const QgsCompositioncomposition () const
 Returns the composition the item is attached to. More...
 
QgsCompositioncomposition ()
 
QStringList customProperties () const
 Return list of keys stored in custom properties for the object. More...
 
QVariant customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const
 Read a custom property from the object. More...
 
QgsDataDefineddataDefinedProperty (const DataDefinedProperty property) const
 Returns a reference to the data defined settings for one of the item's data defined properties. More...
 
virtual bool readXML (const QDomElement &itemElem, const QDomDocument &doc)
 Sets item state from DOM element. More...
 
void removeCustomProperty (const QString &key)
 Remove a custom property from the object. More...
 
void setCustomProperty (const QString &key, const QVariant &value)
 Set a custom property for the object. More...
 
void setDataDefinedProperty (const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field)
 Sets parameters for a data defined property for the item. More...
 
virtual bool writeXML (QDomElement &elem, QDomDocument &doc) const
 Stores item state in DOM element. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Additional Inherited Members

- Public Slots inherited from QgsComposerTableV2
void recalculateFrameSizes () override
 
virtual void refreshAttributes ()
 Refreshes the contents shown in the table by querying for new data. More...
 
- Public Slots inherited from QgsComposerMultiFrame
void recalculateFrameRects ()
 Forces a recalculation of all the associated frame's scene rectangles. More...
 
virtual void recalculateFrameSizes ()
 Recalculates the portion of the multiframe item which is shown in each of it's component frames. More...
 
void update ()
 Forces a redraw of all child frames. More...
 
- Public Slots inherited from QgsComposerObject
virtual void refreshDataDefinedProperty (const DataDefinedProperty property=AllProperties, const QgsExpressionContext *context=nullptr)
 Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value. More...
 
virtual void repaint ()
 Triggers a redraw for the item. More...
 
- Signals inherited from QgsComposerMultiFrame
void changed ()
 Emitted when the properties of a multi frame have changed, and the GUI item widget must be updated. More...
 
void contentsChanged ()
 Emitted when the contents of the multi frame have changed and the frames must be redrawn. More...
 
- Signals inherited from QgsComposerObject
void itemChanged ()
 Emitted when the item changes. More...
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Slots inherited from QgsComposerMultiFrame
void handleFrameRemoval (QgsComposerItem *item)
 Called before a frame is going to be removed. More...
 
void handlePageChange ()
 Adapts to changed number of composition pages if resize type is RepeatOnEveryPage. More...
 
- Protected Member Functions inherited from QgsComposerTableV2
virtual bool calculateMaxColumnWidths ()
 Calculates the maximum width of text shown in columns. More...
 
virtual bool calculateMaxRowHeights ()
 Calculates the maximum height of text shown in rows. More...
 
bool contentsContainsRow (const QgsComposerTableContents &contents, const QgsComposerTableRow &row) const
 Checks whether a table contents contains a given row. More...
 
void drawHorizontalGridLines (QPainter *painter, int firstRow, int lastRow, bool drawHeaderLines) const
 Draws the horizontal grid lines for the table. More...
 
Q_DECL_DEPRECATED void drawHorizontalGridLines (QPainter *painter, const int rows, const bool drawHeaderLines) const
 Draws the horizontal grid lines for the table. More...
 
void drawVerticalGridLines (QPainter *painter, const QMap< int, double > &maxWidthMap, int firstRow, int lastRow, bool hasHeader, bool mergeCells=false) const
 Draws the vertical grid lines for the table. More...
 
Q_DECL_DEPRECATED void drawVerticalGridLines (QPainter *painter, const QMap< int, double > &maxWidthMap, const int numberRows, const bool hasHeader, const bool mergeCells=false) const
 Draws the vertical grid lines for the table. More...
 
void recalculateTableSize ()
 Recalculates and updates the size of the table and all table frames. More...
 
QPair< int, int > rowRange (const int frameIndex) const
 Calculates a range of rows which should be visible in a given frame. More...
 
Q_DECL_DEPRECATED QPair< int, int > rowRange (const QRectF &extent, const int frameIndex) const
 Calculates a range of rows which should be visible in a given frame extent. More...
 
int rowsVisible (double frameHeight, int firstRow, bool includeHeader, bool includeEmptyRows) const
 Calculates how many content rows would be visible within a frame of the specified height. More...
 
int rowsVisible (int frameIndex, int firstRow, bool includeEmptyRows) const
 Calculates how many content rows are visible within a given frame. More...
 
Q_DECL_DEPRECATED int rowsVisible (const int frameIndex) const
 Calculates how many content rows are visible within a given frame. More...
 
Q_DECL_DEPRECATED int rowsVisible (const double frameHeight, const bool includeHeader) const
 Calculates how many content rows would be visible within a specified height. More...
 
double totalHeight ()
 Returns total height of table contents. More...
 
double totalWidth ()
 Returns total width of table contents. More...
 
- Protected Member Functions inherited from QgsComposerObject
bool dataDefinedEvaluate (const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue, const QgsExpressionContext &context=QgsExpressionContext()) const
 Evaluate a data defined property and return the calculated value. More...
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Protected Attributes inherited from QgsComposerTableV2
QColor mBackgroundColor
 Color for table background. More...
 
double mCellMargin
 Margin between cell borders and cell text. More...
 
QMap< CellStyleGroup, QgsComposerTableStyle *> mCellStyles
 
QgsComposerTableColumns mColumns
 Columns to show in table. More...
 
QFont mContentFont
 Table contents font. More...
 
QColor mContentFontColor
 Table contents font color. More...
 
QString mEmptyTableMessage
 String to show in empty tables. More...
 
EmptyTableMode mEmptyTableMode
 Behaviour for empty tables. More...
 
QColor mGridColor
 Color for grid lines. More...
 
double mGridStrokeWidth
 Width of grid lines. More...
 
QFont mHeaderFont
 Header font. More...
 
QColor mHeaderFontColor
 Header font color. More...
 
HeaderHAlignment mHeaderHAlignment
 Alignment for table headers. More...
 
HeaderMode mHeaderMode
 Header display mode. More...
 
QMap< int, double > mMaxColumnWidthMap
 Map of maximum width for each column. More...
 
QMap< int, double > mMaxRowHeightMap
 Map of maximum height for each row. More...
 
bool mShowEmptyRows
 True if empty rows should be shown in the table. More...
 
bool mShowGrid
 True if grid should be shown. More...
 
QgsComposerTableContents mTableContents
 Contents to show in table. More...
 
QSizeF mTableSize
 
WrapBehaviour mWrapBehaviour
 
- Protected Attributes inherited from QgsComposerMultiFrame
bool mCreateUndoCommands
 True: creates QgsMultiFrameCommands on internal changes (e.g. More...
 
QList< QgsComposerFrame * > mFrameItems
 
ResizeMode mResizeMode
 
- Protected Attributes inherited from QgsComposerObject
QgsCompositionmComposition
 
QgsObjectCustomProperties mCustomProperties
 Custom properties for object. More...
 
QMap< QgsComposerObject::DataDefinedProperty, QStringmDataDefinedNames
 Map of data defined properties for the item to string name to use when exporting item to xml. More...
 
- Properties inherited from QObject
 objectName
 

Detailed Description

A table that displays attributes from a vector layer.

Definition at line 56 of file qgscomposerattributetablev2.h.

Member Enumeration Documentation

◆ ContentSource

Specifies the content source for the attribute table.

Enumerator
LayerAttributes 

table shows attributes from features in a vector layer

AtlasFeature 

table shows attributes from the current atlas feature

RelationChildren 

table shows attributes from related child features

Definition at line 64 of file qgscomposerattributetablev2.h.

Constructor & Destructor Documentation

◆ QgsComposerAttributeTableV2()

QgsComposerAttributeTableV2::QgsComposerAttributeTableV2 ( QgsComposition composition,
bool  createUndoCommands 
)

Definition at line 49 of file qgscomposerattributetablev2.cpp.

◆ ~QgsComposerAttributeTableV2()

QgsComposerAttributeTableV2::~QgsComposerAttributeTableV2 ( )

Definition at line 95 of file qgscomposerattributetablev2.cpp.

Member Function Documentation

◆ addFrame()

void QgsComposerAttributeTableV2::addFrame ( QgsComposerFrame frame,
bool  recalcFrameSizes = true 
)
overridevirtual

Adds a frame to the multiframe.

Parameters
frameframe to add
recalcFrameSizesset to true to force recalculation of all existing frame sizes
See also
removeFrame

Implements QgsComposerMultiFrame.

Definition at line 799 of file qgscomposerattributetablev2.cpp.

◆ composerMap()

const QgsComposerMap* QgsComposerAttributeTableV2::composerMap ( ) const
inline

Returns the composer map whose extents are controlling the features shown in the table.

The extents of the map are only used if displayOnlyVisibleFeatures() is true.

Returns
composer map controlling the attribute table
See also
setComposerMap
displayOnlyVisibleFeatures

Definition at line 164 of file qgscomposerattributetablev2.h.

◆ createExpressionContext()

QgsExpressionContext * QgsComposerAttributeTableV2::createExpressionContext ( ) const
overridevirtual

Creates an expression context relating to the objects' current state.

The context includes scopes for global, project and composition properties.

Note
added in QGIS 2.12

Reimplemented from QgsComposerObject.

Definition at line 587 of file qgscomposerattributetablev2.cpp.

◆ displayName()

QString QgsComposerAttributeTableV2::displayName ( ) const
overridevirtual

Get multiframe display name.

Returns
display name for item
Note
added in version 2.5

Reimplemented from QgsComposerMultiFrame.

Definition at line 99 of file qgscomposerattributetablev2.cpp.

◆ displayOnlyVisibleFeatures()

bool QgsComposerAttributeTableV2::displayOnlyVisibleFeatures ( ) const
inline

Returns true if the table is set to show only features visible on a corresponding composer map item.

Returns
true if table only shows visible features
See also
composerMap
setDisplayOnlyVisibleFeatures

Definition at line 209 of file qgscomposerattributetablev2.h.

◆ featureFilter()

QString QgsComposerAttributeTableV2::featureFilter ( ) const
inline

Returns the current expression used to filter features for the table.

The filter is only active if filterFeatures() is true.

Returns
feature filter expression
See also
setFeatureFilter
filterFeatures

Definition at line 248 of file qgscomposerattributetablev2.h.

◆ filterFeatures()

bool QgsComposerAttributeTableV2::filterFeatures ( ) const
inline

Returns true if a feature filter is active on the attribute table.

Returns
bool state of the feature filter
See also
setFilterFeatures
featureFilter

Definition at line 231 of file qgscomposerattributetablev2.h.

◆ filterToAtlasFeature()

bool QgsComposerAttributeTableV2::filterToAtlasFeature ( ) const
inline

Returns true if the table is set to only show features which intersect the current atlas feature.

Returns
true if table only shows features which intersect the atlas feature
See also
setFilterToAtlasFeature

Definition at line 224 of file qgscomposerattributetablev2.h.

◆ getTableContents()

bool QgsComposerAttributeTableV2::getTableContents ( QgsComposerTableContents contents)
overridevirtual

Queries the attribute table's vector layer for attributes to show in the table.

Parameters
contentstable content
Returns
true if attributes were successfully fetched
Note
not available in python bindings

Implements QgsComposerTableV2.

Definition at line 436 of file qgscomposerattributetablev2.cpp.

◆ maximumNumberOfFeatures()

int QgsComposerAttributeTableV2::maximumNumberOfFeatures ( ) const
inline

Returns the maximum number of features to be shown by the table.

Returns
maximum number of features
See also
setMaximumNumberOfFeatures

Definition at line 178 of file qgscomposerattributetablev2.h.

◆ readXML()

bool QgsComposerAttributeTableV2::readXML ( const QDomElement itemElem,
const QDomDocument doc,
bool  ignoreFrames = false 
)
overridevirtual

Reads the properties specific to an attribute table from xml.

Parameters
itemElema QDomElement holding the attribute table's desired properties.
docQDomDocument for the source xml.
ignoreFramesignore frames
See also
writeXML

Reimplemented from QgsComposerTableV2.

Definition at line 724 of file qgscomposerattributetablev2.cpp.

◆ relationId()

QString QgsComposerAttributeTableV2::relationId ( ) const
inline

Returns the relation id which the table displays child features from.

Returns
relation id
See also
setRelationId
source
Note
only used if table source is set to RelationChildren

Definition at line 140 of file qgscomposerattributetablev2.h.

◆ resetColumns()

void QgsComposerAttributeTableV2::resetColumns ( )

Resets the attribute table's columns to match the vector layer's fields.

See also
setVectorLayer

Definition at line 191 of file qgscomposerattributetablev2.cpp.

◆ setComposerMap()

void QgsComposerAttributeTableV2::setComposerMap ( const QgsComposerMap map)

Sets the composer map to use to limit the extent of features shown in the attribute table.

This setting only has an effect if setDisplayOnlyVisibleFeatures is set to true. Changing the composer map forces the table to refetch features from its vector layer, and may result in the table changing size to accommodate the new displayed feature attributes.

Parameters
mapQgsComposerMap which drives the extents of the table's features
See also
composerMap
setDisplayOnlyVisibleFeatures

Definition at line 216 of file qgscomposerattributetablev2.cpp.

◆ setDisplayAttributes()

void QgsComposerAttributeTableV2::setDisplayAttributes ( const QSet< int > &  attr,
bool  refresh = true 
)

Sets the attributes to display in the table.

Parameters
attrQSet of integer values referring to the attributes from the vector layer to show. Set to an empty QSet to show all feature attributes.
refreshset to true to force the table to refetch features from its vector layer and immediately update the display of the table. This may result in the table changing size to accommodate the new displayed feature attributes.
Deprecated:
use setDisplayedFields() instead

Definition at line 311 of file qgscomposerattributetablev2.cpp.

◆ setDisplayedFields()

void QgsComposerAttributeTableV2::setDisplayedFields ( const QStringList fields,
bool  refresh = true 
)

Sets the attributes to display in the table.

Parameters
fieldslist of fields names from the vector layer to show. Set to an empty list to show all feature attributes.
refreshset to true to force the table to refetch features from its vector layer and immediately update the display of the table. This may result in the table changing size to accommodate the new displayed feature attributes.
Note
added in QGIS 2.16

Definition at line 363 of file qgscomposerattributetablev2.cpp.

◆ setDisplayOnlyVisibleFeatures()

void QgsComposerAttributeTableV2::setDisplayOnlyVisibleFeatures ( const bool  visibleOnly)

Sets attribute table to only show features which are visible in a composer map item.

Changing this setting forces the table to refetch features from its vector layer, and may result in the table changing size to accommodate the new displayed feature attributes.

Parameters
visibleOnlyset to true to show only visible features
See also
displayOnlyVisibleFeatures
setComposerMap

Definition at line 263 of file qgscomposerattributetablev2.cpp.

◆ setFeatureFilter()

void QgsComposerAttributeTableV2::setFeatureFilter ( const QString expression)

Sets the expression used for filtering features in the table.

The filter is only active if filterFeatures() is set to true. Changing this setting forces the table to refetch features from its vector layer, and may result in the table changing size to accommodate the new displayed feature attributes.

Parameters
expressionfilter to use for selecting which features to display in the table
See also
featureFilter
setFilterFeatures

Definition at line 299 of file qgscomposerattributetablev2.cpp.

◆ setFilterFeatures()

void QgsComposerAttributeTableV2::setFilterFeatures ( const bool  filter)

Sets whether the feature filter is active for the attribute table.

Changing this setting forces the table to refetch features from its vector layer, and may result in the table changing size to accommodate the new displayed feature attributes.

Parameters
filterSet to true to enable the feature filter
See also
filterFeatures
setFeatureFilter

Definition at line 287 of file qgscomposerattributetablev2.cpp.

◆ setFilterToAtlasFeature()

void QgsComposerAttributeTableV2::setFilterToAtlasFeature ( const bool  filterToAtlas)

Sets attribute table to only show features which intersect the current atlas feature.

Parameters
filterToAtlasset to true to show only features which intersect the atlas feature
See also
filterToAtlasFeature

Definition at line 275 of file qgscomposerattributetablev2.cpp.

◆ setMaximumNumberOfFeatures()

void QgsComposerAttributeTableV2::setMaximumNumberOfFeatures ( const int  features)

Sets the maximum number of features shown by the table.

Changing this setting may result in the attribute table changing its size to accommodate the new number of rows, and requires the table to refetch features from its vector layer.

Parameters
featuresmaximum number of features to show in the table
See also
maximumNumberOfFeatures

Definition at line 239 of file qgscomposerattributetablev2.cpp.

◆ setRelationId()

void QgsComposerAttributeTableV2::setRelationId ( const QString relationId)

Sets the relation id from which to display child features.

Parameters
relationIdid for relation to display child features from
See also
relationId
setSource
Note
only used if table source is set to RelationChildren

Definition at line 134 of file qgscomposerattributetablev2.cpp.

◆ setSource()

void QgsComposerAttributeTableV2::setSource ( const ContentSource  source)

Sets the source for attributes to show in table body.

Parameters
sourcecontent source
See also
source

Definition at line 814 of file qgscomposerattributetablev2.cpp.

◆ setUniqueRowsOnly()

void QgsComposerAttributeTableV2::setUniqueRowsOnly ( const bool  uniqueOnly)

Sets attribute table to only show unique rows.

Parameters
uniqueOnlyset to true to show only unique rows. Duplicate rows will be stripped from the table.
See also
uniqueRowsOnly

Definition at line 251 of file qgscomposerattributetablev2.cpp.

◆ setVectorLayer()

void QgsComposerAttributeTableV2::setVectorLayer ( QgsVectorLayer layer)

Sets the vector layer from which to display feature attributes.

Parameters
layerVector layer for attribute table
See also
vectorLayer

Definition at line 104 of file qgscomposerattributetablev2.cpp.

◆ setWrapString()

void QgsComposerAttributeTableV2::setWrapString ( const QString wrapString)

Sets a string to wrap the contents of the table cells by.

Occurances of this string will be replaced by a line break.

Parameters
wrapStringstring to replace with line break
Note
added in QGIS 2.12
See also
wrapString

Definition at line 676 of file qgscomposerattributetablev2.cpp.

◆ sortAttributes()

QList< QPair< int, bool > > QgsComposerAttributeTableV2::sortAttributes ( ) const

Returns the attributes used to sort the table's features.

Returns
a QList of integer/bool pairs, where the integer refers to the attribute index and the bool to the sort order for the attribute. If true the attribute is sorted ascending, if false, the attribute is sorted in descending order.
Note
not available in python bindings

Definition at line 646 of file qgscomposerattributetablev2.cpp.

◆ source()

ContentSource QgsComposerAttributeTableV2::source ( ) const
inline

Returns the source for attributes shown in the table body.

Returns
content source
See also
setSource

Definition at line 104 of file qgscomposerattributetablev2.h.

◆ sourceLayer()

QgsVectorLayer * QgsComposerAttributeTableV2::sourceLayer ( )

Returns the source layer for the table, considering the table source mode.

Eg, if the table is set to atlas feature mode, then the source layer will be the atlas coverage layer. If the table is set to layer attributes mode, then the source layer will be the user specified vector layer.

Returns
actual source layer

Definition at line 610 of file qgscomposerattributetablev2.cpp.

◆ uniqueRowsOnly()

bool QgsComposerAttributeTableV2::uniqueRowsOnly ( ) const
inline

Returns true if the table is set to show only unique rows.

Returns
true if table only shows unique rows and is stripping out duplicate rows.
See also
setUniqueRowsOnly

Definition at line 192 of file qgscomposerattributetablev2.h.

◆ vectorLayer()

QgsVectorLayer* QgsComposerAttributeTableV2::vectorLayer ( ) const
inline

Returns the vector layer the attribute table is currently using.

Returns
attribute table's current vector layer
See also
setVectorLayer

Definition at line 124 of file qgscomposerattributetablev2.h.

◆ wrapString()

QString QgsComposerAttributeTableV2::wrapString ( ) const
inline

Returns the string used to wrap the contents of the table cells by.

Occurances of this string will be replaced by a line break.

Returns
string which will be replaced with line break
Note
added in QGIS 2.12
See also
setWrapString

Definition at line 302 of file qgscomposerattributetablev2.h.

◆ writeXML()

bool QgsComposerAttributeTableV2::writeXML ( QDomElement elem,
QDomDocument doc,
bool  ignoreFrames = false 
) const
overridevirtual

Writes properties specific to attribute tables.

Parameters
eleman existing QDomElement in which to store the attribute table's properties.
docQDomDocument for the destination xml.
ignoreFramesignore frames
See also
readXML

Reimplemented from QgsComposerTableV2.

Definition at line 688 of file qgscomposerattributetablev2.cpp.


The documentation for this class was generated from the following files: