QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
18 #ifndef QGSLAYOUTTABLE_H
19 #define QGSLAYOUTTABLE_H
21 #include "qgis_core.h"
86 QColor cellBackgroundColor = QColor( 255, 255, 255, 255 );
94 bool writeXml( QDomElement &styleElem, QDomDocument &doc )
const;
101 bool readXml(
const QDomElement &styleElem );
184 void setCellMargin(
double margin );
196 void setEmptyTableBehavior( EmptyTableMode mode );
212 void setEmptyTableMessage(
const QString &message );
228 void setShowEmptyRows(
bool showEmpty );
241 void setHeaderFont(
const QFont &font );
256 void setHeaderFontColor(
const QColor &color );
270 void setHeaderHAlignment( HeaderHAlignment alignment );
283 void setHeaderMode( HeaderMode mode );
297 void setContentFont(
const QFont &font );
312 void setContentFontColor(
const QColor &color );
329 void setShowGrid(
bool showGrid );
345 void setGridStrokeWidth(
double width );
361 void setGridColor(
const QColor &color );
379 void setHorizontalGrid(
bool horizontalGrid );
398 void setVerticalGrid(
bool verticalGrid );
414 void setBackgroundColor(
const QColor &color );
428 void setWrapBehavior( WrapBehavior behavior );
483 virtual QMap<int, QString> headerLabels() const
SIP_SKIP;
505 QSizeF
minFrameSize(
int frameIndex = -1 )
const override;
521 virtual void refreshAttributes();
527 double mCellMargin = 1.0;
536 bool mShowEmptyRows =
false;
542 QColor mHeaderFontColor = Qt::black;
554 QColor mContentFontColor = Qt::black;
557 bool mShowGrid =
true;
560 double mGridStrokeWidth = 0.5;
563 QColor mGridColor = Qt::black;
566 bool mHorizontalGrid =
true;
569 bool mVerticalGrid =
true;
572 QColor mBackgroundColor = Qt::white;
598 virtual bool calculateMaxColumnWidths();
603 virtual bool calculateMaxRowHeights();
618 double totalHeight();
631 int rowsVisible(
double frameHeight,
int firstRow,
bool includeHeader,
bool includeEmptyRows )
const;
642 int rowsVisible(
int frameIndex,
int firstRow,
bool includeEmptyRows )
const;
649 QPair<int, int> rowRange(
int frameIndex )
const;
660 void drawHorizontalGridLines( QPainter *painter,
int firstRow,
int lastRow,
bool drawHeaderLines )
const;
677 void drawVerticalGridLines( QPainter *painter,
const QMap<int, double> &maxWidthMap,
int firstRow,
int lastRow,
bool hasHeader,
bool mergeCells =
false ) const
SIP_SKIP;
682 void recalculateTableSize();
699 bool textRequiresWrapping( const QString &text,
double columnWidth, const QFont &font ) const;
701 QString wrappedText( const QString &value,
double columnWidth, const QFont &font ) const;
709 QColor backgroundColor(
int row,
int column ) const;
711 friend class TestQgsLayoutTable;
712 friend class TestQgsLayoutManualTable;
716 #endif // QGSLAYOUTTABLE_H
HeaderMode headerMode() const
Returns the display mode for headers in the table.
virtual QSizeF totalSize() const =0
Returns the total size of the multiframe's content, in layout units.
bool showGrid() const
Returns whether grid lines are drawn in the table.
QColor backgroundColor() const
Returns the color used for the background of the table.
QVector< QgsLayoutTableColumn > QgsLayoutTableColumns
QColor headerFontColor() const
Returns the color used to draw header text in the table.
HeaderHAlignment
Controls how headers are horizontally aligned in a table.
QgsLayoutTableContents mTableContents
Contents to show in table.
QVector< QgsLayoutTableRow > QgsLayoutTableContents
QMap< int, double > mMaxColumnWidthMap
Map of maximum width for each column.
EmptyTableMode emptyTableBehavior() const
Returns the behavior mode for empty tables.
CellStyleGroup
Row or column groups for cell styling.
bool showEmptyRows() const
Returns whether empty rows are drawn in the table.
QgsLayoutTableSortColumns & sortColumns()
Returns a reference to the list of QgsLayoutTableSortColumns shown in the table.
QgsLayoutTableColumns & columns()
Returns a reference to the list of QgsLayoutTableColumns shown in the table.
QString mEmptyTableMessage
String to show in empty tables.
double gridStrokeWidth() const
Returns the width of grid lines in the table in mm.
QFont mContentFont
Table contents font.
@ OddColumns
Style odd numbered columns.
@ HideTable
Hides entire table if empty.
@ FirstRow
Style first row only.
@ FirstColumn
Style first column only.
QVector< QgsLayoutTableColumn > QgsLayoutTableSortColumns
HeaderHAlignment headerHAlignment() const
Returns the horizontal alignment for table headers.
QColor contentFontColor() const
Returns the color used to draw text in table body cells.
QgsLayoutTableSortColumns mSortColumns
Columns to sort the table.
@ HeaderRow
Style header row.
QColor gridColor() const
Returns the color used for grid lines in the table.
bool verticalGrid() const
Returns whether the grid's vertical lines are drawn in the table.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
@ OddRows
Style odd numbered rows.
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores multiframe state within an XML DOM element.
virtual QSizeF minFrameSize(int frameIndex=-1) const
Returns the minimum size for a frames, if desired.
HeaderMode
Controls where headers are shown in the table.
WrapBehavior
Controls how long strings in the table are handled.
A class to display a table in the print layout, and allow the table to span over multiple frames.
virtual void render(QgsLayoutItemRenderContext &context, const QRectF &renderExtent, int frameIndex)=0
Renders a portion of the multiframe's content into a render context.
@ EvenRows
Style even numbered rows.
EmptyTableMode
Controls how empty tables are displayed.
@ HeaderCenter
Align headers to center.
void refresh() override
Refreshes the multiframe, causing a recalculation of any property overrides.
Styling option for a layout table cell.
@ LastColumn
Style last column only.
QMap< CellStyleGroup, QgsLayoutTableStyle * > mCellStyles
bool horizontalGrid() const
Returns whether the grid's horizontal lines are drawn in the table.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
virtual QSizeF fixedFrameSize(int frameIndex=-1) const
Returns the fixed size for a frame, if desired.
double cellMargin() const
Returns the margin distance between cell borders and their contents in mm.
QMap< int, double > mMaxRowHeightMap
Map of maximum height for each row.
virtual void recalculateFrameSizes()
Recalculates the portion of the multiframe item which is shown in each of its component frames.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets multiframe state from a DOM element.
QVector< QVariant > QgsLayoutTableRow
QgsLayoutTableColumns mColumns
Columns to show in table.
@ FollowColumn
Header uses the same alignment as the column.
QString emptyTableMessage() const
Returns the message for empty tables with no content rows.
@ HeaderLeft
Align headers left.
@ AllFrames
Headers shown on all frames.
QFont contentFont() const
Returns the font used to draw text in table body cells.
QFont mHeaderFont
Header font.
WrapBehavior wrapBehavior() const
Returns the wrap behavior for the table, which controls how text within cells is automatically wrappe...
@ EvenColumns
Style even numbered columns.
QFont headerFont() const
Returns the font used to draw header text in the table.