Skip to content

Commit

Permalink
Start of multiframe porting
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 24, 2017
1 parent 6278245 commit 714920f
Show file tree
Hide file tree
Showing 15 changed files with 2,064 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/core/core_auto.sip
Expand Up @@ -406,6 +406,7 @@
%Include layout/qgslayoutcontext.sip
%Include layout/qgslayouteffect.sip
%Include layout/qgslayoutguidecollection.sip
%Include layout/qgslayoutframe.sip
%Include layout/qgslayoutitem.sip
%Include layout/qgslayoutitemgroup.sip
%Include layout/qgslayoutitemlabel.sip
Expand All @@ -422,6 +423,7 @@
%Include layout/qgslayoutitemregistry.sip
%Include layout/qgslayoutitemshape.sip
%Include layout/qgslayoutmodel.sip
%Include layout/qgslayoutmultiframe.sip
%Include layout/qgslayoutpagecollection.sip
%Include layout/qgslayoutobject.sip
%Include layout/qgslayoutundostack.sip
Expand Down
22 changes: 22 additions & 0 deletions python/core/layout/qgslayout.sip
Expand Up @@ -379,6 +379,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

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

QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
Returns the layout's state encapsulated in a DOM element.
Expand Down
115 changes: 115 additions & 0 deletions python/core/layout/qgslayoutframe.sip
@@ -0,0 +1,115 @@
/************************************************************************
* 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

virtual int type() const;

virtual QString stringType() 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


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 *
************************************************************************/
1 change: 1 addition & 0 deletions python/core/layout/qgslayoutitemregistry.sip
Expand Up @@ -109,6 +109,7 @@ class QgsLayoutItemRegistry : QObject
LayoutShape,
LayoutPolygon,
LayoutPolyline,
LayoutFrame,

// item
PluginItem,
Expand Down

0 comments on commit 714920f

Please sign in to comment.