mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
Add export layer settings to QgsLayoutContext
This commit is contained in:
parent
9d04e679a2
commit
71c41d49b7
@ -176,6 +176,29 @@ class QgsLayoutContext : QObject
|
|||||||
:rtype: bool
|
:rtype: bool
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
void setCurrentExportLayer( int layer = -1 );
|
||||||
|
%Docstring
|
||||||
|
Sets the current item ``layer`` to draw while exporting. QgsLayoutItem subclasses
|
||||||
|
which support multi-layer SVG exports must check the currentExportLayer()
|
||||||
|
and customise their rendering based on the layer.
|
||||||
|
|
||||||
|
If ``layer`` is -1, all item layers will be rendered.
|
||||||
|
|
||||||
|
.. seealso:: currentExportLayer()
|
||||||
|
%End
|
||||||
|
|
||||||
|
int currentExportLayer() const;
|
||||||
|
%Docstring
|
||||||
|
Returns the current item layer to draw while exporting. QgsLayoutItem subclasses
|
||||||
|
which support multi-layer SVG exports must check this
|
||||||
|
and customise their rendering based on the layer.
|
||||||
|
|
||||||
|
If ``layer`` is -1, all item layers should be rendered.
|
||||||
|
|
||||||
|
.. seealso:: setCurrentExportLayer()
|
||||||
|
:rtype: int
|
||||||
|
%End
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void flagsChanged( QgsLayoutContext::Flags flags );
|
void flagsChanged( QgsLayoutContext::Flags flags );
|
||||||
|
@ -188,6 +188,28 @@ class CORE_EXPORT QgsLayoutContext : public QObject
|
|||||||
*/
|
*/
|
||||||
bool pagesVisible() const { return mPagesVisible; }
|
bool pagesVisible() const { return mPagesVisible; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current item \a layer to draw while exporting. QgsLayoutItem subclasses
|
||||||
|
* which support multi-layer SVG exports must check the currentExportLayer()
|
||||||
|
* and customise their rendering based on the layer.
|
||||||
|
*
|
||||||
|
* If \a layer is -1, all item layers will be rendered.
|
||||||
|
*
|
||||||
|
* \see currentExportLayer()
|
||||||
|
*/
|
||||||
|
void setCurrentExportLayer( int layer = -1 ) { mCurrentExportLayer = layer; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current item layer to draw while exporting. QgsLayoutItem subclasses
|
||||||
|
* which support multi-layer SVG exports must check this
|
||||||
|
* and customise their rendering based on the layer.
|
||||||
|
*
|
||||||
|
* If \a layer is -1, all item layers should be rendered.
|
||||||
|
*
|
||||||
|
* \see setCurrentExportLayer()
|
||||||
|
*/
|
||||||
|
int currentExportLayer() const { return mCurrentExportLayer; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,6 +222,8 @@ class CORE_EXPORT QgsLayoutContext : public QObject
|
|||||||
|
|
||||||
Flags mFlags = 0;
|
Flags mFlags = 0;
|
||||||
|
|
||||||
|
int mCurrentExportLayer = -1;
|
||||||
|
|
||||||
QgsFeature mFeature;
|
QgsFeature mFeature;
|
||||||
QPointer< QgsVectorLayer > mLayer;
|
QPointer< QgsVectorLayer > mLayer;
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ class TestQgsLayoutContext: public QObject
|
|||||||
void dpi();
|
void dpi();
|
||||||
void renderContextFlags();
|
void renderContextFlags();
|
||||||
void boundingBoxes();
|
void boundingBoxes();
|
||||||
|
void exportLayer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mReport;
|
QString mReport;
|
||||||
@ -180,5 +181,14 @@ void TestQgsLayoutContext::boundingBoxes()
|
|||||||
QVERIFY( context.boundingBoxesVisible() );
|
QVERIFY( context.boundingBoxesVisible() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestQgsLayoutContext::exportLayer()
|
||||||
|
{
|
||||||
|
QgsLayoutContext context;
|
||||||
|
// must default to -1
|
||||||
|
QCOMPARE( context.currentExportLayer(), -1 );
|
||||||
|
context.setCurrentExportLayer( 1 );
|
||||||
|
QCOMPARE( context.currentExportLayer(), 1 );
|
||||||
|
}
|
||||||
|
|
||||||
QGSTEST_MAIN( TestQgsLayoutContext )
|
QGSTEST_MAIN( TestQgsLayoutContext )
|
||||||
#include "testqgslayoutcontext.moc"
|
#include "testqgslayoutcontext.moc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user