Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
412 additions
and 54 deletions.
- +1 −0 python/core/core_auto.sip
- +7 −0 python/core/layout/qgslayout.sip
- +57 −0 python/core/layout/qgslayoutexporter.sip
- +0 −8 python/core/layout/qgslayoutitem.sip
- +9 −0 python/core/layout/qgslayoututils.sip
- +38 −0 python/core/qgsmultirenderchecker.sip
- +2 −0 src/core/CMakeLists.txt
- +6 −0 src/core/layout/qgslayout.cpp
- +8 −0 src/core/layout/qgslayout.h
- +64 −0 src/core/layout/qgslayoutexporter.cpp
- +67 −0 src/core/layout/qgslayoutexporter.h
- +1 −26 src/core/layout/qgslayoutitem.cpp
- +0 −7 src/core/layout/qgslayoutitem.h
- +4 −3 src/core/layout/qgslayoutitempage.cpp
- +25 −0 src/core/layout/qgslayoututils.cpp
- +8 −0 src/core/layout/qgslayoututils.h
- +65 −0 src/core/qgsmultirenderchecker.cpp
- +42 −0 src/core/qgsmultirenderchecker.h
- +2 −5 src/gui/layout/qgslayoutmousehandles.cpp
- +6 −5 tests/src/gui/testqgslayoutview.cpp
@@ -0,0 +1,57 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutexporter.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
class QgsLayoutExporter | ||
{ | ||
%Docstring | ||
Handles rendering and exports of layouts to various formats. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayoutexporter.h" | ||
%End | ||
public: | ||
|
||
QgsLayoutExporter( QgsLayout *layout ); | ||
%Docstring | ||
Constructor for QgsLayoutExporter, for the specified ``layout``. | ||
%End | ||
|
||
void renderPage( QPainter *painter, int page ); | ||
%Docstring | ||
Renders a full page to a destination ``painter``. | ||
|
||
The ``page`` argument specifies the page number to render. Page numbers | ||
are 0 based, such that the first page in a layout is page 0. | ||
|
||
.. seealso:: renderRect() | ||
%End | ||
|
||
void renderRegion( QPainter *painter, const QRectF ®ion ); | ||
%Docstring | ||
Renders a ``region`` from the layout to a ``painter``. This method can be used | ||
to render sections of pages rather than full pages. | ||
|
||
.. seealso:: renderPage() | ||
%End | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutexporter.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
@@ -0,0 +1,64 @@ | ||
/*************************************************************************** | ||
qgslayoutexporter.cpp | ||
------------------- | ||
begin : October 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 "qgslayoutexporter.h" | ||
#include "qgslayout.h" | ||
|
||
QgsLayoutExporter::QgsLayoutExporter( QgsLayout *layout ) | ||
: mLayout( layout ) | ||
{ | ||
|
||
} | ||
|
||
void QgsLayoutExporter::renderPage( QPainter *painter, int page ) | ||
{ | ||
if ( !mLayout ) | ||
return; | ||
|
||
if ( mLayout->pageCollection()->pageCount() <= page || page < 0 ) | ||
{ | ||
return; | ||
} | ||
|
||
QgsLayoutItemPage *pageItem = mLayout->pageCollection()->page( page ); | ||
if ( !pageItem ) | ||
{ | ||
return; | ||
} | ||
|
||
QRectF paperRect = QRectF( pageItem->pos().x(), pageItem->pos().y(), pageItem->rect().width(), pageItem->rect().height() ); | ||
renderRegion( painter, paperRect ); | ||
} | ||
|
||
void QgsLayoutExporter::renderRegion( QPainter *painter, const QRectF ®ion ) | ||
{ | ||
QPaintDevice *paintDevice = painter->device(); | ||
if ( !paintDevice || !mLayout ) | ||
{ | ||
return; | ||
} | ||
|
||
#if 0 //TODO | ||
setSnapLinesVisible( false ); | ||
#endif | ||
|
||
mLayout->render( painter, QRectF( 0, 0, paintDevice->width(), paintDevice->height() ), region ); | ||
|
||
#if 0 // TODO | ||
setSnapLinesVisible( true ); | ||
#endif | ||
} | ||
|
@@ -0,0 +1,67 @@ | ||
/*************************************************************************** | ||
qgslayoutexporter.h | ||
------------------- | ||
begin : October 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 QGSLAYOUTEXPORTER_H | ||
#define QGSLAYOUTEXPORTER_H | ||
|
||
#include "qgis_core.h" | ||
#include <QPointer> | ||
|
||
class QgsLayout; | ||
class QPainter; | ||
|
||
/** | ||
* \ingroup core | ||
* \class QgsLayoutExporter | ||
* \brief Handles rendering and exports of layouts to various formats. | ||
* \since QGIS 3.0 | ||
*/ | ||
class CORE_EXPORT QgsLayoutExporter | ||
{ | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for QgsLayoutExporter, for the specified \a layout. | ||
*/ | ||
QgsLayoutExporter( QgsLayout *layout ); | ||
|
||
/** | ||
* Renders a full page to a destination \a painter. | ||
* | ||
* The \a page argument specifies the page number to render. Page numbers | ||
* are 0 based, such that the first page in a layout is page 0. | ||
* | ||
* \see renderRect() | ||
*/ | ||
void renderPage( QPainter *painter, int page ); | ||
|
||
/** | ||
* Renders a \a region from the layout to a \a painter. This method can be used | ||
* to render sections of pages rather than full pages. | ||
* | ||
* \see renderPage() | ||
*/ | ||
void renderRegion( QPainter *painter, const QRectF ®ion ); | ||
|
||
private: | ||
|
||
QPointer< QgsLayout > mLayout; | ||
}; | ||
|
||
#endif //QGSLAYOUTEXPORTER_H | ||
|
||
|
||
|
Oops, something went wrong.