Skip to content
Permalink
Browse files

More work on porting multiframe items

  • Loading branch information
nyalldawson committed Nov 24, 2017
1 parent 2cf9911 commit dddce25e131bbb982ff9b96f43ecf193fe34e50a
@@ -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.
@@ -9,6 +9,108 @@



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 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 *
@@ -74,6 +74,70 @@ class QgsLayoutItemAbstractMetadata



class QgsLayoutMultiFrameAbstractMetadata
{
%Docstring
Stores metadata about one layout multiframe class.

A companion class, QgsLayoutMultiFrameAbstractGuiMetadata, handles the
GUI behavior of QgsLayoutMultiFrames.

.. note::

In C++ you can use QgsLayoutMultiFrameMetadata convenience class.
.. versionadded:: 3.0
%End

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

QgsLayoutMultiFrameAbstractMetadata( int type, const QString &visibleName );
%Docstring
Constructor for QgsLayoutMultiFrameAbstractMetadata with the specified class ``type``
and ``visibleName``.
%End

virtual ~QgsLayoutMultiFrameAbstractMetadata();

int type() const;
%Docstring
Returns the unique item type code for the layout multiframe class.
:rtype: int
%End

virtual QIcon icon() const;
%Docstring
Returns an icon representing the layout multiframe type.
:rtype: QIcon
%End

QString visibleName() const;
%Docstring
Returns a translated, user visible name for the layout multiframe class.
:rtype: str
%End

virtual QgsLayoutMultiFrame *createMultiFrame( QgsLayout *layout ) = 0 /Factory/;
%Docstring
Creates a layout multiframe of this class for a specified ``layout``.
:rtype: QgsLayoutMultiFrame
%End

virtual void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
%Docstring
Resolve paths in the item's ``properties`` (if there are any paths).
When ``saving`` is true, paths are converted from absolute to relative,
when ``saving`` is false, paths are converted from relative to absolute.
This ensures that paths in project files can be relative, but in item
instances the paths are always absolute.
%End

};





class QgsLayoutItemRegistry : QObject
@@ -111,6 +175,9 @@ class QgsLayoutItemRegistry : QObject
LayoutPolyline,
LayoutFrame,

// known
LayoutHtml,

// item
PluginItem,
};
@@ -139,21 +206,46 @@ class QgsLayoutItemRegistry : QObject
%Docstring
Returns the metadata for the specified item ``type``. Returns None if
a corresponding type was not found in the registry.
.. seealso:: multiFrameMetadata()
:rtype: QgsLayoutItemAbstractMetadata
%End

QgsLayoutMultiFrameAbstractMetadata *multiFrameMetadata( int type ) const;
%Docstring
Returns the metadata for the specified multiframe ``type``. Returns None if
a corresponding type was not found in the registry.
.. seealso:: itemMetadata()
:rtype: QgsLayoutMultiFrameAbstractMetadata
%End

bool addLayoutItemType( QgsLayoutItemAbstractMetadata *metadata /Transfer/ );
%Docstring
Registers a new layout item type. Takes ownership of the metadata instance.
.. seealso:: addLayoutMultiFrameType()
:rtype: bool
%End

bool addLayoutMultiFrameType( QgsLayoutMultiFrameAbstractMetadata *metadata /Transfer/ );
%Docstring
Registers a new layout multiframe type. Takes ownership of the metadata instance.
.. seealso:: addLayoutItemType()
:rtype: bool
%End

QgsLayoutItem *createItem( int type, QgsLayout *layout ) const /Factory/;
%Docstring
Creates a new instance of a layout item given the item ``type``, and target ``layout``.
.. seealso:: createMultiFrame()
:rtype: QgsLayoutItem
%End

QgsLayoutMultiFrame *createMultiFrame( int type, QgsLayout *layout ) const /Factory/;
%Docstring
Creates a new instance of a layout multiframe given the multiframe ``type``, and target ``layout``.
.. seealso:: createItem()
:rtype: QgsLayoutMultiFrame
%End

void resolvePaths( int type, QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving ) const;
%Docstring
Resolve paths in properties of a particular symbol layer.
@@ -175,6 +267,12 @@ class QgsLayoutItemRegistry : QObject
``type`` and visible ``name``.
%End

void multiFrameTypeAdded( int type, const QString &name );
%Docstring
Emitted whenever a new multiframe type is added to the registry, with the specified
``type`` and visible ``name``.
%End

private:
QgsLayoutItemRegistry( const QgsLayoutItemRegistry &rh );
};

0 comments on commit dddce25

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