Skip to content
Permalink
Browse files

Merge pull request #4819 from nyalldawson/layout_gui

Layout GUI work (pt 1/?)
  • Loading branch information
nyalldawson committed Jul 14, 2017
2 parents 0639264 + 1c8b17f commit f84a3bbd0481fd359d5dd2131e28ab40717f0e8e
Showing with 5,827 additions and 85 deletions.
  1. +5 −0 python/core/layout/qgslayout.sip
  2. +20 −15 python/core/layout/qgslayoutitemregistry.sip
  3. +13 −0 python/gui/gui_auto.sip
  4. +9 −0 python/gui/layout/qgslayoutdesignerinterface.sip
  5. +154 −0 python/gui/layout/qgslayoutitemguiregistry.sip
  6. +46 −0 python/gui/layout/qgslayoutitemregistryguiutils.sip
  7. +90 −0 python/gui/layout/qgslayoutruler.sip
  8. +198 −0 python/gui/layout/qgslayoutview.sip
  9. +58 −0 python/gui/layout/qgslayoutviewmouseevent.sip
  10. +189 −0 python/gui/layout/qgslayoutviewrubberband.sip
  11. +173 −0 python/gui/layout/qgslayoutviewtool.sip
  12. +55 −0 python/gui/layout/qgslayoutviewtooladditem.sip
  13. +45 −0 python/gui/layout/qgslayoutviewtoolpan.sip
  14. +45 −0 python/gui/layout/qgslayoutviewtoolselect.sip
  15. +43 −0 python/gui/layout/qgslayoutviewtooltemporarykeypan.sip
  16. +45 −0 python/gui/layout/qgslayoutviewtooltemporarykeyzoom.sip
  17. +43 −0 python/gui/layout/qgslayoutviewtooltemporarymousepan.sip
  18. +52 −0 python/gui/layout/qgslayoutviewtoolzoom.sip
  19. +6 −0 python/gui/qgsgui.sip
  20. +47 −0 python/plugins/processing/algs/replacer.py
  21. +273 −11 src/app/layout/qgslayoutdesignerdialog.cpp
  22. +53 −1 src/app/layout/qgslayoutdesignerdialog.h
  23. +6 −0 src/core/layout/qgslayout.h
  24. +0 −1 src/core/layout/qgslayoutitem.h
  25. +39 −9 src/core/layout/qgslayoutitemregistry.cpp
  26. +45 −35 src/core/layout/qgslayoutitemregistry.h
  27. +1 −0 src/core/qgsapplication.cpp
  28. +28 −0 src/gui/CMakeLists.txt
  29. +9 −0 src/gui/layout/qgslayoutdesignerinterface.h
  30. +87 −0 src/gui/layout/qgslayoutitemguiregistry.cpp
  31. +241 −0 src/gui/layout/qgslayoutitemguiregistry.h
  32. +453 −0 src/gui/layout/qgslayoutruler.cpp
  33. +133 −0 src/gui/layout/qgslayoutruler.h
  34. +361 −0 src/gui/layout/qgslayoutview.cpp
  35. +235 −0 src/gui/layout/qgslayoutview.h
  36. +31 −0 src/gui/layout/qgslayoutviewmouseevent.cpp
  37. +68 −0 src/gui/layout/qgslayoutviewmouseevent.h
  38. +250 −0 src/gui/layout/qgslayoutviewrubberband.cpp
  39. +203 −0 src/gui/layout/qgslayoutviewrubberband.h
  40. +122 −0 src/gui/layout/qgslayoutviewtool.cpp
  41. +202 −0 src/gui/layout/qgslayoutviewtool.h
  42. +107 −0 src/gui/layout/qgslayoutviewtooladditem.cpp
  43. +73 −0 src/gui/layout/qgslayoutviewtooladditem.h
  44. +70 −0 src/gui/layout/qgslayoutviewtoolpan.cpp
  45. +52 −0 src/gui/layout/qgslayoutviewtoolpan.h
  46. +76 −0 src/gui/layout/qgslayoutviewtoolselect.cpp
  47. +62 −0 src/gui/layout/qgslayoutviewtoolselect.h
  48. +48 −0 src/gui/layout/qgslayoutviewtooltemporarykeypan.cpp
  49. +51 −0 src/gui/layout/qgslayoutviewtooltemporarykeypan.h
  50. +113 −0 src/gui/layout/qgslayoutviewtooltemporarykeyzoom.cpp
  51. +56 −0 src/gui/layout/qgslayoutviewtooltemporarykeyzoom.h
  52. +48 −0 src/gui/layout/qgslayoutviewtooltemporarymousepan.cpp
  53. +51 −0 src/gui/layout/qgslayoutviewtooltemporarymousepan.h
  54. +148 −0 src/gui/layout/qgslayoutviewtoolzoom.cpp
  55. +68 −0 src/gui/layout/qgslayoutviewtoolzoom.h
  56. +11 −0 src/gui/qgsgui.cpp
  57. +7 −0 src/gui/qgsgui.h
  58. +217 −4 src/ui/layout/qgslayoutdesignerbase.ui
  59. +8 −9 tests/src/core/testqgslayoutitem.cpp
  60. +3 −0 tests/src/gui/CMakeLists.txt
  61. +318 −0 tests/src/gui/testqgslayoutview.cpp
  62. +1 −0 tests/src/python/CMakeLists.txt
  63. +63 −0 tests/src/python/test_qgslayoutview.py
