Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #5434 from nyalldawson/layout_next2
Browse files Browse the repository at this point in the history
[layouts] Port item type from composer
  • Loading branch information
nyalldawson committed Nov 7, 2017
2 parents e9e7740 + 36b58a8 commit c000cb8
Show file tree
Hide file tree
Showing 296 changed files with 38,056 additions and 1,164 deletions.
1 change: 1 addition & 0 deletions python/core/composer/qgscomposerlabel.sip
Expand Up @@ -189,6 +189,7 @@ Get font color
%End

public slots:

void refreshExpressionContext();


Expand Down
26 changes: 1 addition & 25 deletions python/core/composer/qgscomposerlegend.sip
Expand Up @@ -11,31 +11,6 @@



class QgsLegendModel : QgsLayerTreeModel
{
%Docstring
Item model implementation based on layer tree model for composer legend.
Overrides some functionality of QgsLayerTreeModel to better fit the needs of composer legend.

.. versionadded:: 2.6
%End

%TypeHeaderCode
#include "qgscomposerlegend.h"
%End
public:
QgsLegendModel( QgsLayerTree *rootNode, QObject *parent /TransferThis/ = 0 );
%Docstring
Construct the model based on the given layer tree
%End

virtual QVariant data( const QModelIndex &index, int role ) const;


virtual Qt::ItemFlags flags( const QModelIndex &index ) const;

};


class QgsComposerLegend : QgsComposerItem
{
Expand All @@ -48,6 +23,7 @@ class QgsComposerLegend : QgsComposerItem
%End
public:
QgsComposerLegend( QgsComposition *composition /TransferThis/ );
~QgsComposerLegend();

virtual int type() const;
%Docstring
Expand Down
15 changes: 13 additions & 2 deletions python/core/core_auto.sip
Expand Up @@ -158,7 +158,7 @@
%Include composer/qgscomposertexttable.sip
%Include composer/qgspaperitem.sip
%Include layout/qgslayoutaligner.sip
%Include layout/qgslayoutcontext.sip
%Include layout/qgslayoutexporter.sip
%Include layout/qgslayoutgridsettings.sip
%Include layout/qgslayoutmeasurement.sip
%Include layout/qgslayoutmeasurementconverter.sip
Expand All @@ -168,7 +168,6 @@
%Include layout/qgslayoutsize.sip
%Include layout/qgslayoutsnapper.sip
%Include layout/qgslayoutundocommand.sip
%Include layout/qgslayoutundostack.sip
%Include layout/qgslayoututils.sip
%Include metadata/qgslayermetadata.sip
%Include metadata/qgslayermetadatavalidator.sip
Expand Down Expand Up @@ -403,16 +402,28 @@
%Include gps/qgsnmeaconnection.sip
%Include gps/qgsgpsdconnection.sip
%Include layout/qgslayout.sip
%Include layout/qgslayoutcontext.sip
%Include layout/qgslayouteffect.sip
%Include layout/qgslayoutguidecollection.sip
%Include layout/qgslayoutitem.sip
%Include layout/qgslayoutitemgroup.sip
%Include layout/qgslayoutitemlabel.sip
%Include layout/qgslayoutitemlegend.sip
%Include layout/qgslayoutitemmap.sip
%Include layout/qgslayoutitemmapgrid.sip
%Include layout/qgslayoutitemmapitem.sip
%Include layout/qgslayoutitemmapoverview.sip
%Include layout/qgslayoutitemnodeitem.sip
%Include layout/qgslayoutitempage.sip
%Include layout/qgslayoutitempicture.sip
%Include layout/qgslayoutitempolygon.sip
%Include layout/qgslayoutitempolyline.sip
%Include layout/qgslayoutitemregistry.sip
%Include layout/qgslayoutitemshape.sip
%Include layout/qgslayoutmodel.sip
%Include layout/qgslayoutpagecollection.sip
%Include layout/qgslayoutobject.sip
%Include layout/qgslayoutundostack.sip
%Include symbology/qgscptcityarchive.sip
%Include symbology/qgssvgcache.sip
%Include symbology/qgsstyle.sip
Expand Down
10 changes: 9 additions & 1 deletion python/core/geometry/qgsrectangle.sip
Expand Up @@ -46,12 +46,20 @@ Copy constructor

static QgsRectangle fromWkt( const QString &wkt );
%Docstring
Creates a new rectangle from a WKT string.
Creates a new rectangle from a ``wkt`` string.
The WKT must contain only 5 vertices, representing a rectangle aligned with X and Y axes.
.. versionadded:: 3.0
:rtype: QgsRectangle
%End

static QgsRectangle fromCenterAndSize( QgsPointXY center, double width, double height );
%Docstring
Creates a new rectangle, given the specified ``center`` point
and ``width`` and ``height``.
.. versionadded:: 3.0
:rtype: QgsRectangle
%End

void set( const QgsPointXY &p1, const QgsPointXY &p2 );
%Docstring
Sets the rectangle from two QgsPoints. The rectangle is
Expand Down
25 changes: 24 additions & 1 deletion python/core/layout/qgslayout.sip
Expand Up @@ -28,7 +28,7 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator, QgsLayoutUndoOb
ZGuide,
ZSmartGuide,
ZMouseHandles,
ZMapTool,
ZViewTool,
ZSnapIndicator,
};

