Skip to content
Permalink
Browse files

Merge pull request #5717 from nyalldawson/layout_next4

[layouts] Port/adapt all remaining item types
  • Loading branch information
nyalldawson committed Dec 1, 2017
2 parents c12770d + cc29f0e commit bcc1b91b7438efd64a4df52072f2707886436918
Showing with 22,005 additions and 155 deletions.
  1. +8 −0 python/core/core_auto.sip
  2. +31 −0 python/core/layout/qgslayout.sip
  3. +128 −0 python/core/layout/qgslayoutframe.sip
  4. +48 −4 python/core/layout/qgslayoutitem.sip
  5. +296 −0 python/core/layout/qgslayoutitemattributetable.sip
  6. +1 −1 python/core/layout/qgslayoutitemgroup.sip
  7. +243 −0 python/core/layout/qgslayoutitemhtml.sip
  8. +9 −0 python/core/layout/qgslayoutitemnodeitem.sip
  9. +134 −0 python/core/layout/qgslayoutitempolyline.sip
  10. +102 −0 python/core/layout/qgslayoutitemregistry.sip
  11. +459 −0 python/core/layout/qgslayoutitemscalebar.sip
  12. +76 −0 python/core/layout/qgslayoutitemtexttable.sip
  13. +370 −0 python/core/layout/qgslayoutmultiframe.sip
  14. +59 −0 python/core/layout/qgslayoutpagecollection.sip
  15. +589 −0 python/core/layout/qgslayouttable.sip
  16. +206 −0 python/core/layout/qgslayouttablecolumn.sip
  17. +25 −0 python/core/layout/qgslayoutundostack.sip
  18. +6 −0 python/gui/layout/qgslayoutnewitempropertiesdialog.sip
  19. +10 −0 src/app/CMakeLists.txt
  20. +137 −2 src/app/layout/qgslayoutapputils.cpp
  21. +1,073 −0 src/app/layout/qgslayoutattributeselectiondialog.cpp
  22. +321 −0 src/app/layout/qgslayoutattributeselectiondialog.h
  23. +967 −0 src/app/layout/qgslayoutattributetablewidget.cpp
  24. +99 −0 src/app/layout/qgslayoutattributetablewidget.h
  25. +463 −0 src/app/layout/qgslayouthtmlwidget.cpp
  26. +79 −0 src/app/layout/qgslayouthtmlwidget.h
  27. +296 −0 src/app/layout/qgslayoutpolylinewidget.cpp
  28. +17 −1 src/app/layout/qgslayoutpolylinewidget.h
  29. +711 −0 src/app/layout/qgslayoutscalebarwidget.cpp
  30. +85 −0 src/app/layout/qgslayoutscalebarwidget.h
  31. +122 −0 src/app/layout/qgslayouttablebackgroundcolorsdialog.cpp
  32. +67 −0 src/app/layout/qgslayouttablebackgroundcolorsdialog.h
  33. +18 −0 src/core/CMakeLists.txt
  34. +12 −13 src/core/composer/qgscomposerhtml.cpp
  35. +3 −0 src/core/composer/qgscomposerscalebar.cpp
  36. +48 −6 src/core/layout/qgslayout.cpp
  37. +35 −1 src/core/layout/qgslayout.h
  38. +234 −0 src/core/layout/qgslayoutframe.cpp
  39. +141 −0 src/core/layout/qgslayoutframe.h
  40. +0 −4 src/core/layout/qgslayoutguidecollection.cpp
  41. +48 −6 src/core/layout/qgslayoutitem.cpp
  42. +45 −4 src/core/layout/qgslayoutitem.h
  43. +787 −0 src/core/layout/qgslayoutitemattributetable.cpp
  44. +361 −0 src/core/layout/qgslayoutitemattributetable.h
  45. +9 −4 src/core/layout/qgslayoutitemgroup.cpp
  46. +1 −1 src/core/layout/qgslayoutitemgroup.h
  47. +546 −0 src/core/layout/qgslayoutitemhtml.cpp
  48. +279 −0 src/core/layout/qgslayoutitemhtml.h
  49. +6 −5 src/core/layout/qgslayoutitemmap.cpp
  50. +2 −2 src/core/layout/qgslayoutitemnodeitem.cpp
  51. +10 −5 src/core/layout/qgslayoutitemnodeitem.h
  52. +296 −0 src/core/layout/qgslayoutitempolyline.cpp
  53. +171 −0 src/core/layout/qgslayoutitempolyline.h
  54. +47 −6 src/core/layout/qgslayoutitemregistry.cpp
  55. +160 −0 src/core/layout/qgslayoutitemregistry.h
  56. +820 −0 src/core/layout/qgslayoutitemscalebar.cpp
  57. +461 −0 src/core/layout/qgslayoutitemscalebar.h
  58. +85 −0 src/core/layout/qgslayoutitemtexttable.cpp
  59. +77 −0 src/core/layout/qgslayoutitemtexttable.h
  60. +519 −0 src/core/layout/qgslayoutmultiframe.cpp
  61. +385 −0 src/core/layout/qgslayoutmultiframe.h
  62. +161 −0 src/core/layout/qgslayoutmultiframeundocommand.cpp
  63. +141 −0 src/core/layout/qgslayoutmultiframeundocommand.h
  64. +99 −0 src/core/layout/qgslayoutpagecollection.cpp
  65. +53 −0 src/core/layout/qgslayoutpagecollection.h
  66. +1,273 −0 src/core/layout/qgslayouttable.cpp
  67. +683 −0 src/core/layout/qgslayouttable.h
  68. +90 −0 src/core/layout/qgslayouttablecolumn.cpp
  69. +204 −0 src/core/layout/qgslayouttablecolumn.h
  70. +33 −5 src/core/layout/qgslayoutundostack.cpp
  71. +26 −0 src/core/layout/qgslayoutundostack.h
  72. +13 −6 src/core/scalebar/qgsdoubleboxscalebarrenderer.cpp
  73. +7 −4 src/core/scalebar/qgsnumericscalebarrenderer.cpp
  74. +9 −6 src/core/scalebar/qgsscalebarrenderer.cpp
  75. +9 −4 src/core/scalebar/qgssingleboxscalebarrenderer.cpp
  76. +14 −10 src/core/scalebar/qgsticksscalebarrenderer.cpp
  77. +10 −1 src/gui/layout/qgslayoutitemguiregistry.cpp
  78. +3 −7 src/gui/layout/qgslayoutitemwidget.cpp
  79. +2 −2 src/gui/layout/qgslayoutmousehandles.cpp
  80. +16 −2 src/gui/layout/qgslayoutnewitempropertiesdialog.cpp
  81. +9 −0 src/gui/layout/qgslayoutnewitempropertiesdialog.h
  82. +22 −2 src/gui/layout/qgslayoutviewtooladditem.cpp
  83. +342 −0 src/ui/layout/qgslayoutattributeselectiondialogbase.ui
  84. +910 −0 src/ui/layout/qgslayoutattributetablewidgetbase.ui
  85. +339 −0 src/ui/layout/qgslayouthtmlwidgetbase.ui
  86. +81 −35 src/ui/layout/qgslayoutnewitemproperties.ui
  87. +245 −3 src/ui/layout/qgslayoutpolylinewidgetbase.ui
  88. +778 −0 src/ui/layout/qgslayoutscalebarwidgetbase.ui
  89. +547 −0 src/ui/layout/qgslayouttablebackgroundstyles.ui
  90. +4 −0 tests/src/core/CMakeLists.txt
  91. +140 −0 tests/src/core/testqgslayout.cpp
  92. +320 −0 tests/src/core/testqgslayouthtml.cpp
  93. +105 −2 tests/src/core/testqgslayoutitem.cpp
  94. +563 −0 tests/src/core/testqgslayoutmultiframe.cpp
  95. +277 −0 tests/src/core/testqgslayoutscalebar.cpp
  96. +1,332 −0 tests/src/core/testqgslayouttable.cpp
  97. +1 −0 tests/src/python/CMakeLists.txt
  98. +137 −0 tests/src/python/test_qgslayouthtml.py
  99. +5 −1 tests/src/python/test_qgslayoutitempropertiesdialog.py
  100. +159 −0 tests/src/python/test_qgslayoutpagecollection.py
  101. BIN ...ml/expected_composerhtml_expressions_disabled/expected_composerhtml_expressions_disabled_mask.png
  102. BIN ...html/expected_composerhtml_expressions_enabled/expected_composerhtml_expressions_enabled_mask.png
  103. BIN ...a/control_images/composer_html/expected_composerhtml_manual/expected_composerhtml_manual_mask.png
  104. BIN ...images/composer_html/expected_composerhtml_multiframe1/expected_composerhtml_multiframe1_mask.png
  105. BIN ...images/composer_html/expected_composerhtml_multiframe2/expected_composerhtml_multiframe2_mask.png
  106. BIN ...ages/composer_html/expected_composerhtml_smartbreaks1/expected_composerhtml_smartbreaks1_mask.png
  107. BIN ...ages/composer_html/expected_composerhtml_smartbreaks2/expected_composerhtml_smartbreaks2_mask.png
  108. BIN ...ata/control_images/composer_html/expected_composerhtml_table/expected_composerhtml_table_mask.png
  109. BIN .../composer_html/expected_composerhtml_userstylesheet/expected_composerhtml_userstylesheet_mask.png
  110. BIN ...mposer_picture/expected_composerpicture_resize_clip/expected_composerpicture_resize_clip_mask.png
  111. BIN ...omposer_scalebar/expected_composerscalebar_doublebox/expected_composerscalebar_doublebox_mask.png
  112. BIN ...es/composer_scalebar/expected_composerscalebar_numeric/expected_composerscalebar_numeric_mask.png
  113. BIN ...omposer_scalebar/expected_composerscalebar_singlebox/expected_composerscalebar_singlebox_mask.png
  114. BIN ...ebar/expected_composerscalebar_singlebox_alpha/expected_composerscalebar_singlebox_alpha_mask.png
  115. BIN ...l_images/composer_scalebar/expected_composerscalebar_tick/expected_composerscalebar_tick_mask.png
  116. BIN ...mposer_table/expected_composerattributetable_align/expected_composerattributetable_align_mask.png
  117. BIN ..._table/expected_composerattributetable_autowrap/expected_composerattributetable_autowrap_mask.png
  118. BIN ...able/expected_composerattributetable_cellstyle/expected_composerattributetable_cellstyle_mask.png
  119. BIN .../expected_composerattributetable_columnwidth/expected_composerattributetable_columnwidth_mask.png
  120. BIN ...able/expected_composerattributetable_drawempty/expected_composerattributetable_drawempty_mask.png
  121. BIN .../expected_composerattributetable_headersonly/expected_composerattributetable_headersonly_mask.png
  122. BIN ...able/expected_composerattributetable_hidetable/expected_composerattributetable_hidetable_mask.png
  123. BIN ...ted_composerattributetable_horizontalgrid/expected_composerattributetable_horizontalgrid_mask.png
  124. BIN ...able/expected_composerattributetable_multiline/expected_composerattributetable_multiline_mask.png
  125. BIN ...oser_table/expected_composerattributetable_render/expected_composerattributetable_render_mask.png
  126. BIN .../expected_composerattributetable_showmessage/expected_composerattributetable_showmessage_mask.png
  127. BIN ...xpected_composerattributetable_verticalgrid/expected_composerattributetable_verticalgrid_mask.png
  128. BIN ...ol_images/layout_scalebar/expected_layoutscalebar_doublebox/expected_layoutscalebar_doublebox.png
  129. BIN ...images/layout_scalebar/expected_layoutscalebar_numeric/fedora/expected_layoutscalebar_numeric.png
  130. BIN ...images/layout_scalebar/expected_layoutscalebar_numeric/travis/expected_layoutscalebar_numeric.png
  131. BIN ...ol_images/layout_scalebar/expected_layoutscalebar_singlebox/expected_layoutscalebar_singlebox.png
  132. BIN ...yout_scalebar/expected_layoutscalebar_singlebox_alpha/expected_layoutscalebar_singlebox_alpha.png
  133. BIN ...data/control_images/layout_scalebar/expected_layoutscalebar_tick/expected_layoutscalebar_tick.png
