18#ifndef QGSLAYOUTTABLE_H
19#define QGSLAYOUTTABLE_H
82 QColor cellBackgroundColor = QColor( 255, 255, 255, 255 );
90 bool writeXml( QDomElement &styleElem, QDomDocument &doc )
const;
97 bool readXml(
const QDomElement &styleElem );
179 void setCellMargin(
double margin );
191 void setEmptyTableBehavior( EmptyTableMode mode );
207 void setEmptyTableMessage(
const QString &message );
223 void setShowEmptyRows(
bool showEmpty );
237 Q_DECL_DEPRECATED
void setHeaderFont(
const QFont &font )
SIP_DEPRECATED;
254 Q_DECL_DEPRECATED
void setHeaderFontColor( const QColor &color )
SIP_DEPRECATED;
285 void setHeaderHAlignment( HeaderHAlignment alignment );
298 void setHeaderMode( HeaderMode mode );
313 Q_DECL_DEPRECATED
void setContentFont(
const QFont &font )
SIP_DEPRECATED;
330 Q_DECL_DEPRECATED
void setContentFontColor( const QColor &color )
SIP_DEPRECATED;
364 void setShowGrid(
bool showGrid );
372 bool showGrid()
const {
return mShowGrid; }
380 void setGridStrokeWidth(
double width );
396 void setGridColor(
const QColor &color );
414 void setHorizontalGrid(
bool horizontalGrid );
433 void setVerticalGrid(
bool verticalGrid );
449 void setBackgroundColor(
const QColor &color );
463 void setWrapBehavior( WrapBehavior behavior );
527 virtual QMap<int, QString> headerLabels() const
SIP_SKIP;
556 virtual
int rowSpan(
int row,
int column ) const;
564 virtual
int columnSpan(
int row,
int column ) const;
571 QSizeF fixedFrameSize(
int frameIndex = -1 )
const override;
572 QSizeF minFrameSize(
int frameIndex = -1 )
const override;
574 bool writePropertiesToElement( QDomElement &elem, QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
575 bool readPropertiesFromElement(
const QDomElement &itemElem,
const QDomDocument &doc,
const QgsReadWriteContext &context )
override;
576 QSizeF totalSize()
const override;
581 void refresh()
override;
588 virtual void refreshAttributes();
590 void recalculateFrameSizes()
override;
594 double mCellMargin = 1.0;
603 bool mShowEmptyRows =
false;
616 bool mShowGrid =
true;
619 double mGridStrokeWidth = 0.5;
622 QColor mGridColor = Qt::black;
625 bool mHorizontalGrid =
true;
628 bool mVerticalGrid =
true;
631 QColor mBackgroundColor = Qt::white;
657 virtual bool calculateMaxColumnWidths();
662 virtual bool calculateMaxRowHeights();
677 double totalHeight();
691 int rowsVisible(
QgsRenderContext &context,
double frameHeight,
int firstRow,
bool includeHeader,
bool includeEmptyRows )
const;
703 int rowsVisible(
QgsRenderContext &context,
int frameIndex,
int firstRow,
bool includeEmptyRows )
const;
711 QPair<int, int> rowRange(
QgsRenderContext &context,
int frameIndex )
const;
739 void drawVerticalGridLines(
QgsLayoutItemRenderContext &context,
const QMap<int, double> &maxWidthMap,
int firstRow,
int lastRow,
bool hasHeader,
bool mergeCells =
false ) const
SIP_SKIP;
744 void recalculateTableSize();
760 virtual
QgsTextFormat textFormatForCell(
int row,
int column ) const;
768 virtual
QgsTextFormat textFormatForHeader(
int column ) const;
776 virtual Qt::Alignment horizontalAlignmentForCell(
int row,
int column ) const;
784 virtual Qt::Alignment verticalAlignmentForCell(
int row,
int column ) const;
801 QColor backgroundColor(
int row,
int column,
int rowSpan = 1,
int columnSpan = 1 ) const;
803 friend class TestQgsLayoutTable;
804 friend class TestQgsLayoutManualTable;
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
Conditional styling for a rule.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Contains settings and helpers relating to a render of a QgsLayoutItem.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
Stores properties of a column for a QgsLayoutTable.
Styling option for a layout table cell.
QgsLayoutTableStyle()=default
A class to display a table in the print layout, and allow the table to span over multiple frames.
QgsLayoutTableColumns & columns()
Returns a reference to the list of QgsLayoutTableColumns shown in the table.
HeaderMode headerMode() const
Returns the display mode for headers in the table.
QColor backgroundColor() const
Returns the color used for the background of the table.
EmptyTableMode emptyTableBehavior() const
Returns the behavior mode for empty tables.
QMap< int, double > mMaxColumnWidthMap
Map of maximum width for each column.
bool horizontalGrid() const
Returns whether the grid's horizontal lines are drawn in the table.
double cellMargin() const
Returns the margin distance between cell borders and their contents in mm.
QString emptyTableMessage() const
Returns the message for empty tables with no content rows.
QgsLayoutTableSortColumns & sortColumns()
Returns a reference to the list of QgsLayoutTableSortColumns shown in the table.
QString mEmptyTableMessage
String to show in empty tables.
bool showEmptyRows() const
Returns whether empty rows are drawn in the table.
bool verticalGrid() const
Returns whether the grid's vertical lines are drawn in the table.
CellStyleGroup
Row or column groups for cell styling.
@ FirstRow
Style first row only.
@ EvenColumns
Style even numbered columns.
@ EvenRows
Style even numbered rows.
@ HeaderRow
Style header row.
@ OddColumns
Style odd numbered columns.
@ FirstColumn
Style first column only.
@ LastColumn
Style last column only.
@ OddRows
Style odd numbered rows.
QgsTextFormat mHeaderTextFormat
QColor gridColor() const
Returns the color used for grid lines in the table.
HeaderMode
Controls where headers are shown in the table.
@ AllFrames
Headers shown on all frames.
QgsLayoutTableColumns mColumns
Columns to show in table.
QgsTextFormat mContentTextFormat
WrapBehavior wrapBehavior() const
Returns the wrap behavior for the table, which controls how text within cells is automatically wrappe...
QgsLayoutTableContents mTableContents
Contents to show in table.
double gridStrokeWidth() const
Returns the width of grid lines in the table in mm.
QgsLayoutTableSortColumns mSortColumns
Columns to sort the table.
WrapBehavior
Controls how long strings in the table are handled.
HeaderHAlignment
Controls how headers are horizontally aligned in a table.
@ HeaderLeft
Align headers left.
@ HeaderCenter
Align headers to center.
@ FollowColumn
Header uses the same alignment as the column.
EmptyTableMode
Controls how empty tables are displayed.
@ HideTable
Hides entire table if empty.
QMap< int, double > mMaxRowHeightMap
Map of maximum height for each row.
QMap< CellStyleGroup, QgsLayoutTableStyle * > mCellStyles
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
Container for all settings relating to text rendering.
QVector< QgsLayoutTableColumn > QgsLayoutTableColumns
List of column definitions for a QgsLayoutTable.
QVector< QgsLayoutTableColumn > QgsLayoutTableSortColumns
List of column definitions for sorting a QgsLayoutTable.
QVector< QgsLayoutTableRow > QgsLayoutTableContents
List of QgsLayoutTableRows, representing rows and column cell contents for a QgsLayoutTable.
QVector< QVariant > QgsLayoutTableRow
List of QVariants, representing a the contents of a single row in a QgsLayoutTable.