Expand Down Expand Up @@ -62,6 +62,13 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator, QgsLayoutUndoOb
:rtype: QgsLayoutModel
%End

QgsLayoutExporter &exporter();
%Docstring
Returns the layout's exporter, which is used for rendering the layout and exporting
to various formats.
:rtype: QgsLayoutExporter
%End

QString name() const;
%Docstring
Returns the layout's name.
Expand Down Expand Up @@ -419,6 +426,16 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator, QgsLayoutUndoOb

public slots:

void refresh();
%Docstring
Forces the layout, and all items contained within it, to refresh. For instance, this causes maps to redraw
and rebuild cached images, html items to reload their source url, and attribute tables
to refresh their contents. Calling this also triggers a recalculation of all data defined
attributes within the layout.

.. seealso:: refreshed()
%End

void updateBounds();
%Docstring
Updates the scene bounds of the layout.
Expand All @@ -437,6 +454,12 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator, QgsLayoutUndoOb
If None, no item is selected.
%End

void refreshed();
%Docstring
Is emitted when the layout has been refreshed and items should also be refreshed
and updated.
%End

};


Expand Down
42 changes: 41 additions & 1 deletion python/core/layout/qgslayoutcontext.sip
Expand Up @@ -8,7 +8,7 @@



class QgsLayoutContext
class QgsLayoutContext : QObject
{
%Docstring
Stores information relating to the current context and rendering settings for a layout.
Expand Down Expand Up @@ -125,6 +125,14 @@ class QgsLayoutContext
:rtype: QgsLayoutMeasurementConverter
%End

bool isPreviewRender() const;
%Docstring
Returns true if the render current being conducted is a preview render,
i.e. it is being rendered inside a QGraphicsView widget as opposed to a destination
device (such as an image).
:rtype: bool
%End

bool gridVisible() const;
%Docstring
Returns true if the page grid should be drawn.
Expand Down Expand Up @@ -168,11 +176,43 @@ class QgsLayoutContext
:rtype: bool
%End

void setCurrentExportLayer( int layer = -1 );
%Docstring
Sets the current item ``layer`` to draw while exporting. QgsLayoutItem subclasses
which support multi-layer SVG exports must check the currentExportLayer()
and customise their rendering based on the layer.

If ``layer`` is -1, all item layers will be rendered.

.. seealso:: currentExportLayer()
%End

int currentExportLayer() const;
%Docstring
Returns the current item layer to draw while exporting. QgsLayoutItem subclasses
which support multi-layer SVG exports must check this
and customise their rendering based on the layer.

If ``layer`` is -1, all item layers should be rendered.

.. seealso:: setCurrentExportLayer()
:rtype: int
%End

signals:

void flagsChanged( QgsLayoutContext::Flags flags );
%Docstring
Emitted whenever the context's ``flags`` change.
.. seealso:: setFlags()
%End

};





/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
61 changes: 61 additions & 0 deletions python/core/layout/qgslayouteffect.sip
@@ -0,0 +1,61 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayouteffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsLayoutEffect : QGraphicsEffect
{
%Docstring

A QGraphicsEffect subclass used for rendering layout items
onto a scene with custom composition modes.

.. versionadded:: 3.0
%End

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

QgsLayoutEffect();
%Docstring
Constructor for QgsLayoutEffect.
%End

void setCompositionMode( QPainter::CompositionMode mode );
%Docstring
Sets the composition (blending) ``mode`` used for rendering
the item.
.. seealso:: compositionMode()
%End

QPainter::CompositionMode compositionMode() const;
%Docstring
Returns the composition (blending) mode used for rendering
the item.
.. seealso:: setCompositionMode()
:rtype: QPainter.CompositionMode
%End

protected:

virtual void draw( QPainter *painter );

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayouteffect.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
57 changes: 57 additions & 0 deletions python/core/layout/qgslayoutexporter.sip
@@ -0,0 +1,57 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutexporter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsLayoutExporter
{
%Docstring
Handles rendering and exports of layouts to various formats.
.. versionadded:: 3.0
%End

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

QgsLayoutExporter( QgsLayout *layout );
%Docstring
Constructor for QgsLayoutExporter, for the specified ``layout``.
%End

void renderPage( QPainter *painter, int page );
%Docstring
Renders a full page to a destination ``painter``.

The ``page`` argument specifies the page number to render. Page numbers
are 0 based, such that the first page in a layout is page 0.

.. seealso:: renderRect()
%End

void renderRegion( QPainter *painter, const QRectF &region );
%Docstring
Renders a ``region`` from the layout to a ``painter``. This method can be used
to render sections of pages rather than full pages.

.. seealso:: renderPage()
%End

};




/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutexporter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit c000cb8

Please sign in to comment.