@@ -407,8 +407,11 @@
%Include layout/qgslayoutcontext.sip
%Include layout/qgslayouteffect.sip
%Include layout/qgslayoutguidecollection.sip
%Include layout/qgslayoutframe.sip
%Include layout/qgslayoutitem.sip
%Include layout/qgslayoutitemattributetable.sip
%Include layout/qgslayoutitemgroup.sip
%Include layout/qgslayoutitemhtml.sip
%Include layout/qgslayoutitemlabel.sip
%Include layout/qgslayoutitemlegend.sip
%Include layout/qgslayoutitemmap.sip
@@ -421,10 +424,15 @@
%Include layout/qgslayoutitempolygon.sip
%Include layout/qgslayoutitempolyline.sip
%Include layout/qgslayoutitemregistry.sip
%Include layout/qgslayoutitemscalebar.sip
%Include layout/qgslayoutitemshape.sip
%Include layout/qgslayoutitemtexttable.sip
%Include layout/qgslayoutmodel.sip
%Include layout/qgslayoutmultiframe.sip
%Include layout/qgslayoutpagecollection.sip
%Include layout/qgslayoutobject.sip
%Include layout/qgslayouttable.sip
%Include layout/qgslayouttablecolumn.sip
%Include layout/qgslayoutundostack.sip
%Include symbology/qgscptcityarchive.sip
%Include symbology/qgssvgcache.sip
@@ -175,9 +175,18 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator, QgsLayoutUndoOb
%Docstring
Returns the layout item with matching ``uuid`` unique identifier, or a None
if a matching item could not be found.
.. seealso:: multiFrameByUuid()
:rtype: QgsLayoutItem
%End

