1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayouttable.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
typedef QVector< QVariant > QgsLayoutTableRow;
typedef QVector< QVector< QVariant > > QgsLayoutTableContents;
typedef QVector<QgsLayoutTableColumn> QgsLayoutTableColumns;
typedef QVector<QgsLayoutTableColumn> QgsLayoutTableSortColumns;
class QgsLayoutTableStyle
{
%Docstring(signature="appended")
Styling option for a layout table cell
%End
%TypeHeaderCode
#include "qgslayouttable.h"
%End
public:
QgsLayoutTableStyle();
bool enabled;
QColor cellBackgroundColor;
bool writeXml( QDomElement &styleElem, QDomDocument &doc ) const;
%Docstring
Writes the style's properties to XML for storage.
:param styleElem: an existing QDomElement in which to store the style's
properties.
:param doc: QDomDocument for the destination XML.
.. seealso:: :py:func:`readXml`
%End
bool readXml( const QDomElement &styleElem );
%Docstring
Reads the style's properties from XML.
:param styleElem: a QDomElement holding the style's desired properties.
.. seealso:: :py:func:`writeXml`
%End
};
class QgsLayoutTable: QgsLayoutMultiFrame
{
%Docstring(signature="appended")
A class to display a table in the print layout, and allow the table to
span over multiple frames
%End
%TypeHeaderCode
#include "qgslayouttable.h"
%End
public:
enum HeaderHAlignment /BaseType=IntEnum/
{
FollowColumn,
HeaderLeft,
HeaderCenter,
HeaderRight
};
enum HeaderMode /BaseType=IntEnum/
{
FirstFrame,
AllFrames,
NoHeaders
};
enum EmptyTableMode /BaseType=IntEnum/
{
HeadersOnly,
HideTable,
ShowMessage
};
enum WrapBehavior /BaseType=IntEnum/
{
TruncateText,
WrapText
};
enum CellStyleGroup /BaseType=IntEnum/
{
OddColumns,
EvenColumns,
OddRows,
EvenRows,
FirstColumn,
LastColumn,
HeaderRow,
FirstRow,
LastRow
};
QgsLayoutTable( QgsLayout *layout );
%Docstring
Constructor for QgsLayoutTable, belonging to the specified ``layout``.
%End
~QgsLayoutTable();
void setCellMargin( double margin );
%Docstring
Sets the ``margin`` distance in mm between cell borders and their
contents.
.. seealso:: :py:func:`cellMargin`
%End
double cellMargin() const;
%Docstring
Returns the margin distance between cell borders and their contents in
mm.
.. seealso:: :py:func:`setCellMargin`
%End
void setEmptyTableBehavior( EmptyTableMode mode );
%Docstring
Sets the behavior ``mode`` for empty tables with no content rows.
.. seealso:: :py:func:`emptyTableBehavior`
%End
EmptyTableMode emptyTableBehavior() const;
%Docstring
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`
%End
void setEmptyTableMessage( const QString &message );
%Docstring
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`
.. seealso:: :py:func:`setEmptyTableBehavior`
%End
QString emptyTableMessage() const;
%Docstring
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`
.. seealso:: :py:func:`emptyTableBehavior`
%End
void setShowEmptyRows( bool showEmpty );
%Docstring
Sets whether empty rows should be drawn. Tables default to hiding empty
rows.
:param showEmpty: set to ``True`` to show empty rows in the table
.. seealso:: :py:func:`showEmptyRows`
%End
bool showEmptyRows() const;
%Docstring
Returns whether empty rows are drawn in the table.
.. seealso:: :py:func:`setShowEmptyRows`
%End
void setHeaderFont( const QFont &font ) /Deprecated/;
%Docstring
Sets the ``font`` used to draw header text in the table.
.. seealso:: :py:func:`headerFont`
.. seealso:: :py:func:`setContentFont`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutTable.setHeaderTextFormat` instead.
%End
QFont headerFont() const /Deprecated/;
%Docstring
Returns the font used to draw header text in the table.
.. seealso:: :py:func:`setHeaderFont`
.. seealso:: :py:func:`contentFont`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutTable.headerTextFormat` instead.
%End
void setHeaderFontColor( const QColor &color ) /Deprecated/;
%Docstring
Sets the ``color`` used to draw header text in the table.
.. seealso:: :py:func:`headerFontColor`
.. seealso:: :py:func:`setHeaderFont`
.. seealso:: :py:func:`setContentFontColor`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutTable.setHeaderTextFormat` instead.
%End
QColor headerFontColor() const /Deprecated/;
%Docstring
Returns the color used to draw header text in the table.
.. seealso:: :py:func:`setHeaderFontColor`
.. seealso:: :py:func:`headerFont`
.. seealso:: :py:func:`contentFontColor`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutTable.headerTextFormat` instead.
%End
void setHeaderTextFormat( const QgsTextFormat &format );
%Docstring
Sets the ``format`` used to draw header text in the table.
.. seealso:: :py:func:`headerTextFormat`
.. seealso:: :py:func:`setContentTextFormat`
.. versionadded:: 3.16
%End
QgsTextFormat headerTextFormat() const;
%Docstring
Returns the format used to draw header text in the table.
.. seealso:: :py:func:`setHeaderTextFormat`
.. seealso:: :py:func:`contentTextFormat`
.. versionadded:: 3.16
%End
void setHeaderHAlignment( HeaderHAlignment alignment );
%Docstring
Sets the horizontal ``alignment`` for table headers.
.. seealso:: :py:func:`headerHAlignment`
%End
HeaderHAlignment headerHAlignment() const;
%Docstring
Returns the horizontal alignment for table headers.
.. seealso:: :py:func:`setHeaderHAlignment`
%End
void setHeaderMode( HeaderMode mode );
%Docstring
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`
%End
HeaderMode headerMode() const;
%Docstring
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`
%End
void setContentFont( const QFont &font ) /Deprecated/;
%Docstring
Sets the ``font`` used to draw text in table body cells.
.. seealso:: :py:func:`contentFont`
.. seealso:: :py:func:`setHeaderFont`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutTable.setContentTextFormat` instead.
%End
QFont contentFont() const /Deprecated/;
%Docstring
Returns the font used to draw text in table body cells.
.. seealso:: :py:func:`setContentFont`
.. seealso:: :py:func:`headerFont`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutTable.contextTextFormat` instead.
%End
void setContentFontColor( const QColor &color ) /Deprecated/;
%Docstring
Sets the ``color`` used to draw text in table body cells.
.. seealso:: :py:func:`contentFontColor`
.. seealso:: :py:func:`setContentFont`
.. seealso:: :py:func:`setHeaderFontColor`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutTable.setContentTextFormat` instead.
%End
QColor contentFontColor() const /Deprecated/;
%Docstring
Returns the color used to draw text in table body cells.
.. seealso:: :py:func:`setContentFontColor`
.. seealso:: :py:func:`contentFont`
.. seealso:: :py:func:`headerFontColor`
.. deprecated:: 3.40
Use :py:func:`~QgsLayoutTable.contextTextFormat` instead.
%End
void setContentTextFormat( const QgsTextFormat &format );
%Docstring
Sets the ``format`` used to draw content text in the table.
.. seealso:: :py:func:`contentTextFormat`
.. seealso:: :py:func:`setHeaderTextFormat`
.. versionadded:: 3.16
%End
QgsTextFormat contentTextFormat() const;
%Docstring
Returns the format used to draw content text in the table.
.. seealso:: :py:func:`setContentTextFormat`
.. seealso:: :py:func:`headerTextFormat`
.. versionadded:: 3.16
%End
void setShowGrid( bool showGrid );
%Docstring
Sets whether grid lines should be drawn in the table
:param showGrid: set to ``True`` to show grid lines
.. seealso:: :py:func:`showGrid`
.. seealso:: :py:func:`setGridStrokeWidth`
.. seealso:: :py:func:`setGridColor`
%End
bool showGrid() const;
%Docstring
Returns whether grid lines are drawn in the table
.. seealso:: :py:func:`setShowGrid`
.. seealso:: :py:func:`gridStrokeWidth`
.. seealso:: :py:func:`gridColor`
%End
void setGridStrokeWidth( double width );
%Docstring
Sets the ``width`` in mm for grid lines in the table.
.. seealso:: :py:func:`gridStrokeWidth`
.. seealso:: :py:func:`setShowGrid`
.. seealso:: :py:func:`setGridColor`
%End
double gridStrokeWidth() const;
%Docstring
Returns the width of grid lines in the table in mm.
.. seealso:: :py:func:`setGridStrokeWidth`
.. seealso:: :py:func:`showGrid`
.. seealso:: :py:func:`gridColor`
%End
void setGridColor( const QColor &color );
%Docstring
Sets the ``color`` used for grid lines in the table.
.. seealso:: :py:func:`gridColor`
.. seealso:: :py:func:`setShowGrid`
.. seealso:: :py:func:`setGridStrokeWidth`
%End
QColor gridColor() const;
%Docstring
Returns the color used for grid lines in the table.
.. seealso:: :py:func:`setGridColor`
.. seealso:: :py:func:`showGrid`
.. seealso:: :py:func:`gridStrokeWidth`
%End
void setHorizontalGrid( bool horizontalGrid );
%Docstring
Sets whether the grid's horizontal lines should be drawn in the table
:param horizontalGrid: set to ``True`` to draw grid's horizontal lines
.. seealso:: :py:func:`setShowGrid`
.. seealso:: :py:func:`setGridStrokeWidth`
.. seealso:: :py:func:`setGridColor`
.. seealso:: :py:func:`setVerticalGrid`
%End
bool horizontalGrid() const;
%Docstring
Returns whether the grid's horizontal lines are drawn in the table.
.. seealso:: :py:func:`setShowGrid`
.. seealso:: :py:func:`setGridStrokeWidth`
.. seealso:: :py:func:`setGridColor`
.. seealso:: :py:func:`setVerticalGrid`
%End
void setVerticalGrid( bool verticalGrid );
%Docstring
Sets whether the grid's vertical lines should be drawn in the table
:param verticalGrid: set to ``True`` to draw grid's vertical lines
.. seealso:: :py:func:`setShowGrid`
.. seealso:: :py:func:`setGridStrokeWidth`
.. seealso:: :py:func:`setGridColor`
.. seealso:: :py:func:`setHorizontalGrid`
%End
bool verticalGrid() const;
%Docstring
Returns whether the grid's vertical lines are drawn in the table.
.. seealso:: :py:func:`setShowGrid`
.. seealso:: :py:func:`setGridStrokeWidth`
.. seealso:: :py:func:`setGridColor`
.. seealso:: :py:func:`setHorizontalGrid`
%End
void setBackgroundColor( const QColor &color );
%Docstring
Sets the ``color`` used for background of table.
.. seealso:: :py:func:`backgroundColor`
.. seealso:: :py:func:`setGridColor`
%End
QColor backgroundColor() const;
%Docstring
Returns the color used for the background of the table.
.. seealso:: :py:func:`setBackgroundColor`
.. seealso:: :py:func:`gridColor`
%End
void setWrapBehavior( WrapBehavior behavior );
%Docstring
Sets the wrap ``behavior`` for the table, which controls how text within
cells is automatically wrapped.
.. seealso:: :py:func:`wrapBehavior`
%End
WrapBehavior wrapBehavior() const;
%Docstring
Returns the wrap behavior for the table, which controls how text within
cells is automatically wrapped.
.. seealso:: :py:func:`setWrapBehavior`
%End
QgsLayoutTableColumns &columns();
%Docstring
Returns a reference to the list of :py:class:`QgsLayoutTableColumns`
shown in the table
.. seealso:: :py:func:`setColumns`
%End
void setColumns( const QgsLayoutTableColumns &columns );
%Docstring
Replaces the columns in the table with a specified list of
:py:class:`QgsLayoutTableColumns`.
:param columns: list of :py:class:`QgsLayoutTableColumns` to show in
table.
.. seealso:: :py:func:`columns`
%End
QgsLayoutTableSortColumns &sortColumns();
%Docstring
Returns a reference to the list of :py:class:`QgsLayoutTableSortColumns`
shown in the table.
.. warning::
It is expected that the :py:func:`QgsLayoutTableColumn.attribute()` values in the columns
are valid QGIS expression values, and that column references are correctly escaped accordingly.
.. seealso:: :py:func:`setSortColumns`
.. versionadded:: 3.14
%End
void setSortColumns( const QgsLayoutTableSortColumns &sortColumns );
%Docstring
Replaces the sorting columns in the table with a specified list of
:py:class:`QgsLayoutTableSortColumns`.
:param sortColumns: list of :py:class:`QgsLayoutTableColumns` used to
sort the table.
.. warning::
It is expected that the :py:func:`QgsLayoutTableColumn.attribute()` values in ``sortColumns``
are valid QGIS expression values, and that column references are correctly escaped accordingly.
.. seealso:: :py:func:`sortColumns`
.. versionadded:: 3.14
%End
void setCellStyle( CellStyleGroup group, const QgsLayoutTableStyle &style );
%Docstring
Sets the cell ``style`` for a cell ``group``.
.. seealso:: :py:func:`cellStyle`
%End
const QgsLayoutTableStyle *cellStyle( CellStyleGroup group ) const;
%Docstring
Returns the cell style for a cell ``group``.
.. seealso:: :py:func:`setCellStyle`
%End
virtual bool getTableContents( QgsLayoutTableContents &contents ) = 0;
%Docstring
Fetches the contents used for the cells in the table.
:return: ``True`` if table contents were successfully retrieved.
:param contents: :py:class:`QgsLayoutTableContents` to store retrieved
row data in
%End
virtual QgsConditionalStyle conditionalCellStyle( int row, int column ) const;
%Docstring
Returns the conditional style to use for the cell at ``row``,
``column``.
.. versionadded:: 3.12
%End
virtual QgsExpressionContextScope *scopeForCell( int row, int column ) const /Factory/;
%Docstring
Creates a new :py:class:`QgsExpressionContextScope` for the cell at
``row``, ``column``.
.. versionadded:: 3.16
%End
virtual int rowSpan( int row, int column ) const;
%Docstring
Returns the row span for the cell a ``row``, ``column``.
.. seealso:: :py:func:`columnSpan`
.. versionadded:: 3.40
%End
virtual int columnSpan( int row, int column ) const;
%Docstring
Returns the column span for the cell a ``row``, ``column``.
.. seealso:: :py:func:`rowSpan`
.. versionadded:: 3.40
%End
QgsLayoutTableContents &contents();
%Docstring
Returns the current contents of the table. Excludes header cells.
%End
virtual QSizeF fixedFrameSize( int frameIndex = -1 ) const;
virtual QSizeF minFrameSize( int frameIndex = -1 ) const;
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 );
public slots:
virtual void refresh();
virtual void refreshAttributes();
%Docstring
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.
%End
virtual void recalculateFrameSizes();
protected:
virtual bool calculateMaxColumnWidths();
%Docstring
Calculates the maximum width of text shown in columns.
%End
virtual bool calculateMaxRowHeights();
%Docstring
Calculates the maximum height of text shown in rows.
%End
double totalWidth();
double totalHeight();
int rowsVisible( QgsRenderContext &context, double frameHeight, int firstRow, bool includeHeader, bool includeEmptyRows ) const;
%Docstring
Calculates how many content rows would be visible within a frame of the
specified height.
:param context: render context
:param frameHeight: height of frame
:param firstRow: index of first row visible in frame (where 0 = first
row in table)
: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, if the frame would include all table
content rows and have space left for extra rows
then setting this parameter to ``True`` would
also include a count of these extra blank rows.
:return: number of visible content rows (excluding header row)
%End
int rowsVisible( QgsRenderContext &context, int frameIndex, int firstRow, bool includeEmptyRows ) const;
%Docstring
Calculates how many content rows are visible within a given frame.
:param context: render context
:param frameIndex: index number for frame
:param firstRow: index of first row visible in frame (where 0 = first
row in table)
:param includeEmptyRows: set to ``True`` to also include rows which
would be empty in the returned count. For
instance, if the frame would include all table
content rows and have space left for extra rows
then setting this parameter to ``True`` would
also include a count of these extra blank rows.
:return: number of visible content rows (excludes header rows)
%End
QPair<int, int> rowRange( QgsRenderContext &context, int frameIndex ) const;
%Docstring
Calculates a range of rows which should be visible in a given frame.
:param context: render context
:param frameIndex: index number for frame
:return: row range
%End
void drawHorizontalGridLines( QgsLayoutItemRenderContext &context, int firstRow, int lastRow, bool drawHeaderLines ) const;
%Docstring
Draws the horizontal grid lines for the table.
:param context: destination render context
: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.
:param drawHeaderLines: set to ``True`` to include for the table header
.. seealso:: :py:func:`drawVerticalGridLines`
%End
void recalculateTableSize();
%Docstring
Recalculates and updates the size of the table and all table frames.
%End
bool contentsContainsRow( const QgsLayoutTableContents &contents, const QgsLayoutTableRow &row ) const;
%Docstring
Checks whether a table contents contains a given row
:param contents: table contents to check
:param row: row to check for
:return: ``True`` if contents contains rows
%End
virtual QgsTextFormat textFormatForCell( int row, int column ) const;
%Docstring
Returns the text format to use for the cell at the specified ``row`` and
``column``.
.. seealso:: :py:func:`textFormatForHeader`
.. versionadded:: 3.16
%End
virtual QgsTextFormat textFormatForHeader( int column ) const;
%Docstring
Returns the text format to use for the header cell at the specified
``column``.
.. seealso:: :py:func:`textFormatForCell`
.. versionadded:: 3.16
%End
virtual Qt::Alignment horizontalAlignmentForCell( int row, int column ) const;
%Docstring
Returns the horizontal alignment to use for the cell at the specified
``row`` and ``column``.
.. seealso:: :py:func:`verticalAlignmentForCell`
.. versionadded:: 3.16
%End
virtual Qt::Alignment verticalAlignmentForCell( int row, int column ) const;
%Docstring
Returns the vertical alignment to use for the cell at the specified
``row`` and ``column``.
.. seealso:: :py:func:`horizontalAlignmentForCell`
.. versionadded:: 3.16
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayouttable.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|