[layout] Disable ref images generation and added docs

This commit is contained in:
Alessandro Pasotti 2017-12-19 12:24:28 +01:00
parent dd0cce23cd
commit 51a460775f
2 changed files with 29 additions and 6 deletions

View File

@ -16,11 +16,15 @@
#ifndef QGSCOMPOSITIONCONVERTER_H #ifndef QGSCOMPOSITIONCONVERTER_H
#define QGSCOMPOSITIONCONVERTER_H #define QGSCOMPOSITIONCONVERTER_H
#include <QDomDocument> #include <QDomDocument>
#include <QDomElement> #include <QDomElement>
#include "qgis.h" #include "qgis.h"
#include "qgis_sip.h"
#define SIP_NO_FILE
#include "qgspropertycollection.h" #include "qgspropertycollection.h"
class QgsLayout; class QgsLayout;
@ -38,6 +42,13 @@ class QgsLayoutItemMap;
class QgsLayoutItemScaleBar; class QgsLayoutItemScaleBar;
class QgsLayoutItemLegend; class QgsLayoutItemLegend;
/**
* QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout
* \since QGIS 3.0
* \note Not available in Python bindings.
* \ingroup core
*/
class CORE_EXPORT QgsCompositionConverter class CORE_EXPORT QgsCompositionConverter
{ {
public: public:
@ -97,7 +108,7 @@ class CORE_EXPORT QgsCompositionConverter
}; };
/** /**
* The MarkerMode enum is the old 2.x arrow marker mode * The MarkerMode enum is the old QGIS 2.x arrow marker mode
*/ */
enum MarkerMode enum MarkerMode
{ {
@ -109,16 +120,28 @@ class CORE_EXPORT QgsCompositionConverter
/** /**
* \brief createLayoutFromCompositionXml is a factory that creates layout instances from a * \brief createLayoutFromCompositionXml is a factory that creates layout instances from a
* QGIS 2.x XML composition \a document * QGIS 2.x XML composition \a document
* \param parentElement is the Composition element * \param parentElement is the Composition element
* \param document * \param project the QGIS project
* \param context
* \return a QgsLayout instance * \return a QgsLayout instance
* \since QGIS 3.0
* \note Not available in Python bindings.
*/ */
static QgsLayout *createLayoutFromCompositionXml( const QDomElement &parentElement, static QgsLayout *createLayoutFromCompositionXml( const QDomElement &parentElement,
QgsProject *project ) SIP_FACTORY; QgsProject *project ) SIP_FACTORY;
/**
* addItemsFromCompositionXml parse a QGIS 2.x composition XML in the \a parentElement,
* converts the 2.x items to the new layout elements and add them to the \a layout
* \param layout the lay
* \param parentElement
* \param position for pasting
* \param pasteInPlace if true element position is translated to \a position
* \return a list of layout items
* \since QGIS 3.0
* \note Not available in Python bindings.
*/
static QList<QgsLayoutItem *> addItemsFromCompositionXml( QgsLayout *layout, static QList<QgsLayoutItem *> addItemsFromCompositionXml( QgsLayout *layout,
const QDomElement &parentElement, const QDomElement &parentElement,
QPointF *position = nullptr, QPointF *position = nullptr,

View File

@ -402,7 +402,7 @@ void TestQgsCompositionConverter::checkRenderedImage( QgsLayout *layout, const Q
QSize size( layout->pageCollection()->page( pageNumber )->sizeWithUnits().width() * 3.77, layout->pageCollection()->page( pageNumber )->sizeWithUnits().height() * 3.77 ); QSize size( layout->pageCollection()->page( pageNumber )->sizeWithUnits().width() * 3.77, layout->pageCollection()->page( pageNumber )->sizeWithUnits().height() * 3.77 );
checker.setSize( size ); checker.setSize( size );
checker.setControlPathPrefix( QStringLiteral( "compositionconverter" ) ); checker.setControlPathPrefix( QStringLiteral( "compositionconverter" ) );
QVERIFY( checker.testLayout( mReport, pageNumber, 0, true ) ); QVERIFY( checker.testLayout( mReport, pageNumber ) );
} }
void TestQgsCompositionConverter::exportLayout( QgsLayout *layout, const QString testName ) void TestQgsCompositionConverter::exportLayout( QgsLayout *layout, const QString testName )