QgsLayoutMultiFrame *multiFrameByUuid( const QString &uuid ) const;
%Docstring
Returns the layout multiframe with matching ``uuid`` unique identifier, or a None
if a matching multiframe could not be found.
.. seealso:: itemByUuid()
:rtype: QgsLayoutMultiFrame
%End

QgsLayoutItem *layoutItemAt( QPointF position, const bool ignoreLocked = false ) const;
%Docstring
Returns the topmost layout item at a specified ``position``. Ignores paper items.
@@ -379,6 +388,28 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator, QgsLayoutUndoOb
The item will also be deleted.
%End

void addMultiFrame( QgsLayoutMultiFrame *multiFrame /Transfer/ );
%Docstring
Adds a ``multiFrame`` to the layout. The object is owned by the layout until removeMultiFrame() is called.
.. seealso:: removeMultiFrame()
.. seealso:: multiFrames()
%End

void removeMultiFrame( QgsLayoutMultiFrame *multiFrame );
%Docstring
Removes a ``multiFrame`` from the layout (but does not delete it).
.. seealso:: addMultiFrame()
.. seealso:: multiFrames()
%End

QList< QgsLayoutMultiFrame * > multiFrames() const;
%Docstring
Returns a list of multi frames contained in the layout.
.. seealso:: addMultiFrame()
.. seealso:: removeMultiFrame()
:rtype: list of QgsLayoutMultiFrame
%End

QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
Returns the layout's state encapsulated in a DOM element.
@@ -0,0 +1,128 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutframe.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsLayoutFrame: QgsLayoutItem
{
%Docstring
Base class for frame items, which form a layout multiframe item.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgslayoutframe.h"
%End
public:

QgsLayoutFrame( QgsLayout *layout, QgsLayoutMultiFrame *multiFrame );
%Docstring
Constructor for QgsLayoutFrame, with the specified parent ``layout``
and belonging to a ``multiFrame``.
%End

static QgsLayoutFrame *create( QgsLayout *layout ) /Factory/;
%Docstring
Creates a new QgsLayoutFrame belonging to the specified ``layout``.
:rtype: QgsLayoutFrame
%End

virtual int type() const;

virtual QString stringType() const;

virtual QString uuid() const;


virtual QString displayName() const;


void setContentSection( const QRectF &section );
%Docstring
Sets the visible part of the multiframe's content which is visible within
this frame (relative to the total multiframe extent in layout units).
.. seealso:: extent()
%End

QgsLayoutMultiFrame *multiFrame() const;
%Docstring
Returns the parent multiframe for the frame.
:rtype: QgsLayoutMultiFrame
%End

virtual QgsLayoutSize minimumSize() const;

virtual QgsLayoutSize fixedSize() const;



QRectF extent() const;
%Docstring
Returns the visible portion of the multi frame's content which
is shown in this frame, in layout units.
.. seealso:: setContentSection()
:rtype: QRectF
%End

bool hidePageIfEmpty() const;
%Docstring
Returns whether the page should be hidden (ie, not included in layout exports) if this frame is empty
:return: true if page should be hidden if frame is empty
.. seealso:: setHidePageIfEmpty()
:rtype: bool
%End

void setHidePageIfEmpty( const bool hidePageIfEmpty );
%Docstring
Sets whether the page should be hidden (ie, not included in layout exports) if this frame is empty
\param hidePageIfEmpty set to true if page should be hidden if frame is empty
.. seealso:: hidePageIfEmpty()
%End

bool hideBackgroundIfEmpty() const;
%Docstring
Returns whether the background and frame stroke should be hidden if this frame is empty
:return: true if background and stroke should be hidden if frame is empty
.. seealso:: setHideBackgroundIfEmpty()
:rtype: bool
%End

void setHideBackgroundIfEmpty( const bool hideBackgroundIfEmpty );
%Docstring
Sets whether the background and frame stroke should be hidden if this frame is empty
\param hideBackgroundIfEmpty set to true if background and stroke should be hidden if frame is empty
.. seealso:: hideBackgroundIfEmpty()
%End

bool isEmpty() const;
%Docstring
Returns whether the frame is empty.
.. seealso:: hidePageIfEmpty()
:rtype: bool
%End

virtual QgsExpressionContext createExpressionContext() const;


protected:

virtual void draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 );

