QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgslayoutitemmanualtable.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutitemmanualtable.h
3 ---------------------------
4 begin : January 2020
5 copyright : (C) 2020 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSLAYOUTITEMMANUALTABLE_H
19#define QGSLAYOUTITEMMANUALTABLE_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgslayouttable.h"
24#include "qgstablecell.h"
25
31class CORE_EXPORT QgsLayoutItemManualTable : public QgsLayoutTable
32{
33 Q_OBJECT
34
35 public:
42
44
45 int type() const override;
46 QIcon icon() const override;
47 QString displayName() const override;
48
54 QgsConditionalStyle conditionalCellStyle( int row, int column ) const override;
55
62
69
78 QList< double > rowHeights() const { return mRowHeights; }
79
88 void setRowHeights( const QList< double > &heights );
89
98 QList< double > columnWidths() const { return mColumnWidths; }
99
108 void setColumnWidths( const QList< double > &widths );
109
115 bool includeTableHeader() const;
116
122 void setIncludeTableHeader( bool included );
123
128 QgsLayoutTableColumns &headers();
129
134 void setHeaders( const QgsLayoutTableColumns &headers );
135
136 protected:
137 bool writePropertiesToElement( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
138 bool readPropertiesFromElement( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
139 bool calculateMaxRowHeights() override;
140 QgsTextFormat textFormatForHeader( int column ) const override;
141 QgsTextFormat textFormatForCell( int row, int column ) const override;
142 Qt::Alignment horizontalAlignmentForCell( int row, int column ) const override;
143 Qt::Alignment verticalAlignmentForCell( int row, int column ) const override;
144 int rowSpan( int row, int column ) const override;
145 int columnSpan( int row, int column ) const override;
146
147 private:
148 QgsTableContents mContents;
149 QgsLayoutTableColumns mHeaders;
150
151 QList< double > mRowHeights;
152 QList< double > mColumnWidths;
153 bool mIncludeHeader = false;
154
155 void refreshColumns();
156};
157
158#endif // QGSLAYOUTITEMMANUALTABLE_H
Conditional styling for a rule.
static QgsLayoutItemManualTable * create(QgsLayout *layout)
Returns a new QgsLayoutItemManualTable for the specified parent layout.
void setTableContents(const QgsTableContents &contents)
Sets the contents of the table.
QList< double > rowHeights() const
Returns the list of row heights (in millimeters) to use when rendering the table.
QList< double > columnWidths() const
Returns the list of column widths (in millimeters) to use when rendering the table.
QgsLayoutItemManualTable(QgsLayout *layout)
Constructor for QgsLayoutItemManualTable, attached to the specified layout.
QgsTableContents tableContents() const
Returns the contents of the table.
virtual int type() const =0
Returns unique multiframe type id.
virtual QIcon icon() const
Returns the item's icon.
virtual QString displayName() const
Returns the multiframe display name.
const QgsLayout * layout() const
Returns the layout the object is attached to.
QgsLayoutTable(QgsLayout *layout)
Constructor for QgsLayoutTable, belonging to the specified layout.
virtual Qt::Alignment horizontalAlignmentForCell(int row, int column) const
Returns the horizontal alignment to use for the cell at the specified row and column.
virtual QgsConditionalStyle conditionalCellStyle(int row, int column) const
Returns the conditional style to use for the cell at row, column.
virtual int rowSpan(int row, int column) const
Returns the row span for the cell a row, column.
virtual QgsTextFormat textFormatForHeader(int column) const
Returns the text format to use for the header cell at the specified column.
virtual bool getTableContents(QgsLayoutTableContents &contents)=0
Fetches the contents used for the cells in the table.
virtual Qt::Alignment verticalAlignmentForCell(int row, int column) const
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.
virtual int columnSpan(int row, int column) const
Returns the column span for the cell a row, column.
virtual QgsTextFormat textFormatForCell(int row, int column) const
Returns the text format 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.
QgsLayoutTableContents & contents()
Returns the current contents of the table.
virtual bool calculateMaxRowHeights()
Calculates the maximum height of text shown in rows.
A container for the context for various read/write operations on objects.
Container for all settings relating to text rendering.
QVector< QgsLayoutTableColumn > QgsLayoutTableColumns
List of column definitions for a QgsLayoutTable.
QVector< QgsLayoutTableRow > QgsLayoutTableContents
List of QgsLayoutTableRows, representing rows and column cell contents for a QgsLayoutTable.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_FACTORY
Definition qgis_sip.h:83
QVector< QgsTableRow > QgsTableContents
A set of table rows.