QGIS API Documentation
2.8.2-Wien
|
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 | |
void | recalculateFrameSizes () override |
virtual void | refreshAttributes () |
Refreshes the contents shown in the table by querying for new data. | |
Public Slots inherited from QgsComposerMultiFrame | |
void | recalculateFrameRects () |
Forces a recalculation of all the associated frame's scene rectangles. | |
virtual void | recalculateFrameSizes () |
Recalculates the portion of the multiframe item which is shown in each of it's component frames. | |
void | update () |
Forces a redraw of all child frames. | |
Public Slots inherited from QgsComposerObject | |
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. | |
virtual void | repaint () |
Triggers a redraw for the item. |
Public Member Functions | |
QgsComposerTableV2 (QgsComposition *composition, bool createUndoCommands) | |
QgsComposerTableV2 () | |
virtual | ~QgsComposerTableV2 () |
QColor | backgroundColor () const |
Returns the color used for the background of the table. | |
double | cellMargin () const |
Returns the margin distance between cell borders and their contents. | |
QgsComposerTableColumns * | columns () |
Returns a pointer to the list of QgsComposerTableColumns shown in the table. | |
QFont | contentFont () const |
Returns the font used to draw text in table body cells. | |
QColor | contentFontColor () const |
Returns the color used to draw text in table body cells. | |
QgsComposerTableContents * | contents () |
Returns the current contents of the table. | |
EmptyTableMode | emptyTableBehaviour () const |
Returns the behaviour mode for empty tables. | |
QString | emptyTableMessage () const |
Returns the message for empty tables with no content rows. | |
virtual QSizeF | fixedFrameSize (const int frameIndex=-1) const override |
Returns the fixed size for a frame, if desired. | |
virtual bool | getTableContents (QgsComposerTableContents &contents)=0 |
Fetches the contents used for the cells in the table. | |
QColor | gridColor () const |
Returns the color used for grid lines in the table. | |
double | gridStrokeWidth () const |
Returns the width of grid lines in the table. | |
QFont | headerFont () const |
Returns the font used to draw header text in the table. | |
QColor | headerFontColor () const |
Returns the color used to draw header text in the table. | |
HeaderHAlignment | headerHAlignment () const |
Returns the horizontal alignment for table headers. | |
virtual QMap< int, QString > | headerLabels () const |
Returns the text used in the column headers for the table. | |
HeaderMode | headerMode () const |
Returns the display mode for headers in the table. | |
virtual QSizeF | minFrameSize (const int frameIndex=-1) const override |
Returns the minimum size for a frames, if desired. | |
virtual bool | readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) override |
Reads multiframe state information from a DOM element. | |
virtual void | render (QPainter *p, const QRectF &renderExtent, const int frameIndex) override |
Renders a portion of the multiframe's content into a painter. | |
void | setBackgroundColor (const QColor &color) |
Sets color used for background of table. | |
void | setCellMargin (const double margin) |
Sets the margin distance between cell borders and their contents. | |
void | setColumns (QgsComposerTableColumns columns) |
Replaces the columns in the table with a specified list of QgsComposerTableColumns. | |
void | setContentFont (const QFont &font) |
Sets 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. | |
void | setEmptyTableBehaviour (const EmptyTableMode mode) |
Sets the behaviour for empty tables with no content rows. | |
void | setEmptyTableMessage (const QString message) |
Sets the message for empty tables with no content rows. | |
void | setGridColor (const QColor &color) |
Sets color used for grid lines in the table. | |
void | setGridStrokeWidth (const double width) |
Sets the width for grid lines in the table. | |
void | setHeaderFont (const QFont &font) |
Sets 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. | |
void | setHeaderHAlignment (const HeaderHAlignment alignment) |
Sets the horizontal alignment for table headers. | |
void | setHeaderMode (const HeaderMode mode) |
Sets the display mode for headers in the table. | |
void | setShowEmptyRows (const bool showEmpty) |
Sets whether empty rows should be drawn. | |
void | setShowGrid (const bool showGrid) |
Sets whether grid lines should be drawn in the table. | |
bool | showEmptyRows () const |
Returns whether empty rows are drawn in the table. | |
bool | showGrid () const |
Returns whether grid lines are drawn in the table. | |
virtual QSizeF | totalSize () const override |
Returns the total size of the multiframe's content. | |
virtual bool | writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const override |
Stores state information about multiframe in DOM element. | |
Public Member Functions inherited from QgsComposerMultiFrame | |
QgsComposerMultiFrame (QgsComposition *c, bool createUndoCommands) | |
Construct a new multiframe item. | |
virtual | ~QgsComposerMultiFrame () |
bool | _readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false) |
Restores state information about base multiframe object from a DOM element. | |
bool | _writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const |
Stores state information about base multiframe object in DOM element. | |
virtual void | addFrame (QgsComposerFrame *frame, bool recalcFrameSizes=true)=0 |
Adds a frame to the multiframe. | |
QgsComposition * | composition () |
Returns the parent composition for the multiframe. | |
QgsComposerFrame * | createNewFrame (QgsComposerFrame *currentFrame, QPointF pos, QSizeF size) |
Creates a new frame and adds it to the multi frame and composition. | |
bool | createUndoCommands () const |
Returns whether undo commands should be created for interactions with the multiframe. | |
void | deleteFrames () |
Removes and deletes all child frames. | |
virtual QString | displayName () const |
Get multiframe display name. | |
virtual double | findNearbyPageBreak (double yPos) |
Finds the optimal position to break a frame at. | |
QgsComposerFrame * | frame (int i) const |
Returns a child frame from the multiframe. | |
int | frameCount () const |
Returns the number of frames associated with this multiframe. | |
int | frameIndex (QgsComposerFrame *frame) const |
Returns the index of a frame within the multiframe. | |
void | removeFrame (int i, const bool removeEmptyPages=false) |
Removes a frame from the multiframe. | |
virtual Q_DECL_DEPRECATED void | render (QPainter *p, const QRectF &renderExtent) |
Renders a portion of the multiframe's content into a painter. | |
ResizeMode | resizeMode () const |
Returns the resize mode for the multiframe. | |
void | setCreateUndoCommands (bool enabled) |
Sets whether undo commands should be created for interactions with the multiframe. | |
void | setResizeMode (ResizeMode mode) |
Sets the resize mode for the multiframe, and recalculates frame sizes to match. | |
Public Member Functions inherited from QgsComposerObject | |
QgsComposerObject (QgsComposition *composition) | |
Constructor. | |
virtual | ~QgsComposerObject () |
const QgsComposition * | composition () const |
Returns the composition the item is attached to. | |
QgsDataDefined * | dataDefinedProperty (const DataDefinedProperty property) const |
Returns a reference to the data defined settings for one of the item's data defined properties. | |
virtual bool | readXML (const QDomElement &itemElem, const QDomDocument &doc) |
Sets item state from DOM element. | |
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. | |
virtual bool | writeXML (QDomElement &elem, QDomDocument &doc) const |
Stores item state in DOM element. |
Protected Member Functions | |
virtual bool | calculateMaxColumnWidths () |
Calculates the maximum width of text shown in columns. | |
bool | contentsContainsRow (const QgsComposerTableContents &contents, const QgsComposerTableRow &row) const |
Checks whether a table contents contains a given row. | |
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. | |
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. | |
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. | |
double | totalHeight () const |
Returns total height of table contents. | |
double | totalWidth () |
Returns total width of table contents. |
Protected Attributes | |
QColor | mBackgroundColor |
Color for table background. | |
double | mCellMargin |
Margin between cell borders and cell text. | |
QgsComposerTableColumns | mColumns |
Columns to show in table. | |
QFont | mContentFont |
Table contents font. | |
QColor | mContentFontColor |
Table contents font color. | |
QString | mEmptyTableMessage |
String to show in empty tables. | |
EmptyTableMode | mEmptyTableMode |
Behaviour for empty tables. | |
QColor | mGridColor |
Color for grid lines. | |
double | mGridStrokeWidth |
Width of grid lines. | |
QFont | mHeaderFont |
Header font. | |
QColor | mHeaderFontColor |
Header font color. | |
HeaderHAlignment | mHeaderHAlignment |
Alignment for table headers. | |
HeaderMode | mHeaderMode |
Header display mode. | |
QMap< int, double > | mMaxColumnWidthMap |
Map of maximum width for each column. | |
bool | mShowEmptyRows |
True if empty rows should be shown in the table. | |
bool | mShowGrid |
True if grid should be shown. | |
QgsComposerTableContents | mTableContents |
Contents to show in table. | |
QSizeF | mTableSize |
Protected Attributes inherited from QgsComposerMultiFrame | |
bool | mCreateUndoCommands |
True: creates QgsMultiFrameCommands on internal changes (e.g. | |
QList< QgsComposerFrame * > | mFrameItems |
ResizeMode | mResizeMode |
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.
Definition at line 49 of file qgscomposertablev2.h.
Controls how empty tables are displayed
HeadersOnly |
show header rows only |
HideTable |
hides entire table if empty |
ShowMessage |
shows preset message instead of table contents |
Definition at line 76 of file qgscomposertablev2.h.
Controls how headers are horizontally aligned in a table
FollowColumn |
header uses the same alignment as the column |
HeaderLeft |
align headers left |
HeaderCenter |
align headers to center |
HeaderRight |
align headers right |
Definition at line 57 of file qgscomposertablev2.h.
Controls where headers are shown in the table
FirstFrame |
header shown on first frame only |
AllFrames |
headers shown on all frames |
NoHeaders |
no headers shown for table |
Definition at line 67 of file qgscomposertablev2.h.
QgsComposerTableV2::QgsComposerTableV2 | ( | QgsComposition * | composition, |
bool | createUndoCommands | ||
) |
Definition at line 24 of file qgscomposertablev2.cpp.
QgsComposerTableV2::QgsComposerTableV2 | ( | ) |
Definition at line 54 of file qgscomposertablev2.cpp.
|
virtual |
Definition at line 71 of file qgscomposertablev2.cpp.
|
inline |
Returns the color used for the background of the table.
Definition at line 289 of file qgscomposertablev2.h.
|
protectedvirtual |
Calculates the maximum width of text shown in columns.
Definition at line 666 of file qgscomposertablev2.cpp.
|
inline |
Returns the margin distance between cell borders and their contents.
Definition at line 98 of file qgscomposertablev2.h.
|
inline |
Returns a pointer to the list of QgsComposerTableColumns shown in the table.
Definition at line 295 of file qgscomposertablev2.h.
|
inline |
Returns the font used to draw text in table body cells.
Definition at line 211 of file qgscomposertablev2.h.
|
inline |
Returns the color used to draw text in table body cells.
Definition at line 227 of file qgscomposertablev2.h.
|
inline |
Returns the current contents of the table.
Excludes header cells.
Definition at line 320 of file qgscomposertablev2.h.
|
protected |
Checks whether a table contents contains a given row.
contents | table contents to check |
row | row to check for |
Definition at line 865 of file qgscomposertablev2.cpp.
|
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 |
Definition at line 789 of file qgscomposertablev2.cpp.
|
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 |
Definition at line 815 of file qgscomposertablev2.cpp.
|
inline |
Returns the behaviour mode for empty tables.
This property controls how the table is drawn if it contains no content rows.
Definition at line 111 of file qgscomposertablev2.h.
|
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
Definition at line 129 of file qgscomposertablev2.h.
|
overridevirtual |
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.
Definition at line 630 of file qgscomposertablev2.cpp.
|
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.
Definition at line 275 of file qgscomposertablev2.h.
|
inline |
Returns the width of grid lines in the table.
Definition at line 259 of file qgscomposertablev2.h.
|
inline |
Returns the font used to draw header text in the table.
Definition at line 155 of file qgscomposertablev2.h.
|
inline |
Returns the color used to draw header text in the table.
Definition at line 171 of file qgscomposertablev2.h.
|
inline |
Returns the horizontal alignment for table headers.
Definition at line 183 of file qgscomposertablev2.h.
|
virtual |
Returns the text used in the column headers for the table.
Definition at line 616 of file qgscomposertablev2.cpp.
|
inline |
Returns the display mode for headers in the table.
This property controls if and where headers are shown in the table.
Definition at line 197 of file qgscomposertablev2.h.
|
overridevirtual |
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.
Definition at line 636 of file qgscomposertablev2.cpp.
|
overridevirtual |
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.
Definition at line 109 of file qgscomposertablev2.cpp.
|
overrideslot |
Definition at line 660 of file qgscomposertablev2.cpp.
|
protected |
Recalculates and updates the size of the table and all table frames.
Definition at line 856 of file qgscomposertablev2.cpp.
|
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.
Definition at line 648 of file qgscomposertablev2.cpp.
|
overridevirtual |
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.
Definition at line 247 of file qgscomposertablev2.cpp.
|
protected |
Calculates a range of rows which should be visible in a given frame extent.
extent | visible extent |
frameIndex | index number for frame |
Definition at line 205 of file qgscomposertablev2.cpp.
|
protected |
Calculates how many content rows are visible within a given frame.
frameIndex | index number for frame |
Definition at line 164 of file qgscomposertablev2.cpp.
|
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 |
Definition at line 182 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setBackgroundColor | ( | const QColor & | color | ) |
Sets color used for background of table.
color | table background color |
Definition at line 594 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setCellMargin | ( | const double | margin | ) |
Sets the margin distance between cell borders and their contents.
margin | margin for cell contents |
Definition at line 416 of file qgscomposertablev2.cpp.
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 |
Definition at line 607 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setContentFont | ( | const QFont & | font | ) |
Sets the font used to draw text in table body cells.
font | font for table cells |
Definition at line 526 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setContentFontColor | ( | const QColor & | color | ) |
Sets the color used to draw text in table body cells.
color | table cell text color |
Definition at line 540 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setEmptyTableBehaviour | ( | const EmptyTableMode | mode | ) |
Sets the behaviour for empty tables with no content rows.
mode | behaviour mode for empty tables |
Definition at line 431 of file qgscomposertablev2.cpp.
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 |
Definition at line 446 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setGridColor | ( | const QColor & | color | ) |
Sets color used for grid lines in the table.
color | grid line color |
Definition at line 581 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setGridStrokeWidth | ( | const double | width | ) |
Sets the width for grid lines in the table.
width | grid line width |
Definition at line 567 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setHeaderFont | ( | const QFont & | font | ) |
Sets the font used to draw header text in the table.
font | font for header cells |
Definition at line 473 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setHeaderFontColor | ( | const QColor & | color | ) |
Sets the color used to draw header text in the table.
color | header text color |
Definition at line 487 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setHeaderHAlignment | ( | const HeaderHAlignment | alignment | ) |
Sets the horizontal alignment for table headers.
alignment | Horizontal alignment for table header cells |
Definition at line 500 of file qgscomposertablev2.cpp.
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 |
Definition at line 513 of file qgscomposertablev2.cpp.
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 |
Definition at line 461 of file qgscomposertablev2.cpp.
void QgsComposerTableV2::setShowGrid | ( | const bool | showGrid | ) |
Sets whether grid lines should be drawn in the table.
showGrid | set to true to show grid lines |
Definition at line 553 of file qgscomposertablev2.cpp.
|
inline |
Returns whether empty rows are drawn in the table.
Definition at line 141 of file qgscomposertablev2.h.
|
inline |
Returns whether grid lines are drawn in the table.
Definition at line 243 of file qgscomposertablev2.h.
|
protected |
Returns total height of table contents.
Definition at line 733 of file qgscomposertablev2.cpp.
|
overridevirtual |
Returns the total size of the multiframe's content.
Implements QgsComposerMultiFrame.
Definition at line 159 of file qgscomposertablev2.cpp.
|
protected |
Returns total width of table contents.
Definition at line 712 of file qgscomposertablev2.cpp.
|
overridevirtual |
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.
Definition at line 77 of file qgscomposertablev2.cpp.
|
friend |
Definition at line 470 of file qgscomposertablev2.h.
|
protected |
Color for table background.
Definition at line 385 of file qgscomposertablev2.h.
|
protected |
Margin between cell borders and cell text.
Definition at line 346 of file qgscomposertablev2.h.
|
protected |
Columns to show in table.
Definition at line 388 of file qgscomposertablev2.h.
|
protected |
Table contents font.
Definition at line 370 of file qgscomposertablev2.h.
|
protected |
Table contents font color.
Definition at line 373 of file qgscomposertablev2.h.
|
protected |
String to show in empty tables.
Definition at line 352 of file qgscomposertablev2.h.
|
protected |
Behaviour for empty tables.
Definition at line 349 of file qgscomposertablev2.h.
|
protected |
Color for grid lines.
Definition at line 382 of file qgscomposertablev2.h.
|
protected |
Width of grid lines.
Definition at line 379 of file qgscomposertablev2.h.
|
protected |
Header font.
Definition at line 358 of file qgscomposertablev2.h.
|
protected |
Header font color.
Definition at line 361 of file qgscomposertablev2.h.
|
protected |
Alignment for table headers.
Definition at line 364 of file qgscomposertablev2.h.
|
protected |
Header display mode.
Definition at line 367 of file qgscomposertablev2.h.
|
protected |
Map of maximum width for each column.
Definition at line 394 of file qgscomposertablev2.h.
|
protected |
True if empty rows should be shown in the table.
Definition at line 355 of file qgscomposertablev2.h.
|
protected |
True if grid should be shown.
Definition at line 376 of file qgscomposertablev2.h.
|
protected |
Contents to show in table.
Definition at line 391 of file qgscomposertablev2.h.
|
protected |
Definition at line 396 of file qgscomposertablev2.h.