QGIS/python/core/auto_generated/layout/qgslayouttable.sip.in

649 lines
15 KiB
Plaintext
Raw Normal View History

2017-11-21 13:17:10 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayouttable.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
typedef QVector< QVariant > QgsLayoutTableRow;
typedef QVector< QVector< QVariant > > QgsLayoutTableContents;
typedef QVector< QgsLayoutTableColumn * > QgsLayoutTableColumns;
class QgsLayoutTableStyle
{
%Docstring
Styling option for a composer table cell
2017-12-15 10:36:55 -04:00
2017-11-21 13:17:10 +10:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayouttable.h"
%End
public:
QgsLayoutTableStyle();
%Docstring
Constructor for QgsLayoutTableStyle
%End
bool enabled;
QColor cellBackgroundColor;
bool writeXml( QDomElement &styleElem, QDomDocument &doc ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Writes the style's properties to XML for storage.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param styleElem: an existing QDomElement in which to store the style's properties.
:param doc: QDomDocument for the destination XML.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`readXml`
2017-11-21 13:17:10 +10:00
%End
bool readXml( const QDomElement &styleElem );
%Docstring
2017-12-15 10:36:55 -04:00
Reads the style's properties from XML.
2017-12-15 21:36:08 -04:00
:param styleElem: a QDomElement holding the style's desired properties.
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`writeXml`
2017-11-21 13:17:10 +10:00
%End
};
class QgsLayoutTable: QgsLayoutMultiFrame
{
%Docstring
2017-12-15 10:36:55 -04:00
A class to display a table in the print layout, and allow
the table to span over multiple frames
2017-11-21 13:17:10 +10:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayouttable.h"
%End
public:
enum HeaderHAlignment
{
FollowColumn,
HeaderLeft,
HeaderCenter,
HeaderRight
};
enum HeaderMode
{
FirstFrame,
AllFrames,
NoHeaders
};
enum EmptyTableMode
{
HeadersOnly,
HideTable,
ShowMessage
};
enum WrapBehavior
{
TruncateText,
WrapText
};
enum CellStyleGroup
{
OddColumns,
EvenColumns,
OddRows,
EvenRows,
FirstColumn,
LastColumn,
HeaderRow,
FirstRow,
LastRow
};
QgsLayoutTable( QgsLayout *layout );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsLayoutTable, belonging to the specified ``layout``.
2017-11-21 13:17:10 +10:00
%End
~QgsLayoutTable();
void setCellMargin( double margin );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``margin`` distance in mm between cell borders and their contents.
.. seealso:: :py:func:`cellMargin`
2017-11-21 13:17:10 +10:00
%End
double cellMargin() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the margin distance between cell borders and their contents in mm.
.. seealso:: :py:func:`setCellMargin`
2017-11-21 13:17:10 +10:00
%End
void setEmptyTableBehavior( EmptyTableMode mode );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the behavior ``mode`` for empty tables with no content rows.
.. seealso:: :py:func:`emptyTableBehavior`
2017-11-21 13:17:10 +10:00
%End
EmptyTableMode emptyTableBehavior() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the behavior mode for empty tables. This property controls
how the table is drawn if it contains no content rows.
.. seealso:: :py:func:`setEmptyTableBehavior`
2017-11-21 13:17:10 +10:00
%End
void setEmptyTableMessage( const QString &message );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``message`` for empty tables with no content rows. This message
is displayed in the table body if the empty table behavior is
set to ShowMessage.
.. seealso:: :py:func:`emptyTableMessage`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setEmptyTableBehavior`
2017-11-21 13:17:10 +10:00
%End
QString emptyTableMessage() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the message for empty tables with no content rows. This message
is displayed in the table body if the empty table behavior is
set to ShowMessage.
.. seealso:: :py:func:`setEmptyTableMessage`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`emptyTableBehavior`
2017-11-21 13:17:10 +10:00
%End
void setShowEmptyRows( bool showEmpty );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether empty rows should be drawn. Tables default to hiding empty rows.
2017-12-15 21:36:08 -04:00
2019-02-26 19:54:09 +10:00
:param showEmpty: set to ``True`` to show empty rows in the table
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`showEmptyRows`
2017-11-21 13:17:10 +10:00
%End
bool showEmptyRows() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns whether empty rows are drawn in the table.
.. seealso:: :py:func:`setShowEmptyRows`
2017-11-21 13:17:10 +10:00
%End
void setHeaderFont( const QFont &font );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``font`` used to draw header text in the table.
.. seealso:: :py:func:`headerFont`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setContentFont`
2017-11-21 13:17:10 +10:00
%End
QFont headerFont() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the font used to draw header text in the table.
.. seealso:: :py:func:`setHeaderFont`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`contentFont`
2017-11-21 13:17:10 +10:00
%End
void setHeaderFontColor( const QColor &color );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``color`` used to draw header text in the table.
.. seealso:: :py:func:`headerFontColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setHeaderFont`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setContentFontColor`
2017-11-21 13:17:10 +10:00
%End
QColor headerFontColor() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the color used to draw header text in the table.
.. seealso:: :py:func:`setHeaderFontColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`headerFont`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`contentFontColor`
2017-11-21 13:17:10 +10:00
%End
void setHeaderHAlignment( HeaderHAlignment alignment );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the horizontal ``alignment`` for table headers.
.. seealso:: :py:func:`headerHAlignment`
2017-11-21 13:17:10 +10:00
%End
HeaderHAlignment headerHAlignment() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the horizontal alignment for table headers.
.. seealso:: :py:func:`setHeaderHAlignment`
2017-11-21 13:17:10 +10:00
%End
void setHeaderMode( HeaderMode mode );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the display ``mode`` for headers in the table. This property controls
if and where headers are shown in the table.
.. seealso:: :py:func:`headerMode`
2017-11-21 13:17:10 +10:00
%End
HeaderMode headerMode() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the display mode for headers in the table. This property controls
if and where headers are shown in the table.
.. seealso:: :py:func:`setHeaderMode`
2017-11-21 13:17:10 +10:00
%End
void setContentFont( const QFont &font );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``font`` used to draw text in table body cells.
.. seealso:: :py:func:`contentFont`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setHeaderFont`
2017-11-21 13:17:10 +10:00
%End
QFont contentFont() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the font used to draw text in table body cells.
.. seealso:: :py:func:`setContentFont`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`headerFont`
2017-11-21 13:17:10 +10:00
%End
void setContentFontColor( const QColor &color );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``color`` used to draw text in table body cells.
.. seealso:: :py:func:`contentFontColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setContentFont`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setHeaderFontColor`
2017-11-21 13:17:10 +10:00
%End
QColor contentFontColor() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the color used to draw text in table body cells.
.. seealso:: :py:func:`setContentFontColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`contentFont`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`headerFontColor`
2017-11-21 13:17:10 +10:00
%End
void setShowGrid( bool showGrid );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether grid lines should be drawn in the table
2017-12-15 21:36:08 -04:00
2019-02-26 19:54:09 +10:00
:param showGrid: set to ``True`` to show grid lines
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`showGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridStrokeWidth`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridColor`
2017-11-21 13:17:10 +10:00
%End
bool showGrid() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns whether grid lines are drawn in the table
.. seealso:: :py:func:`setShowGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`gridStrokeWidth`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`gridColor`
2017-11-21 13:17:10 +10:00
%End
void setGridStrokeWidth( double width );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``width`` in mm for grid lines in the table.
.. seealso:: :py:func:`gridStrokeWidth`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setShowGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridColor`
2017-11-21 13:17:10 +10:00
%End
double gridStrokeWidth() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the width of grid lines in the table in mm.
.. seealso:: :py:func:`setGridStrokeWidth`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`showGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`gridColor`
2017-11-21 13:17:10 +10:00
%End
void setGridColor( const QColor &color );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``color`` used for grid lines in the table.
.. seealso:: :py:func:`gridColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setShowGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridStrokeWidth`
2017-11-21 13:17:10 +10:00
%End
QColor gridColor() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the color used for grid lines in the table.
.. seealso:: :py:func:`setGridColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`showGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`gridStrokeWidth`
2017-11-21 13:17:10 +10:00
%End
void setHorizontalGrid( bool horizontalGrid );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether the grid's horizontal lines should be drawn in the table
2017-12-15 21:36:08 -04:00
2019-02-26 19:54:09 +10:00
:param horizontalGrid: set to ``True`` to draw grid's horizontal lines
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setShowGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridStrokeWidth`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setVerticalGrid`
2017-11-21 13:17:10 +10:00
%End
bool horizontalGrid() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns whether the grid's horizontal lines are drawn in the table.
.. seealso:: :py:func:`setShowGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridStrokeWidth`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setVerticalGrid`
2017-11-21 13:17:10 +10:00
%End
void setVerticalGrid( bool verticalGrid );
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether the grid's vertical lines should be drawn in the table
2017-12-15 21:36:08 -04:00
2019-02-26 19:54:09 +10:00
:param verticalGrid: set to ``True`` to draw grid's vertical lines
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setShowGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridStrokeWidth`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setHorizontalGrid`
2017-11-21 13:17:10 +10:00
%End
bool verticalGrid() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns whether the grid's vertical lines are drawn in the table.
.. seealso:: :py:func:`setShowGrid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridStrokeWidth`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setHorizontalGrid`
2017-11-21 13:17:10 +10:00
%End
void setBackgroundColor( const QColor &color );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``color`` used for background of table.
.. seealso:: :py:func:`backgroundColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setGridColor`
2017-11-21 13:17:10 +10:00
%End
QColor backgroundColor() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the color used for the background of the table.
.. seealso:: :py:func:`setBackgroundColor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`gridColor`
2017-11-21 13:17:10 +10:00
%End
void setWrapBehavior( WrapBehavior behavior );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the wrap ``behavior`` for the table, which controls how text within cells is
automatically wrapped.
.. seealso:: :py:func:`wrapBehavior`
2017-11-21 13:17:10 +10:00
%End
WrapBehavior wrapBehavior() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the wrap behavior for the table, which controls how text within cells is
automatically wrapped.
.. seealso:: :py:func:`setWrapBehavior`
2017-11-21 13:17:10 +10:00
%End
QgsLayoutTableColumns &columns();
%Docstring
2017-12-15 10:36:55 -04:00
Returns a reference to the list of QgsLayoutTableColumns shown in the table
.. seealso:: :py:func:`setColumns`
2017-11-21 13:17:10 +10:00
%End
void setColumns( const QgsLayoutTableColumns &columns );
%Docstring
2017-12-15 10:36:55 -04:00
Replaces the columns in the table with a specified list of QgsLayoutTableColumns.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param columns: list of QgsLayoutTableColumns to show in table.
.. seealso:: :py:func:`columns`
2017-11-21 13:17:10 +10:00
%End
void setCellStyle( CellStyleGroup group, const QgsLayoutTableStyle &style );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the cell ``style`` for a cell ``group``.
.. seealso:: :py:func:`cellStyle`
2017-11-21 13:17:10 +10:00
%End
const QgsLayoutTableStyle *cellStyle( CellStyleGroup group ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the cell style for a cell ``group``.
.. seealso:: :py:func:`setCellStyle`
2017-11-21 13:17:10 +10:00
%End
virtual bool getTableContents( QgsLayoutTableContents &contents ) = 0;
%Docstring
2017-12-15 10:36:55 -04:00
Fetches the contents used for the cells in the table.
2019-02-26 19:54:09 +10:00
:return: ``True`` if table contents were successfully retrieved.
2017-12-15 10:36:55 -04:00
:param contents: QgsLayoutTableContents to store retrieved row data in
2017-11-21 13:17:10 +10:00
%End
QgsLayoutTableContents &contents();
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current contents of the table. Excludes header cells.
2017-11-21 13:17:10 +10:00
%End
virtual QSizeF fixedFrameSize( int frameIndex = -1 ) const;
2017-11-21 13:17:10 +10:00
virtual QSizeF minFrameSize( int frameIndex = -1 ) const;
2017-11-21 13:17:10 +10:00
virtual bool writePropertiesToElement( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
virtual bool readPropertiesFromElement( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context );
virtual QSizeF totalSize() const;
virtual void render( QgsLayoutItemRenderContext &context, const QRectF &renderExtent, int frameIndex );
2017-11-21 13:17:10 +10:00
public slots:
2017-11-22 07:43:05 +10:00
virtual void refresh();
2017-11-21 13:17:10 +10:00
virtual void refreshAttributes();
%Docstring
2017-12-15 10:36:55 -04:00
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.
2017-11-21 13:17:10 +10:00
%End
virtual void recalculateFrameSizes();
protected:
virtual bool calculateMaxColumnWidths();
%Docstring
2017-12-15 10:36:55 -04:00
Calculates the maximum width of text shown in columns.
2017-11-21 13:17:10 +10:00
%End
virtual bool calculateMaxRowHeights();
%Docstring
2017-12-15 10:36:55 -04:00
Calculates the maximum height of text shown in rows.
2017-11-21 13:17:10 +10:00
%End
double totalWidth();
double totalHeight();
int rowsVisible( double frameHeight, int firstRow, bool includeHeader, bool includeEmptyRows ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Calculates how many content rows would be visible within a frame of the specified
height.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param frameHeight: height of frame
:param firstRow: index of first row visible in frame (where 0 = first row in table)
2019-02-26 19:54:09 +10:00
:param includeHeader: set to ``True`` if frame would include a header row
:param includeEmptyRows: set to ``True`` to also include rows which would be empty in the returned count. For instance,
2018-05-27 16:33:02 +10:00
if the frame would include all table content rows and have space left for extra rows then setting this parameter
2019-02-26 19:54:09 +10:00
to ``True`` would also include a count of these extra blank rows.
2017-12-15 10:36:55 -04:00
:return: number of visible content rows (excluding header row)
2017-11-21 13:17:10 +10:00
%End
int rowsVisible( int frameIndex, int firstRow, bool includeEmptyRows ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Calculates how many content rows are visible within a given frame.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param frameIndex: index number for frame
:param firstRow: index of first row visible in frame (where 0 = first row in table)
2019-02-26 19:54:09 +10:00
:param includeEmptyRows: set to ``True`` to also include rows which would be empty in the returned count. For instance,
2018-05-27 16:33:02 +10:00
if the frame would include all table content rows and have space left for extra rows then setting this parameter
2019-02-26 19:54:09 +10:00
to ``True`` would also include a count of these extra blank rows.
2017-12-15 10:36:55 -04:00
:return: number of visible content rows (excludes header rows)
2017-11-21 13:17:10 +10:00
%End
QPair<int, int> rowRange( int frameIndex ) const;
2017-11-21 13:17:10 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Calculates a range of rows which should be visible in a given frame.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param frameIndex: index number for frame
:return: row range
2017-11-21 13:17:10 +10:00
%End
void drawHorizontalGridLines( QPainter *painter, int firstRow, int lastRow, bool drawHeaderLines ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Draws the horizontal grid lines for the table.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param painter: destination painter for grid lines
:param firstRow: index corresponding to first row shown in frame
:param lastRow: index corresponding to last row shown in frame. If greater than the number of content rows in the
table, then the default row height will be used for the remaining rows.
2019-02-26 19:54:09 +10:00
:param drawHeaderLines: set to ``True`` to include for the table header
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`drawVerticalGridLines`
2017-11-21 13:17:10 +10:00
%End
void recalculateTableSize();
%Docstring
2017-12-15 10:36:55 -04:00
Recalculates and updates the size of the table and all table frames.
2017-11-21 13:17:10 +10:00
%End
bool contentsContainsRow( const QgsLayoutTableContents &contents, const QgsLayoutTableRow &row ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Checks whether a table contents contains a given row
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param contents: table contents to check
:param row: row to check for
2019-02-26 19:54:09 +10:00
:return: ``True`` if contents contains rows
2017-11-21 13:17:10 +10:00
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayouttable.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/