Skip to content
Permalink
Browse files

Port shape items to layouts

  • Loading branch information
nyalldawson committed Jul 17, 2017
1 parent 38cbbe2 commit b4f5025d4fb8f8b1d32ba577bed2d1596dc290f8
@@ -383,6 +383,7 @@
%Include layout/qgslayoutitem.sip
%Include layout/qgslayoutitemmap.sip
%Include layout/qgslayoutitemregistry.sip
%Include layout/qgslayoutitemshape.sip
%Include layout/qgslayoutobject.sip
%Include symbology-ng/qgscptcityarchive.sip
%Include symbology-ng/qgssvgcache.sip
@@ -101,6 +101,9 @@ class QgsLayoutItemRegistry : QObject

// known
LayoutPage,
LayoutRectangle,
LayoutEllipse,
LayoutTriangle,

// item
PluginItem,
@@ -0,0 +1,156 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitemshape.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsLayoutItemShape : QgsLayoutItem
{
%Docstring
Base class for layout items which are basic shapes (e.g. rectangles, ellipses).
.. versionadded:: 3.0
%End

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

void setSymbol( QgsFillSymbol *symbol );
%Docstring
Sets the fill ``symbol`` used to draw the shape. Ownership is not transferred
and a clone of the symbol is made.
.. seealso:: symbol()
%End

QgsFillSymbol *symbol();
%Docstring
Returns the fill symbol used to draw the shape.
.. seealso:: setSymbol()
:rtype: QgsFillSymbol
%End

protected:

explicit QgsLayoutItemShape( QgsLayout *layout );
%Docstring
Constructor for QgsLayoutItemShape, with the specified parent ``layout``.
%End

};


class QgsLayoutItemRectangularShape : QgsLayoutItemShape
{
%Docstring
A rectangular shape item for layouts.
.. versionadded:: 3.0
%End

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

explicit QgsLayoutItemRectangularShape( QgsLayout *layout );
%Docstring
Constructor for QgsLayoutItemRectangularShape, with the specified parent ``layout``.
%End
virtual int type() const;

static QgsLayoutItemRectangularShape *create( QgsLayout *layout, const QVariantMap &settings ) /Factory/;
%Docstring
:rtype: QgsLayoutItemRectangularShape
%End

void setCornerRadius( QgsLayoutMeasurement radius );
%Docstring
Sets the corner ``radius`` for rounded rectangle corners.
.. seealso:: cornerRadius()
%End

QgsLayoutMeasurement cornerRadius() const;
%Docstring
Returns the corner radius for rounded rectangle corners.
.. seealso:: setCornerRadius()
:rtype: QgsLayoutMeasurement
%End

protected:

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


};

class QgsLayoutItemEllipseShape : QgsLayoutItemShape
{
%Docstring
A ellipse shape item for layouts.
.. versionadded:: 3.0
%End

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

explicit QgsLayoutItemEllipseShape( QgsLayout *layout );
%Docstring
Constructor for QgsLayoutItemEllipseShape, with the specified parent ``layout``.
%End
virtual int type() const;

static QgsLayoutItemEllipseShape *create( QgsLayout *layout, const QVariantMap &settings ) /Factory/;
%Docstring
:rtype: QgsLayoutItemEllipseShape
%End

protected:

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


};

class QgsLayoutItemTriangleShape : QgsLayoutItemShape
{
%Docstring
A triangle shape item for layouts.
.. versionadded:: 3.0
%End

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

explicit QgsLayoutItemTriangleShape( QgsLayout *layout );
%Docstring
Constructor for QgsLayoutItemTriangleShape, with the specified parent ``layout``.
%End
virtual int type() const;

static QgsLayoutItemTriangleShape *create( QgsLayout *layout, const QVariantMap &settings ) /Factory/;
%Docstring
:rtype: QgsLayoutItemTriangleShape
%End

protected:

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


};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitemshape.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -179,6 +179,36 @@ class QgsLayoutViewEllipticalRubberBand : QgsLayoutViewRubberBand
virtual QRectF finish( QPointF position = QPointF(), Qt::KeyboardModifiers modifiers = 0 );


};

class QgsLayoutViewTriangleRubberBand : QgsLayoutViewRubberBand
{
%Docstring
QgsLayoutViewTriangleRubberBand is triangular rubber band for use within QgsLayoutView widgets.
.. versionadded:: 3.0
%End

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

QgsLayoutViewTriangleRubberBand( QgsLayoutView *view = 0 );
%Docstring
Constructor for QgsLayoutViewTriangleRubberBand.
%End
virtual QgsLayoutViewTriangleRubberBand *create( QgsLayoutView *view ) const /Factory/;


~QgsLayoutViewTriangleRubberBand();

virtual void start( QPointF position, Qt::KeyboardModifiers modifiers );

virtual void update( QPointF position, Qt::KeyboardModifiers modifiers );

virtual QRectF finish( QPointF position = QPointF(), Qt::KeyboardModifiers modifiers = 0 );


};
/************************************************************************
* This file has been generated automatically from *
@@ -354,6 +354,7 @@ SET(QGIS_CORE_SRCS
layout/qgslayoutitem.cpp
layout/qgslayoutitemmap.cpp
layout/qgslayoutitemregistry.cpp
layout/qgslayoutitemshape.cpp
layout/qgslayoutmeasurement.cpp
layout/qgslayoutmeasurementconverter.cpp
layout/qgslayoutobject.cpp
@@ -677,6 +678,7 @@ SET(QGIS_CORE_MOC_HDRS
layout/qgslayoutitem.h
layout/qgslayoutitemmap.h
layout/qgslayoutitemregistry.h
layout/qgslayoutitemshape.h
layout/qgslayoutobject.h

symbology-ng/qgscptcityarchive.h
@@ -15,6 +15,7 @@
***************************************************************************/

#include "qgslayoutitemregistry.h"
#include "qgslayoutitemshape.h"
#include "qgsgloweffect.h"
#include "qgseffectstack.h"
#include <QPainter>
@@ -41,6 +42,10 @@ bool QgsLayoutItemRegistry::populate()
};

addLayoutItemType( new QgsLayoutItemMetadata( 101, QStringLiteral( "temp type" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddLabel.svg" ) ), createTemporaryItem ) );
addLayoutItemType( new QgsLayoutItemMetadata( LayoutRectangle, QStringLiteral( "Rectangle" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicRectangle.svg" ) ), QgsLayoutItemRectangularShape::create ) );
addLayoutItemType( new QgsLayoutItemMetadata( LayoutEllipse, QStringLiteral( "Ellipse" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicCircle.svg" ) ), QgsLayoutItemEllipseShape::create ) );
addLayoutItemType( new QgsLayoutItemMetadata( LayoutTriangle, QStringLiteral( "Triangle" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicTriangle.svg" ) ), QgsLayoutItemTriangleShape::create ) );

return true;
}

@@ -183,6 +183,9 @@ class CORE_EXPORT QgsLayoutItemRegistry : public QObject

// known item types
LayoutPage, //!< Page items
LayoutRectangle, //!< Rectangular shape item
LayoutEllipse, //!< Ellipse shape item
LayoutTriangle, //!< Triangle shape item

// item types provided by plugins
PluginItem, //!< Starting point for plugin item types

0 comments on commit b4f5025

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