Skip to content

Commit

Permalink
Merge pull request #4928 from nyalldawson/layout_next
Browse files Browse the repository at this point in the history
Layout chapter IV: snapping and guides
  • Loading branch information
nyalldawson authored Aug 7, 2017
2 parents f802c56 + 14546ec commit 5a64f58
Show file tree
Hide file tree
Showing 65 changed files with 4,996 additions and 122 deletions.
3 changes: 3 additions & 0 deletions python/core/core_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@
%Include composer/qgscomposertexttable.sip
%Include composer/qgspaperitem.sip
%Include layout/qgslayoutcontext.sip
%Include layout/qgslayoutgridsettings.sip
%Include layout/qgslayoutmeasurement.sip
%Include layout/qgslayoutmeasurementconverter.sip
%Include layout/qgspagesizeregistry.sip
%Include layout/qgslayoutpoint.sip
%Include layout/qgslayoutsize.sip
%Include layout/qgslayoutsnapper.sip
%Include layout/qgslayoututils.sip
%Include metadata/qgslayermetadata.sip
%Include metadata/qgslayermetadatavalidator.sip
Expand Down Expand Up @@ -382,6 +384,7 @@
%Include gps/qgsnmeaconnection.sip
%Include gps/qgsgpsdconnection.sip
%Include layout/qgslayout.sip
%Include layout/qgslayoutguidecollection.sip
%Include layout/qgslayoutitem.sip
%Include layout/qgslayoutitemmap.sip
%Include layout/qgslayoutitempage.sip
Expand Down
30 changes: 30 additions & 0 deletions python/core/layout/qgslayout.sip
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator
enum ZValues
{
ZPage,
ZItem,
ZGrid,
ZGuide,
ZMapTool,
ZSnapIndicator,
};

QgsLayout( QgsProject *project );
Expand All @@ -35,6 +39,8 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator
called on the new layout.
%End

~QgsLayout();

void initializeDefaults();
%Docstring
Initializes an empty layout, e.g. by adding a default page to the layout. This should be called after creating
Expand Down Expand Up @@ -139,6 +145,29 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator
%End


QgsLayoutSnapper &snapper();
%Docstring
Returns a reference to the layout's snapper, which stores handles layout snap grids and lines
and snapping points to the nearest matching point.
:rtype: QgsLayoutSnapper
%End


QgsLayoutGridSettings &gridSettings();
%Docstring
Returns a reference to the layout's grid settings, which stores settings relating
to grid appearance, spacing and offsets.
:rtype: QgsLayoutGridSettings
%End


QgsLayoutGuideCollection &guides();
%Docstring
Returns a reference to the layout's guide collection, which manages page snap guides.
:rtype: QgsLayoutGuideCollection
%End


virtual QgsExpressionContext createExpressionContext() const;

%Docstring
Expand Down Expand Up @@ -201,6 +230,7 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator
:rtype: QgsLayoutPageCollection
%End


QRectF layoutBounds( bool ignorePages = false, double margin = 0.0 ) const;
%Docstring
Calculates the bounds of all non-gui items in the layout. Ignores snap lines, mouse handles
Expand Down
13 changes: 13 additions & 0 deletions python/core/layout/qgslayoutcontext.sip
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ class QgsLayoutContext
:rtype: QgsLayoutMeasurementConverter
%End

bool gridVisible() const;
%Docstring
Returns true if the page grid should be drawn.
.. seealso:: setGridVisible()
:rtype: bool
%End

void setGridVisible( bool visible );
%Docstring
Sets whether the page grid should be ``visible``.
.. seealso:: gridVisible()
%End

};


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



class QgsLayoutGridSettings
{
%Docstring
Contains settings relating to the appearance, spacing and offset for layout grids.
.. versionadded:: 3.0
%End

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

enum Style
{
StyleLines,
StyleDots,
StyleCrosses
};

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

void setResolution( const QgsLayoutMeasurement &resolution );
%Docstring
Sets the page/snap grid ``resolution``.
.. seealso:: resolution()
.. seealso:: setOffset()
%End

QgsLayoutMeasurement resolution() const;
%Docstring
Returns the page/snap grid resolution.
.. seealso:: setResolution()
.. seealso:: offset()
:rtype: QgsLayoutMeasurement
%End

void setOffset( const QgsLayoutPoint offset );
%Docstring
Sets the ``offset`` of the page/snap grid.
.. seealso:: offset()
.. seealso:: setResolution()
%End

QgsLayoutPoint offset() const;
%Docstring
Returns the offset of the page/snap grid.
.. seealso:: setOffset()
.. seealso:: resolution()
:rtype: QgsLayoutPoint
%End

void setPen( const QPen &pen );
%Docstring
Sets the ``pen`` used for drawing page/snap grids.
.. seealso:: pen()
.. seealso:: setStyle()
%End

QPen pen() const;
%Docstring
Returns the pen used for drawing page/snap grids.
.. seealso:: setPen()
.. seealso:: style()
:rtype: QPen
%End

void setStyle( const Style style );
%Docstring
Sets the ``style`` used for drawing the page/snap grids.
.. seealso:: style()
.. seealso:: setPen()
%End

Style style() const;
%Docstring
Returns the style used for drawing the page/snap grids.
.. seealso:: setStyle()
.. seealso:: pen()
:rtype: Style
%End

};

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

0 comments on commit 5a64f58

Please sign in to comment.