Skip to content
Permalink
Browse files

Merge pull request #4928 from nyalldawson/layout_next

Layout chapter IV: snapping and guides
  • Loading branch information
nyalldawson committed Aug 7, 2017
2 parents f802c56 + 14546ec commit 5a64f586a67008297b20ad26194c6494f9d4419f
Showing with 4,996 additions and 122 deletions.
  1. +3 −0 python/core/core_auto.sip
  2. +30 −0 python/core/layout/qgslayout.sip
  3. +13 −0 python/core/layout/qgslayoutcontext.sip
  4. +103 −0 python/core/layout/qgslayoutgridsettings.sip
  5. +276 −0 python/core/layout/qgslayoutguidecollection.sip
  6. +5 −0 python/core/layout/qgslayoutitem.sip
  7. +10 −0 python/core/layout/qgslayoutitempage.sip
  8. +38 −0 python/core/layout/qgslayoutpagecollection.sip
  9. +117 −0 python/core/layout/qgslayoutsnapper.sip
  10. +15 −5 python/gui/layout/qgslayoutruler.sip
  11. +36 −2 python/gui/layout/qgslayoutview.sip
  12. +18 −2 python/gui/layout/qgslayoutviewmouseevent.sip
  13. +20 −0 python/gui/layout/qgslayoutviewtool.sip
  14. +4 −0 src/app/CMakeLists.txt
  15. +2 −0 src/app/layout/qgslayoutaddpagesdialog.cpp
  16. +104 −0 src/app/layout/qgslayoutdesignerdialog.cpp
  17. +26 −0 src/app/layout/qgslayoutdesignerdialog.h
  18. +196 −0 src/app/layout/qgslayoutguidewidget.cpp
  19. +100 −0 src/app/layout/qgslayoutguidewidget.h
  20. +4 −0 src/app/layout/qgslayoutpagepropertieswidget.cpp
  21. +110 −0 src/app/layout/qgslayoutpropertieswidget.cpp
  22. +49 −0 src/app/layout/qgslayoutpropertieswidget.h
  23. +6 −0 src/core/CMakeLists.txt
  24. +24 −0 src/core/layout/qgslayout.cpp
  25. +53 −0 src/core/layout/qgslayout.h
  26. +10 −0 src/core/layout/qgslayoutcontext.cpp
  27. +15 −0 src/core/layout/qgslayoutcontext.h
  28. +25 −0 src/core/layout/qgslayoutgridsettings.cpp
  29. +114 −0 src/core/layout/qgslayoutgridsettings.h
  30. +500 −0 src/core/layout/qgslayoutguidecollection.cpp
  31. +309 −0 src/core/layout/qgslayoutguidecollection.h
  32. +24 −2 src/core/layout/qgslayoutitem.cpp
  33. +5 −0 src/core/layout/qgslayoutitem.h
  34. +120 −0 src/core/layout/qgslayoutitempage.cpp
  35. +32 −0 src/core/layout/qgslayoutitempage.h
  36. +2 −2 src/core/layout/qgslayoutobject.h
  37. +39 −0 src/core/layout/qgslayoutpagecollection.cpp
  38. +35 −0 src/core/layout/qgslayoutpagecollection.h
  39. +148 −0 src/core/layout/qgslayoutsnapper.cpp
  40. +128 −0 src/core/layout/qgslayoutsnapper.h
  41. +349 −11 src/gui/layout/qgslayoutruler.cpp
  42. +42 −3 src/gui/layout/qgslayoutruler.h
  43. +137 −17 src/gui/layout/qgslayoutview.cpp
  44. +70 −2 src/gui/layout/qgslayoutview.h
  45. +12 −4 src/gui/layout/qgslayoutviewmouseevent.cpp
  46. +20 −2 src/gui/layout/qgslayoutviewmouseevent.h
  47. +11 −0 src/gui/layout/qgslayoutviewtool.cpp
  48. +21 −0 src/gui/layout/qgslayoutviewtool.h
  49. +5 −4 src/gui/layout/qgslayoutviewtooladditem.cpp
  50. +1 −1 src/gui/layout/qgslayoutviewtoolpan.cpp
  51. +1 −1 src/gui/layout/qgslayoutviewtooltemporarykeypan.cpp
  52. +1 −1 src/gui/layout/qgslayoutviewtooltemporarymousepan.cpp
  53. +2 −2 src/gui/layout/qgslayoutviewtoolzoom.cpp
  54. +116 −1 src/ui/layout/qgslayoutdesignerbase.ui
  55. +313 −0 src/ui/layout/qgslayoutguidewidgetbase.ui
  56. +1 −1 src/ui/layout/qgslayoutnewpagedialog.ui
  57. +94 −58 src/ui/layout/qgslayoutpagepropertieswidget.ui
  58. +239 −0 src/ui/layout/qgslayoutwidgetbase.ui
  59. +29 −0 tests/src/core/testqgslayoutitem.cpp
  60. +34 −0 tests/src/core/testqgslayoutpage.cpp
  61. +3 −0 tests/src/python/CMakeLists.txt
  62. +55 −0 tests/src/python/test_qgslayoutgridsettings.py
  63. +320 −0 tests/src/python/test_qgslayoutguides.py
  64. +54 −1 tests/src/python/test_qgslayoutpagecollection.py
  65. +198 −0 tests/src/python/test_qgslayoutsnapper.py
@@ -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
@@ -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
@@ -23,7 +23,11 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator
enum ZValues
{
ZPage,
ZItem,
ZGrid,
ZGuide,
ZMapTool,
ZSnapIndicator,
};

QgsLayout( QgsProject *project );
@@ -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
@@ -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
@@ -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
@@ -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

};


@@ -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 *
************************************************************************/

0 comments on commit 5a64f58

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