|
QGIS API Documentation
2.6.0-Brighton
|
A class to display a table in the print composer, and allow the table to span over multiple frames. More...
#include <qgscomposertablev2.h>

Public Slots | |
| virtual void | refreshAttributes () |
| Refreshes the contents shown in the table by querying for new data. | |
| void | recalculateFrameSizes () |
Public Slots inherited from QgsComposerMultiFrame | |
| void | update () |
| Forces a redraw of all child frames. | |
| virtual void | recalculateFrameSizes () |
| Recalculates the portion of the multiframe item which is shown in each of it's component frames. | |
| void | recalculateFrameRects () |
| Forces a recalculation of all the associated frame's scene rectangles. | |
Public Slots inherited from QgsComposerObject | |
| virtual void | repaint () |
| Triggers a redraw for the item. | |
| virtual void | refreshDataDefinedProperty (const DataDefinedProperty property=AllProperties) |
| Refreshes a data defined property for the item by reevaluating the property's value and redrawing the item with this new value. | |
Public Member Functions | |
| QgsComposerTableV2 (QgsComposition *composition, bool createUndoCommands) | |
| QgsComposerTableV2 () | |
| virtual | ~QgsComposerTableV2 () |
| void | setCellMargin (const double margin) |
| Sets the margin distance between cell borders and their contents. | |
| double | cellMargin () const |
| Returns the margin distance between cell borders and their contents. | |
| void | setEmptyTableBehaviour (const EmptyTableMode mode) |
| Sets the behaviour for empty tables with no content rows. | |
| EmptyTableMode | emptyTableBehaviour () const |
| Returns the behaviour mode for empty tables. | |
| void | setEmptyTableMessage (const QString message) |
| Sets the message for empty tables with no content rows. | |
| QString | emptyTableMessage () const |
| Returns the message for empty tables with no content rows. | |
| void | setShowEmptyRows (const bool showEmpty) |
| Sets whether empty rows should be drawn. | |
| bool | showEmptyRows () const |
| Returns whether empty rows are drawn in the table. | |
| void | setHeaderFont (const QFont &font) |
| Sets the font used to draw header text in the table. | |
| QFont | headerFont () const |
| Returns the font used to draw header text in the table. | |
| void | setHeaderFontColor (const QColor &color) |
| Sets the color used to draw header text in the table. | |
| QColor | headerFontColor () const |
| Returns the color used to draw header text in the table. | |
| void | setHeaderHAlignment (const HeaderHAlignment alignment) |
| Sets the horizontal alignment for table headers. | |
| HeaderHAlignment | headerHAlignment () const |
| Returns the horizontal alignment for table headers. | |
| void | setHeaderMode (const HeaderMode mode) |
| Sets the display mode for headers in the table. | |
| HeaderMode | headerMode () const |
| Returns the display mode for headers in the table. | |
| void | setContentFont (const QFont &font) |
| Sets the font used to draw text in table body cells. | |
| QFont | contentFont () const |
| Returns the font used to draw text in table body cells. | |
| void | setContentFontColor (const QColor &color) |
| Sets the color used to draw text in table body cells. | |
| QColor | contentFontColor () const |
| Returns the color used to draw text in table body cells. | |
| void | setShowGrid (const bool showGrid) |
| Sets whether grid lines should be drawn in the table. | |
| bool | showGrid () const |
| Returns whether grid lines are drawn in the table. | |
| void | setGridStrokeWidth (const double width) |
| Sets the width for grid lines in the table. | |
| double | gridStrokeWidth () const |
| Returns the width of grid lines in the table. | |
| void | setGridColor (const QColor &color) |
| Sets color used for grid lines in the table. | |
| QColor | gridColor () const |
| Returns the color used for grid lines in the table. | |
| void | setBackgroundColor (const QColor &color) |
| Sets color used for background of table. | |
| QColor | backgroundColor () const |
| Returns the color used for the background of the table. | |
| QgsComposerTableColumns * | columns () |
| Returns a pointer to the list of QgsComposerTableColumns shown in the table. | |
| void | setColumns (QgsComposerTableColumns columns) |
| Replaces the columns in the table with a specified list of QgsComposerTableColumns. | |
| virtual QMap< int, QString > | headerLabels () const |
| Returns the text used in the column headers for the table. | |
| virtual bool | getTableContents (QgsComposerTableContents &contents)=0 |
| Fetches the contents used for the cells in the table. | |
| QgsComposerTableContents * | contents () |
| Returns the current contents of the table. | |
| virtual QSizeF | fixedFrameSize (const int frameIndex=-1) const |
| Returns the fixed size for a frame, if desired. | |
| virtual QSizeF | minFrameSize (const int frameIndex=-1) const |
| Returns the minimum size for a frames, if desired. | |
| virtual bool | writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const |
| Stores state information about multiframe in DOM element. | |
| virtual bool | readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) |
| Reads multiframe state information from a DOM element. | |
| virtual QSizeF | totalSize () const |
| Returns the total size of the multiframe's content. | |
| virtual void | render (QPainter *p, const QRectF &renderExtent, const int frameIndex) |
| Renders a portion of the multiframe's content into a painter. | |
Public Member Functions inherited from QgsComposerMultiFrame | |
| QgsComposerMultiFrame (QgsComposition *c, bool createUndoCommands) | |
| Construct a new multiframe item. | |
| virtual | ~QgsComposerMultiFrame () |
| virtual Q_DECL_DEPRECATED void | render (QPainter *p, const QRectF &renderExtent) |
| Renders a portion of the multiframe's content into a painter. | |
| virtual void | addFrame (QgsComposerFrame *frame, bool recalcFrameSizes=true)=0 |
| Adds a frame to the multiframe. | |
| virtual double | findNearbyPageBreak (double yPos) |
| Finds the optimal position to break a frame at. | |
| void | removeFrame (int i, const bool removeEmptyPages=false) |
| Removes a frame from the multiframe. | |
| void | deleteFrames () |
| Removes and deletes all child frames. | |
| void | setResizeMode (ResizeMode mode) |
| Sets the resize mode for the multiframe, and recalculates frame sizes to match. | |
| ResizeMode | resizeMode () const |
| Returns the resize mode for the multiframe. | |
| bool | _writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const |
| Stores state information about base multiframe object in DOM element. | |
| bool | _readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) |
| Restores state information about base multiframe object from a DOM element. | |
| QgsComposition * | composition () |
| Returns the parent composition for the multiframe. | |
| bool | createUndoCommands () const |
| Returns whether undo commands should be created for interactions with the multiframe. | |
| void | setCreateUndoCommands (bool enabled) |
| Sets whether undo commands should be created for interactions with the multiframe. | |
| int | frameCount () const |
| Returns the number of frames associated with this multiframe. | |
| QgsComposerFrame * | frame (int i) const |
| Returns a child frame from the multiframe. | |
| int | frameIndex (QgsComposerFrame *frame) const |
| Returns the index of a frame within the multiframe. | |
| QgsComposerFrame * | createNewFrame (QgsComposerFrame *currentFrame, QPointF pos, QSizeF size) |
| Creates a new frame and adds it to the multi frame and composition. | |
| virtual QString | displayName () const |
| Get multiframe display name. | |
Public Member Functions inherited from QgsComposerObject | |
| QgsComposerObject (QgsComposition *composition) | |
| Constructor. | |
| virtual | ~QgsComposerObject () |
| const QgsComposition * | composition () const |
| Returns the composition the item is attached to. | |
| virtual bool | writeXML (QDomElement &elem, QDomDocument &doc) const |
| Stores item state in DOM element. | |
| virtual bool | readXML (const QDomElement &itemElem, const QDomDocument &doc) |
| Sets item state from DOM element. | |
| QgsDataDefined * | dataDefinedProperty (const DataDefinedProperty property) const |
| Returns a reference to the data defined settings for one of the item's data defined properties. | |
| 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. | |
Protected Member Functions | |
| virtual bool | calculateMaxColumnWidths () |
| Calculates the maximum width of text shown in columns. | |
| double | totalWidth () |
| Returns total width of table contents. | |
| double | totalHeight () const |
| Returns total height of table contents. | |
| int | rowsVisible (const int frameIndex) const |
| Calculates how many content rows are visible within a given frame. | |
| int | rowsVisible (const double frameHeight, const bool includeHeader) const |
| Calculates how many content rows would be visible within a specified height. | |
| 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. | |
| void | drawHorizontalGridLines (QPainter *painter, const int rows, const bool drawHeaderLines) const |
| Draws the horizontal grid lines for the table. | |
| 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. | |
| void | recalculateTableSize () |
| Recalculates and updates the size of the table and all table frames. | |
| bool | contentsContainsRow (const QgsComposerTableContents &contents, const QgsComposerTableRow &row) const |
| Checks whether a table contents contains a given row. | |
Protected Attributes | |
| double | mCellMargin |
| Margin between cell borders and cell text. | |
| EmptyTableMode | mEmptyTableMode |
| Behaviour for empty tables. | |
| QString | mEmptyTableMessage |
| String to show in empty tables. | |
| bool | mShowEmptyRows |
| True if empty rows should be shown in the table. | |
| QFont | mHeaderFont |
| Header font. | |
| QColor | mHeaderFontColor |
| Header font color. | |
| HeaderHAlignment | mHeaderHAlignment |
| Alignment for table headers. | |
| HeaderMode | mHeaderMode |
| Header display mode. | |
| QFont | mContentFont |
| Table contents font. | |
| QColor | mContentFontColor |
| Table contents font color. | |
| bool | mShowGrid |
| True if grid should be shown. | |
| double | mGridStrokeWidth |
| Width of grid lines. | |
| QColor | mGridColor |
| Color for grid lines. | |
| QColor | mBackgroundColor |
| Color for table background. | |
| QgsComposerTableColumns | mColumns |
| Columns to show in table. | |
| QgsComposerTableContents | mTableContents |
| Contents to show in table. | |
| QMap< int, double > | mMaxColumnWidthMap |
| Map of maximum width for each column. | |
| QSizeF | mTableSize |
Protected Attributes inherited from QgsComposerMultiFrame | |
| QList< QgsComposerFrame * > | mFrameItems |
| ResizeMode | mResizeMode |
| bool | mCreateUndoCommands |
| True: creates QgsMultiFrameCommands on internal changes (e.g. | |
Protected Attributes inherited from QgsComposerObject | |
| QgsComposition * | mComposition |
| QMap < QgsComposerObject::DataDefinedProperty, QString > | mDataDefinedNames |
| Map of data defined properties for the item to string name to use when exporting item to xml. | |
Friends | |
| class | TestQgsComposerTableV2 |
Additional Inherited Members | |
Signals inherited from QgsComposerMultiFrame | |
| void | changed () |
| Emitted when the properties of a multi frame have changed, and the GUI item widget must be updated. | |
| void | contentsChanged () |
| Emitted when the contents of the multi frame have changed and the frames must be redrawn. | |
Protected Slots inherited from QgsComposerMultiFrame | |
| void | handleFrameRemoval (QgsComposerItem *item) |
| Called before a frame is going to be removed. | |
| void | handlePageChange () |
| Adapts to changed number of composition pages if resize type is RepeatOnEveryPage. | |
A class to display a table in the print composer, and allow the table to span over multiple frames.
| QgsComposerTableV2::QgsComposerTableV2 | ( | QgsComposition * | composition, |
| bool | createUndoCommands | ||
| ) |
| QgsComposerTableV2::QgsComposerTableV2 | ( | ) |
|
virtual |
|
inline |
Returns the color used for the background of the table.
|
protectedvirtual |
Calculates the maximum width of text shown in columns.
|
inline |
Returns the margin distance between cell borders and their contents.
|
inline |
Returns a pointer to the list of QgsComposerTableColumns shown in the table.
|
inline |
Returns the font used to draw text in table body cells.
|
inline |
Returns the color used to draw text in table body cells.
|
inline |
Returns the current contents of the table.
Excludes header cells.
|
protected |
Checks whether a table contents contains a given row.
| contents | table contents to check |
| row | row to check for |
|
protected |
Draws the horizontal grid lines for the table.
| painter | destination painter for grid lines |
| rows | number of rows shown in table |
| drawHeaderLines | set to true to include for the table header |
|
protected |
Draws the vertical grid lines for the table.
| painter | destination painter for grid lines |
| maxWidthMap | QMap of int to double, where the int contains the column number and the double is the maximum width of text present in the column. |
| numberRows | number of rows of content in table frame |
| hasHeader | set to true if table frame includes header cells |
| mergeCells | set to true to merge table content cells |
|
inline |
Returns the behaviour mode for empty tables.
This property controls how the table is drawn if it contains no content rows.
|
inline |
Returns the message for empty tables with no content rows.
This message is displayed in the table body if the empty table behaviour is set to ShowMessage
|
virtual |
Returns the fixed size for a frame, if desired.
If the fixed frame size changes, the sizes of all frames can be recalculated by calling recalculateFrameRects().
| frameIndex | frame number |
Reimplemented from QgsComposerMultiFrame.
|
pure virtual |
Fetches the contents used for the cells in the table.
| contents | QgsComposerTableContents to store retrieved row data in |
Implemented in QgsComposerAttributeTableV2.
|
inline |
Returns the color used for grid lines in the table.
|
inline |
Returns the width of grid lines in the table.
|
inline |
Returns the font used to draw header text in the table.
|
inline |
Returns the color used to draw header text in the table.
|
inline |
Returns the horizontal alignment for table headers.
|
virtual |
Returns the text used in the column headers for the table.
|
inline |
Returns the display mode for headers in the table.
This property controls if and where headers are shown in the table.
|
virtual |
Returns the minimum size for a frames, if desired.
If the minimum size changes, the sizes of all frames can be recalculated by calling recalculateFrameRects().
| frameIndex | frame number |
Reimplemented from QgsComposerMultiFrame.
|
virtual |
Reads multiframe state information from a DOM element.
Implementations of readXML should also call the _readXML method to restore general multiframe properties.
| itemElem | is DOM element |
| doc | is the DOM document |
| ignoreFrames | set to false to avoid read state information about child frames from DOM |
Implements QgsComposerMultiFrame.
Reimplemented in QgsComposerAttributeTableV2.
|
slot |
|
protected |
Recalculates and updates the size of the table and all table frames.
|
virtualslot |
Refreshes the contents shown in the table by querying for new data.
This also causes the column widths and size of the table to change to accommodate the new data.
|
virtual |
Renders a portion of the multiframe's content into a painter.
| painter | destination painter |
| renderExtent | visible extent of content to render into the painter. |
| frameIndex | frame number for content |
Reimplemented from QgsComposerMultiFrame.
|
protected |
Calculates a range of rows which should be visible in a given frame extent.
| extent | visible extent |
| frameIndex | index number for frame |
|
protected |
Calculates how many content rows are visible within a given frame.
| frameIndex | index number for frame |
|
protected |
Calculates how many content rows would be visible within a specified height.
| frameHeight | height of frame |
| includeHeader | set to true if frame would include a header row |
| void QgsComposerTableV2::setBackgroundColor | ( | const QColor & | color | ) |
Sets color used for background of table.
| color | table background color |
| void QgsComposerTableV2::setCellMargin | ( | const double | margin | ) |
Sets the margin distance between cell borders and their contents.
| margin | margin for cell contents |
| void QgsComposerTableV2::setColumns | ( | QgsComposerTableColumns | columns | ) |
Replaces the columns in the table with a specified list of QgsComposerTableColumns.
| columns | list of QgsComposerTableColumns to show in table |
| void QgsComposerTableV2::setContentFont | ( | const QFont & | font | ) |
Sets the font used to draw text in table body cells.
| font | font for table cells |
| void QgsComposerTableV2::setContentFontColor | ( | const QColor & | color | ) |
Sets the color used to draw text in table body cells.
| color | table cell text color |
| void QgsComposerTableV2::setEmptyTableBehaviour | ( | const EmptyTableMode | mode | ) |
Sets the behaviour for empty tables with no content rows.
| mode | behaviour mode for empty tables |
| void QgsComposerTableV2::setEmptyTableMessage | ( | const QString | message | ) |
Sets the message for empty tables with no content rows.
This message is displayed in the table body if the empty table behaviour is set to ShowMessage
| message | message to show for empty tables |
| void QgsComposerTableV2::setGridColor | ( | const QColor & | color | ) |
Sets color used for grid lines in the table.
| color | grid line color |
| void QgsComposerTableV2::setGridStrokeWidth | ( | const double | width | ) |
Sets the width for grid lines in the table.
| width | grid line width |
| void QgsComposerTableV2::setHeaderFont | ( | const QFont & | font | ) |
Sets the font used to draw header text in the table.
| font | font for header cells |
| void QgsComposerTableV2::setHeaderFontColor | ( | const QColor & | color | ) |
Sets the color used to draw header text in the table.
| color | header text color |
| void QgsComposerTableV2::setHeaderHAlignment | ( | const HeaderHAlignment | alignment | ) |
Sets the horizontal alignment for table headers.
| alignment | Horizontal alignment for table header cells |
| void QgsComposerTableV2::setHeaderMode | ( | const HeaderMode | mode | ) |
Sets the display mode for headers in the table.
This property controls if and where headers are shown in the table.
| mode | display mode for headers |
| void QgsComposerTableV2::setShowEmptyRows | ( | const bool | showEmpty | ) |
Sets whether empty rows should be drawn.
Tables default to hiding empty rows.
| showEmpty | set to true to show empty rows in the table |
| void QgsComposerTableV2::setShowGrid | ( | const bool | showGrid | ) |
Sets whether grid lines should be drawn in the table.
| showGrid | set to true to show grid lines |
|
inline |
Returns whether empty rows are drawn in the table.
|
inline |
Returns whether grid lines are drawn in the table.
|
protected |
|
virtual |
Returns the total size of the multiframe's content.
Implements QgsComposerMultiFrame.
|
protected |
|
virtual |
Stores state information about multiframe in DOM element.
Implementations of writeXML should also call the _writeXML method to save general multiframe properties.
| elem | is DOM element |
| doc | is the DOM document |
| ignoreFrames | set to false to avoid writing state information about child frames into DOM |
Implements QgsComposerMultiFrame.
Reimplemented in QgsComposerAttributeTableV2.
|
friend |
|
protected |
Color for table background.
|
protected |
Margin between cell borders and cell text.
|
protected |
Columns to show in table.
|
protected |
Table contents font.
|
protected |
Table contents font color.
|
protected |
String to show in empty tables.
|
protected |
Behaviour for empty tables.
|
protected |
Color for grid lines.
|
protected |
Width of grid lines.
|
protected |
Header font.
|
protected |
Header font color.
|
protected |
Alignment for table headers.
|
protected |
Header display mode.
|
protected |
Map of maximum width for each column.
|
protected |
True if empty rows should be shown in the table.
|
protected |
True if grid should be shown.
|
protected |
Contents to show in table.
|
protected |
1.8.1.2