Skip to content

Commit 714920f

Browse files
committed
Start of multiframe porting
1 parent 6278245 commit 714920f

15 files changed

+2064
-0
lines changed

python/core/core_auto.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@
406406
%Include layout/qgslayoutcontext.sip
407407
%Include layout/qgslayouteffect.sip
408408
%Include layout/qgslayoutguidecollection.sip
409+
%Include layout/qgslayoutframe.sip
409410
%Include layout/qgslayoutitem.sip
410411
%Include layout/qgslayoutitemgroup.sip
411412
%Include layout/qgslayoutitemlabel.sip
@@ -422,6 +423,7 @@
422423
%Include layout/qgslayoutitemregistry.sip
423424
%Include layout/qgslayoutitemshape.sip
424425
%Include layout/qgslayoutmodel.sip
426+
%Include layout/qgslayoutmultiframe.sip
425427
%Include layout/qgslayoutpagecollection.sip
426428
%Include layout/qgslayoutobject.sip
427429
%Include layout/qgslayoutundostack.sip

python/core/layout/qgslayout.sip

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,28 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator, QgsLayoutUndoOb
379379
The item will also be deleted.
380380
%End
381381

382+
void addMultiFrame( QgsLayoutMultiFrame *multiFrame /Transfer/ );
383+
%Docstring
384+
Adds a ``multiFrame`` to the layout. The object is owned by the layout until removeMultiFrame() is called.
385+
.. seealso:: removeMultiFrame()
386+
.. seealso:: multiFrames()
387+
%End
388+
389+
void removeMultiFrame( QgsLayoutMultiFrame *multiFrame );
390+
%Docstring
391+
Removes a ``multiFrame`` from the layout (but does not delete it).
392+
.. seealso:: addMultiFrame()
393+
.. seealso:: multiFrames()
394+
%End
395+
396+
QSet< QgsLayoutMultiFrame * > multiFrames() const;
397+
%Docstring
398+
Returns a list of multi frames contained in the layout.
399+
.. seealso:: addMultiFrame()
400+
.. seealso:: removeMultiFrame()
401+
:rtype: set of QgsLayoutMultiFrame
402+
%End
403+
382404
QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const;
383405
%Docstring
384406
Returns the layout's state encapsulated in a DOM element.

python/core/layout/qgslayoutframe.sip

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/layout/qgslayoutframe.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsLayoutFrame: QgsLayoutItem
13+
{
14+
%Docstring
15+
Base class for frame items, which form a layout multiframe item.
16+
.. versionadded:: 3.0
17+
%End
18+
19+
%TypeHeaderCode
20+
#include "qgslayoutframe.h"
21+
%End
22+
public:
23+
24+
QgsLayoutFrame( QgsLayout *layout, QgsLayoutMultiFrame *multiFrame );
25+
%Docstring
26+
Constructor for QgsLayoutFrame, with the specified parent ``layout``
27+
and belonging to a ``multiFrame``.
28+
%End
29+
30+
virtual int type() const;
31+
32+
virtual QString stringType() const;
33+
34+
35+
virtual QString displayName() const;
36+
37+
38+
void setContentSection( const QRectF &section );
39+
%Docstring
40+
Sets the visible part of the multiframe's content which is visible within
41+
this frame (relative to the total multiframe extent in layout units).
42+
.. seealso:: extent()
43+
%End
44+
45+
QgsLayoutMultiFrame *multiFrame() const;
46+
%Docstring
47+
Returns the parent multiframe for the frame.
48+
:rtype: QgsLayoutMultiFrame
49+
%End
50+
51+
52+
QRectF extent() const;
53+
%Docstring
54+
Returns the visible portion of the multi frame's content which
55+
is shown in this frame, in layout units.
56+
.. seealso:: setContentSection()
57+
:rtype: QRectF
58+
%End
59+
60+
bool hidePageIfEmpty() const;
61+
%Docstring
62+
Returns whether the page should be hidden (ie, not included in layout exports) if this frame is empty
63+
:return: true if page should be hidden if frame is empty
64+
.. seealso:: setHidePageIfEmpty()
65+
:rtype: bool
66+
%End
67+
68+
void setHidePageIfEmpty( const bool hidePageIfEmpty );
69+
%Docstring
70+
Sets whether the page should be hidden (ie, not included in layout exports) if this frame is empty
71+
\param hidePageIfEmpty set to true if page should be hidden if frame is empty
72+
.. seealso:: hidePageIfEmpty()
73+
%End
74+
75+
bool hideBackgroundIfEmpty() const;
76+
%Docstring
77+
Returns whether the background and frame stroke should be hidden if this frame is empty
78+
:return: true if background and stroke should be hidden if frame is empty
79+
.. seealso:: setHideBackgroundIfEmpty()
80+
:rtype: bool
81+
%End
82+
83+
void setHideBackgroundIfEmpty( const bool hideBackgroundIfEmpty );
84+
%Docstring
85+
Sets whether the background and frame stroke should be hidden if this frame is empty
86+
\param hideBackgroundIfEmpty set to true if background and stroke should be hidden if frame is empty
87+
.. seealso:: hideBackgroundIfEmpty()
88+
%End
89+
90+
bool isEmpty() const;
91+
%Docstring
92+
Returns whether the frame is empty.
93+
.. seealso:: hidePageIfEmpty()
94+
:rtype: bool
95+
%End
96+
97+
virtual QgsExpressionContext createExpressionContext() const;
98+
99+
100+
protected:
101+
102+
virtual void draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 );
103+
104+
void drawFrame( QgsRenderContext &context );
105+
void drawBackground( QgsRenderContext &context );
106+
107+
};
108+
109+
/************************************************************************
110+
* This file has been generated automatically from *
111+
* *
112+
* src/core/layout/qgslayoutframe.h *
113+
* *
114+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
115+
************************************************************************/

python/core/layout/qgslayoutitemregistry.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class QgsLayoutItemRegistry : QObject
109109
LayoutShape,
110110
LayoutPolygon,
111111
LayoutPolyline,
112+
LayoutFrame,
112113

113114
// item
114115
PluginItem,

0 commit comments

Comments
 (0)