void drawFrame( QgsRenderContext &context );
void drawBackground( QgsRenderContext &context );

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutframe.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -105,6 +105,24 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
UndoLegendGroupFont,
UndoLegendLayerFont,
UndoLegendItemFont,
UndoScaleBarLineWidth,
UndoScaleBarSegmentSize,
UndoScaleBarSegmentsLeft,
UndoScaleBarSegments,
UndoScaleBarHeight,
UndoScaleBarFontColor,
UndoScaleBarFillColor,
UndoScaleBarFillColor2,
UndoScaleBarStrokeColor,
UndoScaleBarUnitText,
UndoScaleBarMapUnitsSegment,
UndoScaleBarLabelBarSize,
UndoScaleBarBoxContentSpace,
UndoArrowStrokeWidth,
UndoArrowHeadWidth,
UndoArrowHeadFillColor,
UndoArrowHeadStrokeColor,

UndoCustomCommand,
};

@@ -135,7 +153,7 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
:rtype: str
%End

QString uuid() const;
virtual QString uuid() const;
%Docstring
Returns the item identification string. This is a unique random string set for the item
upon creation.
@@ -262,7 +280,7 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
:rtype: ReferencePoint
%End

QgsLayoutSize fixedSize() const;
virtual QgsLayoutSize fixedSize() const;
%Docstring
Returns the fixed size of the item, if applicable, or an empty size if item can be freely
resized.
@@ -296,7 +314,7 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
.. seealso:: sizeWithUnits()
%End

virtual void attemptMove( const QgsLayoutPoint &point, bool useReferencePoint = true, bool includesFrame = false );
virtual void attemptMove( const QgsLayoutPoint &point, bool useReferencePoint = true, bool includesFrame = false, int page = -1 );
%Docstring
Attempts to move the item to a specified ``point``.

@@ -310,6 +328,10 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
If ``includesFrame`` is true, then the position specified by ``point`` represents the
point at which to place the outside of the item's frame.

If ``page`` is not left at the default -1 value, then the position specified by ``point``
refers to the relative position on the corresponding layout ``page`` (where a ``page``
of 0 represents the first page).

Note that the final position of the item may not match the specified target position,
as data defined item position may override the specified value.

@@ -318,7 +340,6 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
.. seealso:: positionWithUnits()
%End


void attemptSetSceneRect( const QRectF &rect, bool includesFrame = false );
%Docstring
Attempts to update the item's position and size to match the passed ``rect`` in layout
@@ -347,6 +368,29 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
:rtype: QgsLayoutPoint
%End

int page() const;
%Docstring
Returns the page the item is currently on, with the first page returning 0.
.. seealso:: pagePos()
:rtype: int
%End

QPointF pagePos() const;
%Docstring
Returns the item's position (in layout units) relative to the top left corner of its current page.
.. seealso:: page()
.. seealso:: pagePositionWithUnits()
:rtype: QPointF
%End

QgsLayoutPoint pagePositionWithUnits() const;
%Docstring
Returns the item's position (in item units) relative to the top left corner of its current page.
.. seealso:: page()
.. seealso:: pagePos()
:rtype: QgsLayoutPoint
%End

QgsLayoutSize sizeWithUnits() const;
%Docstring
Returns the item's current size, including units.

0 comments on commit bcc1b91

Please sign in to comment.
You can’t perform that action at this time.