Skip to content
Permalink
Browse files

Add some base classes for layouts

  • Loading branch information
nyalldawson committed Jun 30, 2017
1 parent cd979d8 commit 18b2b5240b2563810eb7df75e2722c6a961eb495
@@ -153,6 +153,7 @@
%Include composer/qgscomposermultiframecommand.sip
%Include composer/qgscomposertexttable.sip
%Include composer/qgspaperitem.sip
%Include layout/qgslayout.sip
%Include layout/qgslayoutmeasurement.sip
%Include layout/qgslayoutmeasurementconverter.sip
%Include layout/qgspagesizeregistry.sip
@@ -371,6 +372,9 @@
%Include gps/qgsgpsdetector.sip
%Include gps/qgsnmeaconnection.sip
%Include gps/qgsgpsdconnection.sip
%Include layout/qgslayoutitem.sip
%Include layout/qgslayoutitemregistry.sip
%Include layout/qgslayoutobject.sip
%Include symbology-ng/qgscptcityarchive.sip
%Include symbology-ng/qgssvgcache.sip
%Include symbology-ng/qgsstyle.sip
@@ -0,0 +1,35 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayout.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


class QgsLayout : QGraphicsScene
{
%Docstring
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
.. versionadded:: 3.0
%End

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

QgsLayout();

};




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




class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem
{
%Docstring
Base class for graphical items within a QgsLayout.
.. versionadded:: 3.0
%End

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

QgsLayoutItem( QgsLayout *layout );

virtual int type() const = 0;
%Docstring
Return correct graphics item type.
:rtype: int
%End

virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );

%Docstring
Handles preparing a paint surface for the layout item and painting the item's
content. Derived classes must not override this method, but instead implement
the pure virtual method QgsLayoutItem.draw.
%End

protected:

virtual void drawDebugRect( QPainter *painter );
%Docstring
Draws a debugging rectangle of the item's current bounds within the specified
painter.
@param painter destination QPainter
%End

};




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



class QgsLayoutItemRegistry : QObject
{
%Docstring
Registry of available layout item types.

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

.. versionadded:: 3.0
%End

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

enum ItemType
{
LayoutItem,

// known
LayoutPage,

// item
PluginItem,
};

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

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


};




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




class QgsLayoutObject: QObject
{
%Docstring
A base class for objects which belong to a layout.
.. versionadded:: 3.0
%End

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

QgsLayoutObject( QgsLayout *layout );
%Docstring
Constructor for QgsLayoutObject, with the specified parent ``layout``.
.. note::

While ownership of a QgsLayoutObject is not passed to the layout,
classes which are derived from QgsLayoutObject (such as QgsLayoutItem)
may transfer their ownership to a layout upon construction.
%End


QgsLayout *layout();
%Docstring
Returns the layout the object is attached to.
:rtype: QgsLayout
%End

protected:


};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutobject.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -10,7 +10,6 @@




class QgsApplication : QApplication
{
%Docstring
@@ -646,6 +645,13 @@ Returns path to the build output directory. Valid only when running from build d
:rtype: QgsSymbolLayerRegistry
%End

static QgsLayoutItemRegistry *layoutItemRegistry();
%Docstring
Returns the application's layout item registry, used for layout item types.
.. versionadded:: 3.0
:rtype: QgsLayoutItemRegistry
%End

static QgsGPSConnectionRegistry *gpsConnectionRegistry();
%Docstring
Returns the application's GPS connection registry, used for managing GPS connections.
@@ -343,8 +343,12 @@ SET(QGIS_CORE_SRCS
dxf/qgsdxfpaintengine.cpp
dxf/qgsdxfpallabeling.cpp

layout/qgslayout.cpp
layout/qgslayoutitem.cpp
layout/qgslayoutitemregistry.cpp
layout/qgslayoutmeasurement.cpp
layout/qgslayoutmeasurementconverter.cpp
layout/qgslayoutobject.cpp
layout/qgspagesizeregistry.cpp
layout/qgslayoutpoint.cpp
layout/qgslayoutsize.cpp
@@ -660,6 +664,11 @@ SET(QGIS_CORE_MOC_HDRS
gps/qgsnmeaconnection.h
gps/qgsgpsdconnection.h

layout/qgslayout.h
layout/qgslayoutitem.h
layout/qgslayoutitemregistry.h
layout/qgslayoutobject.h

symbology-ng/qgscptcityarchive.h
symbology-ng/qgssvgcache.h
symbology-ng/qgsstyle.h
@@ -901,6 +910,7 @@ SET(QGIS_CORE_HDRS
composer/qgscomposertexttable.h
composer/qgspaperitem.h

layout/qgslayout.h
layout/qgslayoutmeasurement.h
layout/qgslayoutmeasurementconverter.h
layout/qgspagesizeregistry.h
@@ -0,0 +1,23 @@
/***************************************************************************
qgslayout.cpp
-------------------
begin : June 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgslayout.h"

QgsLayout::QgsLayout()
: QGraphicsScene()
{

}
@@ -0,0 +1,41 @@
/***************************************************************************
qgslayout.h
-------------------
begin : June 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSLAYOUT_H
#define QGSLAYOUT_H

#include "qgis_core.h"
#include <QGraphicsScene>

/**
* \ingroup core
* \class QgsLayout
* \brief Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
* \since QGIS 3.0
*/
class CORE_EXPORT QgsLayout : public QGraphicsScene
{
Q_OBJECT

public:

QgsLayout();

};

#endif //QGSLAYOUT_H



0 comments on commit 18b2b52

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