@@ -19,6 +19,11 @@ class QgsLayout : QGraphicsScene
%End
public:

enum ZValues
{
ZMapTool,
};

QgsLayout();

};
@@ -8,13 +8,18 @@




class QgsLayoutItemAbstractMetadata
{
%Docstring
Stores metadata about one layout item class.

A companion class, QgsLayoutItemAbstractGuiMetadata, handles the
GUI behavior of QgsLayoutItems.

.. note::

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

@@ -55,12 +60,6 @@ class QgsLayoutItemAbstractMetadata
:rtype: QgsLayoutItem
%End

virtual QWidget *createItemWidget() /Factory/;
%Docstring
Creates a configuration widget for layout items of this type. Can return None if no configuration GUI is required.
:rtype: QWidget
%End

virtual void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
%Docstring
Resolve paths in the item's ``properties`` (if there are any paths).
@@ -77,7 +76,6 @@ class QgsLayoutItemAbstractMetadata




class QgsLayoutItemRegistry : QObject
{
%Docstring
@@ -86,6 +84,9 @@ class QgsLayoutItemRegistry : QObject
QgsLayoutItemRegistry is not usually directly created, but rather accessed through
QgsApplication.layoutItemRegistry().

A companion class, QgsLayoutItemGuiRegistry, handles the GUI behavior
of layout items.

.. versionadded:: 3.0
%End

@@ -107,14 +108,23 @@ class QgsLayoutItemRegistry : QObject

QgsLayoutItemRegistry( QObject *parent = 0 );
%Docstring
Creates a registry and populates it with standard item types.
Creates a new empty item registry.

QgsLayoutItemRegistry is not usually directly created, but rather accessed through
QgsApplication.layoutItemRegistry().

.. seealso:: populate()
%End

~QgsLayoutItemRegistry();

bool populate();
%Docstring
Populates the registry with standard item types. If called on a non-empty registry
then this will have no effect and will return false.
:rtype: bool
%End


QgsLayoutItemAbstractMetadata *itemMetadata( int type ) const;
%Docstring
@@ -135,12 +145,6 @@ class QgsLayoutItemRegistry : QObject
:rtype: QgsLayoutItem
%End

QWidget *createItemWidget( int type ) const /Factory/;
%Docstring
Creates a new instance of a layout item configuration widget for the specified item ``type``.
:rtype: QWidget
%End

void resolvePaths( int type, QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving ) const;
%Docstring
Resolve paths in properties of a particular symbol layer.
@@ -169,6 +173,7 @@ class QgsLayoutItemRegistry : QObject




/************************************************************************
* This file has been generated automatically from *
* *
@@ -42,6 +42,8 @@
%Include editorwidgets/core/qgseditorwidgetautoconf.sip
%Include layertree/qgslayertreeembeddedconfigwidget.sip
%Include layertree/qgslayertreeembeddedwidgetregistry.sip
%Include layout/qgslayoutviewmouseevent.sip
%Include layout/qgslayoutviewrubberband.sip
%Include locator/qgslocatorcontext.sip
%Include raster/qgsrasterrendererwidget.sip
%Include symbology-ng/qgssymbolwidgetcontext.sip
@@ -275,6 +277,17 @@
%Include layertree/qgslayertreeview.sip
%Include layertree/qgslayertreeviewdefaultactions.sip
%Include layout/qgslayoutdesignerinterface.sip
%Include layout/qgslayoutitemguiregistry.sip
%Include layout/qgslayoutruler.sip
%Include layout/qgslayoutview.sip
%Include layout/qgslayoutviewtool.sip
%Include layout/qgslayoutviewtooladditem.sip
%Include layout/qgslayoutviewtoolpan.sip
%Include layout/qgslayoutviewtoolselect.sip
%Include layout/qgslayoutviewtooltemporarykeypan.sip
%Include layout/qgslayoutviewtooltemporarykeyzoom.sip
%Include layout/qgslayoutviewtooltemporarymousepan.sip
%Include layout/qgslayoutviewtoolzoom.sip
%Include locator/qgslocator.sip
%Include locator/qgslocatorfilter.sip
%Include locator/qgslocatorwidget.sip
@@ -36,9 +36,18 @@ class QgsLayoutDesignerInterface: QObject
virtual QgsLayout *layout() = 0;
%Docstring
Returns the layout displayed in the designer.
.. seealso:: view()
:rtype: QgsLayout
%End


virtual QgsLayoutView *view() = 0;
%Docstring
Returns the layout view utilized by the designer.
.. seealso:: layout()
:rtype: QgsLayoutView
%End

public slots:

virtual void close() = 0;
@@ -0,0 +1,154 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/layout/qgslayoutitemguiregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsLayoutItemAbstractGuiMetadata
{
%Docstring
Stores GUI metadata about one layout item class.

This is a companion to QgsLayoutItemAbstractMetadata, storing only
the components related to the GUI behavior of a layout item.

.. note::

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

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

QgsLayoutItemAbstractGuiMetadata( int type );
%Docstring
Constructor for QgsLayoutItemAbstractGuiMetadata with the specified class ``type``.
%End

virtual ~QgsLayoutItemAbstractGuiMetadata();

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

virtual QIcon creationIcon() const;
%Docstring
Returns an icon representing creation of the layout item type.
:rtype: QIcon
%End

virtual QWidget *createItemWidget() /Factory/;
%Docstring
Creates a configuration widget for layout items of this type. Can return None if no configuration GUI is required.
:rtype: QWidget
%End

virtual QgsLayoutViewRubberBand *createRubberBand( QgsLayoutView *view ) /Factory/;
%Docstring
Creates a rubber band for use when creating layout items of this type. Can return None if no rubber band
should be created. The default behavior is to create a rectangular rubber band.
:rtype: QgsLayoutViewRubberBand
%End

};




class QgsLayoutItemGuiRegistry : QObject
{
%Docstring
Registry of available layout item GUI behavior.

QgsLayoutItemGuiRegistry is not usually directly created, but rather accessed through
QgsGui.layoutItemGuiRegistry().

This acts as a companion to QgsLayoutItemRegistry, handling only
the components related to the GUI behavior of layout items.

.. versionadded:: 3.0
%End

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

QgsLayoutItemGuiRegistry( QObject *parent = 0 );
%Docstring
Creates a new empty item GUI registry.

QgsLayoutItemGuiRegistry is not usually directly created, but rather accessed through
QgsGui.layoutItemGuiRegistry().

.. seealso:: populate()
%End

~QgsLayoutItemGuiRegistry();

bool populate();
%Docstring
Populates the registry with standard item types. If called on a non-empty registry
then this will have no effect and will return false.
:rtype: bool
%End


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

bool addLayoutItemGuiMetadata( QgsLayoutItemAbstractGuiMetadata *metadata /Transfer/ );
%Docstring
Registers the gui metadata for a new layout item type. Takes ownership of the metadata instance.
:rtype: bool
%End

QWidget *createItemWidget( int type ) const /Factory/;
%Docstring
Creates a new instance of a layout item configuration widget for the specified item ``type``.
:rtype: QWidget
%End


QList< int > itemTypes() const;
%Docstring
Returns a list of available item types handled by the registry.
:rtype: list of int
%End

signals:

void typeAdded( int type );
%Docstring
Emitted whenever a new item type is added to the registry, with the specified
``type``.
%End

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




/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/layout/qgslayoutitemguiregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,46 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/layout/qgslayoutitemregistryguiutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsLayoutItemRegistryGuiUtils
{
%Docstring
A group of static utilities for working with the gui based portions of
QgsLayoutItemRegistry.

This class is designed to allow Python item subclasses to override the
default GUI based QgsLayoutItemAbstractMetadata methods, which
cannot be directly overridden from Python subclasses.

.. versionadded:: 3.0
%End

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

static void setItemRubberBandPrototype( int type, QgsLayoutViewRubberBand *prototype /Transfer/ );
%Docstring
Sets a ``prototype`` for the rubber bands for the layout item with specified ``type``.
Python subclasses of QgsLayoutItem must call this method to register their prototypes,
as the usual c++ QgsLayoutItemAbstractMetadata are not accessible via the Python bindings.
%End


};

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

0 comments on commit f84a3bb

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