Skip to content

Commit

Permalink
Merge pull request #4819 from nyalldawson/layout_gui
Browse files Browse the repository at this point in the history
Layout GUI work (pt 1/?)
  • Loading branch information
nyalldawson committed Jul 14, 2017
2 parents 0639264 + 1c8b17f commit f84a3bb
Show file tree
Hide file tree
Showing 63 changed files with 5,827 additions and 85 deletions.
5 changes: 5 additions & 0 deletions python/core/layout/qgslayout.sip
Expand Up @@ -19,6 +19,11 @@ class QgsLayout : QGraphicsScene
%End
public:

enum ZValues
{
ZMapTool,
};

QgsLayout();

};
Expand Down
35 changes: 20 additions & 15 deletions python/core/layout/qgslayoutitemregistry.sip
Expand Up @@ -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

Expand Down Expand Up @@ -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).
Expand All @@ -77,7 +76,6 @@ class QgsLayoutItemAbstractMetadata




class QgsLayoutItemRegistry : QObject
{
%Docstring
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -169,6 +173,7 @@ class QgsLayoutItemRegistry : QObject




/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
13 changes: 13 additions & 0 deletions python/gui/gui_auto.sip
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions python/gui/layout/qgslayoutdesignerinterface.sip
Expand Up @@ -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;
Expand Down
154 changes: 154 additions & 0 deletions python/gui/layout/qgslayoutitemguiregistry.sip
@@ -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 *
************************************************************************/
46 changes: 46 additions & 0 deletions python/gui/layout/qgslayoutitemregistryguiutils.sip
@@ -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.