QGIS API Documentation 3.41.0-Master (25ec5511245)
|
A layout table subclass that displays manually entered (and formatted) content. More...
#include <qgslayoutitemmanualtable.h>
Public Member Functions | |
QgsLayoutItemManualTable (QgsLayout *layout) | |
Constructor for QgsLayoutItemManualTable, attached to the specified layout. | |
~QgsLayoutItemManualTable () override | |
QList< double > | columnWidths () const |
Returns the list of column widths (in millimeters) to use when rendering the table. | |
QgsConditionalStyle | conditionalCellStyle (int row, int column) const override |
Returns the conditional style to use for the cell at row, column. | |
QString | displayName () const override |
Returns the multiframe display name. | |
bool | getTableContents (QgsLayoutTableContents &contents) override |
Fetches the contents used for the cells in the table. | |
QgsLayoutTableColumns & | headers () |
Returns a reference to the list of headers shown in the table. | |
QIcon | icon () const override |
Returns the item's icon. | |
bool | includeTableHeader () const |
Returns true if the table includes a header row. | |
QList< double > | rowHeights () const |
Returns the list of row heights (in millimeters) to use when rendering the table. | |
void | setColumnWidths (const QList< double > &widths) |
Sets the list of column widths (in millimeters) to use when rendering the table. | |
void | setHeaders (const QgsLayoutTableColumns &headers) |
Replaces the headers in the table with a specified list of QgsLayoutTableColumns. | |
void | setIncludeTableHeader (bool included) |
Sets whether the table includes a header row. | |
void | setRowHeights (const QList< double > &heights) |
Sets the list of row heights (in millimeters) to use when rendering the table. | |
void | setTableContents (const QgsTableContents &contents) |
Sets the contents of the table. | |
QgsTableContents | tableContents () const |
Returns the contents of the table. | |
int | type () const override |
Returns unique multiframe type id. | |
Public Member Functions inherited from QgsLayoutTable | |
QgsLayoutTable (QgsLayout *layout) | |
Constructor for QgsLayoutTable, belonging to the specified layout. | |
~QgsLayoutTable () override | |
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 in mm. | |
const QgsLayoutTableStyle * | cellStyle (CellStyleGroup group) const |
Returns the cell style for a cell group. | |
QgsLayoutTableColumns & | columns () |
Returns a reference to the list of QgsLayoutTableColumns shown in the table. | |
Q_DECL_DEPRECATED QFont | contentFont () const |
Returns the font used to draw text in table body cells. | |
Q_DECL_DEPRECATED QColor | contentFontColor () const |
Returns the color used to draw text in table body cells. | |
QgsLayoutTableContents & | contents () |
Returns the current contents of the table. | |
QgsTextFormat | contentTextFormat () const |
Returns the format used to draw content text in the table. | |
EmptyTableMode | emptyTableBehavior () const |
Returns the behavior mode for empty tables. | |
QString | emptyTableMessage () const |
Returns the message for empty tables with no content rows. | |
QSizeF | fixedFrameSize (int frameIndex=-1) const override |
Returns the fixed size for a frame, if desired. | |
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 in mm. | |
Q_DECL_DEPRECATED QFont | headerFont () const |
Returns the font used to draw header text in the table. | |
Q_DECL_DEPRECATED 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. | |
QgsTextFormat | headerTextFormat () const |
Returns the format used to draw header text in the table. | |
bool | horizontalGrid () const |
Returns whether the grid's horizontal lines are drawn in the table. | |
QSizeF | minFrameSize (int frameIndex=-1) const override |
Returns the minimum size for a frames, if desired. | |
bool | readPropertiesFromElement (const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override |
Sets multiframe state from a DOM element. | |
void | render (QgsLayoutItemRenderContext &context, const QRectF &renderExtent, int frameIndex) override |
Renders a portion of the multiframe's content into a render context. | |
virtual QgsExpressionContextScope * | scopeForCell (int row, int column) const |
Creates a new QgsExpressionContextScope for the cell at row, column. | |
void | setBackgroundColor (const QColor &color) |
Sets the color used for background of table. | |
void | setCellMargin (double margin) |
Sets the margin distance in mm between cell borders and their contents. | |
void | setCellStyle (CellStyleGroup group, const QgsLayoutTableStyle &style) |
Sets the cell style for a cell group. | |
void | setColumns (const QgsLayoutTableColumns &columns) |
Replaces the columns in the table with a specified list of QgsLayoutTableColumns. | |
Q_DECL_DEPRECATED void | setContentFont (const QFont &font) |
Sets the font used to draw text in table body cells. | |
Q_DECL_DEPRECATED void | setContentFontColor (const QColor &color) |
Sets the color used to draw text in table body cells. | |
void | setContentTextFormat (const QgsTextFormat &format) |
Sets the format used to draw content text in the table. | |
void | setEmptyTableBehavior (EmptyTableMode mode) |
Sets the behavior mode 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 the color used for grid lines in the table. | |
void | setGridStrokeWidth (double width) |
Sets the width in mm for grid lines in the table. | |
Q_DECL_DEPRECATED void | setHeaderFont (const QFont &font) |
Sets the font used to draw header text in the table. | |
Q_DECL_DEPRECATED void | setHeaderFontColor (const QColor &color) |
Sets the color used to draw header text in the table. | |
void | setHeaderHAlignment (HeaderHAlignment alignment) |
Sets the horizontal alignment for table headers. | |
void | setHeaderMode (HeaderMode mode) |
Sets the display mode for headers in the table. | |
void | setHeaderTextFormat (const QgsTextFormat &format) |
Sets the format used to draw header text in the table. | |
void | setHorizontalGrid (bool horizontalGrid) |
Sets whether the grid's horizontal lines should be drawn in the table. | |
void | setShowEmptyRows (bool showEmpty) |
Sets whether empty rows should be drawn. | |
void | setShowGrid (bool showGrid) |
Sets whether grid lines should be drawn in the table. | |
void | setSortColumns (const QgsLayoutTableSortColumns &sortColumns) |
Replaces the sorting columns in the table with a specified list of QgsLayoutTableSortColumns. | |
void | setVerticalGrid (bool verticalGrid) |
Sets whether the grid's vertical lines should be drawn in the table. | |
void | setWrapBehavior (WrapBehavior behavior) |
Sets the wrap behavior for the table, which controls how text within cells is automatically wrapped. | |
bool | showEmptyRows () const |
Returns whether empty rows are drawn in the table. | |
bool | showGrid () const |
Returns whether grid lines are drawn in the table. | |
QgsLayoutTableSortColumns & | sortColumns () |
Returns a reference to the list of QgsLayoutTableSortColumns shown in the table. | |
QSizeF | totalSize () const override |
Returns the total size of the multiframe's content, in layout units. | |
bool | verticalGrid () const |
Returns whether the grid's vertical lines are drawn in the table. | |
WrapBehavior | wrapBehavior () const |
Returns the wrap behavior for the table, which controls how text within cells is automatically wrapped. | |
bool | writePropertiesToElement (QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override |
Stores multiframe state within an XML DOM element. | |
Public Member Functions inherited from QgsLayoutMultiFrame | |
QgsLayoutMultiFrame (QgsLayout *layout) | |
Construct a new multiframe item, attached to the specified layout. | |
~QgsLayoutMultiFrame () override | |
virtual void | addFrame (QgsLayoutFrame *frame, bool recalcFrameSizes=true) |
Adds a frame to the multiframe. | |
void | beginCommand (const QString &commandText, UndoCommand command=UndoNone) |
Starts new undo command for this item. | |
void | cancelCommand () |
Cancels the current item command and discards it. | |
QgsAbstractLayoutUndoCommand * | createCommand (const QString &text, int id, QUndoCommand *parent=nullptr) override |
Creates a new layout undo command with the specified text and parent. | |
QgsExpressionContext | createExpressionContext () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. | |
QgsLayoutFrame * | createNewFrame (QgsLayoutFrame *currentFrame, QPointF pos, QSizeF size) |
Creates a new frame and adds it to the multi frame and layout. | |
void | deleteFrames () |
Removes and deletes all child frames. | |
void | endCommand () |
Completes the current item command and push it onto the layout's undo stack. | |
virtual void | finalizeRestoreFromXml () |
Called after all pending items have been restored from XML. | |
virtual double | findNearbyPageBreak (double yPos) |
Finds the optimal position to break a frame at. | |
QgsLayoutFrame * | frame (int index) const |
Returns the child frame at a specified index from the multiframe. | |
int | frameCount () const |
Returns the number of frames associated with this multiframe. | |
int | frameIndex (QgsLayoutFrame *frame) const |
Returns the index of a frame within the multiframe. | |
QList< QgsLayoutFrame * > | frames () const |
Returns a list of all child frames for this multiframe. | |
bool | readXml (const QDomElement &itemElement, const QDomDocument &document, const QgsReadWriteContext &context, bool includeFrames=false) |
Sets the item state from a DOM element. | |
void | removeFrame (int index, bool removeEmptyPages=false) |
Removes a frame by index from the multiframe. | |
ResizeMode | resizeMode () const |
Returns the resize mode for the multiframe. | |
void | setResizeMode (ResizeMode mode) |
Sets the resize mode for the multiframe, and recalculates frame sizes to match. | |
QString | uuid () const |
Returns the multiframe identification string. | |
bool | writeXml (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context, bool includeFrames=false) const |
Stores the multiframe state in a DOM element. | |
Public Member Functions inherited from QgsLayoutObject | |
QgsLayoutObject (QgsLayout *layout) | |
Constructor for QgsLayoutObject, with the specified parent layout. | |
QgsExpressionContext | createExpressionContext () const override |
Creates an expression context relating to the objects' current state. | |
QStringList | customProperties () const |
Returns list of keys stored in custom properties for the object. | |
QVariant | customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const |
Read a custom property from the object. | |
QgsPropertyCollection & | dataDefinedProperties () |
Returns a reference to the object's property collection, used for data defined overrides. | |
const QgsPropertyCollection & | dataDefinedProperties () const |
Returns a reference to the object's property collection, used for data defined overrides. | |
QgsLayout * | layout () |
Returns the layout the object is attached to. | |
const QgsLayout * | layout () const |
Returns the layout the object is attached to. | |
void | removeCustomProperty (const QString &key) |
Remove a custom property from the object. | |
void | setCustomProperty (const QString &key, const QVariant &value) |
Set a custom property for the object. | |
void | setDataDefinedProperties (const QgsPropertyCollection &collection) |
Sets the objects's property collection, used for data defined overrides. | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
Public Member Functions inherited from QgsLayoutUndoObjectInterface | |
virtual | ~QgsLayoutUndoObjectInterface ()=default |
Static Public Member Functions | |
static QgsLayoutItemManualTable * | create (QgsLayout *layout) |
Returns a new QgsLayoutItemManualTable for the specified parent layout. | |
Static Public Member Functions inherited from QgsLayoutObject | |
static bool | propertyAssociatesWithParentMultiframe (DataDefinedProperty property) |
Returns true if the specified property key is normally associated with the parent QgsLayoutMultiFrame object instead of a child QgsLayoutFrame object. | |
static const QgsPropertiesDefinition & | propertyDefinitions () |
Returns the layout object property definitions. | |
Protected Member Functions | |
bool | calculateMaxRowHeights () override |
Calculates the maximum height of text shown in rows. | |
int | columnSpan (int row, int column) const override |
Returns the column span for the cell a row, column. | |
Qt::Alignment | horizontalAlignmentForCell (int row, int column) const override |
Returns the horizontal alignment to use for the cell at the specified row and column. | |
bool | readPropertiesFromElement (const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override |
Sets multiframe state from a DOM element. | |
int | rowSpan (int row, int column) const override |
Returns the row span for the cell a row, column. | |
QgsTextFormat | textFormatForCell (int row, int column) const override |
Returns the text format to use for the cell at the specified row and column. | |
QgsTextFormat | textFormatForHeader (int column) const override |
Returns the text format to use for the header cell at the specified column. | |
Qt::Alignment | verticalAlignmentForCell (int row, int column) const override |
Returns the vertical alignment to use for the cell at the specified row and column. | |
bool | writePropertiesToElement (QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override |
Stores multiframe state within an XML DOM element. | |
Protected Member Functions inherited from QgsLayoutTable | |
virtual bool | calculateMaxColumnWidths () |
Calculates the maximum width of text shown in columns. | |
bool | contentsContainsRow (const QgsLayoutTableContents &contents, const QgsLayoutTableRow &row) const |
Checks whether a table contents contains a given row. | |
void | drawHorizontalGridLines (QgsLayoutItemRenderContext &context, int firstRow, int lastRow, bool drawHeaderLines) const |
Draws the horizontal grid lines for the table. | |
void | drawVerticalGridLines (QgsLayoutItemRenderContext &context, const QMap< int, double > &maxWidthMap, int firstRow, int lastRow, bool hasHeader, 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 (QgsRenderContext &context, int frameIndex) const |
Calculates a range of rows which should be visible in a given frame. | |
int | rowsVisible (QgsRenderContext &context, double frameHeight, int firstRow, bool includeHeader, bool includeEmptyRows) const |
Calculates how many content rows would be visible within a frame of the specified height. | |
int | rowsVisible (QgsRenderContext &context, int frameIndex, int firstRow, bool includeEmptyRows) const |
Calculates how many content rows are visible within a given frame. | |
double | totalHeight () |
Returns total height of table contents. | |
double | totalWidth () |
Returns total width of table contents. | |
Protected Member Functions inherited from QgsLayoutObject | |
bool | readObjectPropertiesFromElement (const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext &context) |
Sets object properties from a DOM element. | |
bool | writeObjectPropertiesToElement (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const |
Stores object properties within an XML DOM element. | |
A layout table subclass that displays manually entered (and formatted) content.
Definition at line 31 of file qgslayoutitemmanualtable.h.
QgsLayoutItemManualTable::QgsLayoutItemManualTable | ( | QgsLayout * | layout | ) |
Constructor for QgsLayoutItemManualTable, attached to the specified layout.
Ownership is transferred to the layout.
Definition at line 31 of file qgslayoutitemmanualtable.cpp.
|
override |
Definition at line 38 of file qgslayoutitemmanualtable.cpp.
|
overrideprotectedvirtual |
Calculates the maximum height of text shown in rows.
Reimplemented from QgsLayoutTable.
Definition at line 302 of file qgslayoutitemmanualtable.cpp.
|
overrideprotectedvirtual |
Returns the column span for the cell a row, column.
Reimplemented from QgsLayoutTable.
Definition at line 359 of file qgslayoutitemmanualtable.cpp.
|
inline |
Returns the list of column widths (in millimeters) to use when rendering the table.
A width of 0 indicates that the column width should be automatically calculated.
Definition at line 99 of file qgslayoutitemmanualtable.h.
|
overridevirtual |
Returns the conditional style to use for the cell at row, column.
Reimplemented from QgsLayoutTable.
Definition at line 106 of file qgslayoutitemmanualtable.cpp.
|
static |
Returns a new QgsLayoutItemManualTable for the specified parent layout.
Definition at line 52 of file qgslayoutitemmanualtable.cpp.
|
overridevirtual |
Returns the multiframe display name.
Reimplemented from QgsLayoutMultiFrame.
Definition at line 57 of file qgslayoutitemmanualtable.cpp.
|
overridevirtual |
Fetches the contents used for the cells in the table.
true
if table contents were successfully retrieved. contents | QgsLayoutTableContents to store retrieved row data in |
Implements QgsLayoutTable.
Definition at line 62 of file qgslayoutitemmanualtable.cpp.
QgsLayoutTableColumns & QgsLayoutItemManualTable::headers | ( | ) |
Returns a reference to the list of headers shown in the table.
Definition at line 170 of file qgslayoutitemmanualtable.cpp.
|
overrideprotectedvirtual |
Returns the horizontal alignment to use for the cell at the specified row and column.
Reimplemented from QgsLayoutTable.
Definition at line 336 of file qgslayoutitemmanualtable.cpp.
|
overridevirtual |
Returns the item's icon.
Reimplemented from QgsLayoutMultiFrame.
Definition at line 47 of file qgslayoutitemmanualtable.cpp.
bool QgsLayoutItemManualTable::includeTableHeader | ( | ) | const |
Returns true
if the table includes a header row.
Definition at line 153 of file qgslayoutitemmanualtable.cpp.
|
overrideprotectedvirtual |
Sets multiframe state from a DOM element.
element | is the DOM element for the multiframe |
document | DOM document |
context | read write context |
Note that item subclasses should not rely on all other items being present in the layout at the time this method is called. Instead, any connections and links to other items must be made in the finalizeRestoreFromXml() method. E.g. when restoring a scalebar, the connection to the linked map's signals should be implemented in finalizeRestoreFromXml(), not readPropertiesFromElement().
Reimplemented from QgsLayoutMultiFrame.
Definition at line 237 of file qgslayoutitemmanualtable.cpp.
|
inline |
Returns the list of row heights (in millimeters) to use when rendering the table.
A height of 0 indicates that the row height should be automatically calculated.
Definition at line 79 of file qgslayoutitemmanualtable.h.
|
overrideprotectedvirtual |
Returns the row span for the cell a row, column.
Reimplemented from QgsLayoutTable.
Definition at line 352 of file qgslayoutitemmanualtable.cpp.
void QgsLayoutItemManualTable::setColumnWidths | ( | const QList< double > & | widths | ) |
Sets the list of column widths (in millimeters) to use when rendering the table.
A width of 0 indicates that the column width should be automatically calculated.
Definition at line 145 of file qgslayoutitemmanualtable.cpp.
void QgsLayoutItemManualTable::setHeaders | ( | const QgsLayoutTableColumns & | headers | ) |
Replaces the headers in the table with a specified list of QgsLayoutTableColumns.
Definition at line 175 of file qgslayoutitemmanualtable.cpp.
void QgsLayoutItemManualTable::setIncludeTableHeader | ( | bool | included | ) |
Sets whether the table includes a header row.
Definition at line 158 of file qgslayoutitemmanualtable.cpp.
void QgsLayoutItemManualTable::setRowHeights | ( | const QList< double > & | heights | ) |
Sets the list of row heights (in millimeters) to use when rendering the table.
A height of 0 indicates that the row height should be automatically calculated.
Definition at line 138 of file qgslayoutitemmanualtable.cpp.
void QgsLayoutItemManualTable::setTableContents | ( | const QgsTableContents & | contents | ) |
Sets the contents of the table.
Definition at line 125 of file qgslayoutitemmanualtable.cpp.
QgsTableContents QgsLayoutItemManualTable::tableContents | ( | ) | const |
Returns the contents of the table.
Definition at line 133 of file qgslayoutitemmanualtable.cpp.
|
overrideprotectedvirtual |
Returns the text format to use for the cell at the specified row and column.
Reimplemented from QgsLayoutTable.
Definition at line 328 of file qgslayoutitemmanualtable.cpp.
|
overrideprotectedvirtual |
Returns the text format to use for the header cell at the specified column.
Reimplemented from QgsLayoutTable.
Definition at line 322 of file qgslayoutitemmanualtable.cpp.
|
overridevirtual |
Returns unique multiframe type id.
Implements QgsLayoutMultiFrame.
Definition at line 42 of file qgslayoutitemmanualtable.cpp.
|
overrideprotectedvirtual |
Returns the vertical alignment to use for the cell at the specified row and column.
Reimplemented from QgsLayoutTable.
Definition at line 344 of file qgslayoutitemmanualtable.cpp.
|
overrideprotectedvirtual |
Stores multiframe state within an XML DOM element.
element | is the DOM element to store the multiframe's properties in |
document | DOM document |
context | read write context |
Reimplemented from QgsLayoutMultiFrame.
Definition at line 184 of file qgslayoutitemmanualtable.cpp.