mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
Restore picture atlas handling
This commit is contained in:
parent
fee1c211a6
commit
4a7813b953
@ -235,6 +235,11 @@ Emitted when the context's ``layer`` is changed.
|
|||||||
%Docstring
|
%Docstring
|
||||||
Emitted certain settings in the context is changed, e.g. by setting a new feature or vector layer
|
Emitted certain settings in the context is changed, e.g. by setting a new feature or vector layer
|
||||||
for the context.
|
for the context.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void dpiChanged();
|
||||||
|
%Docstring
|
||||||
|
Emitted when the context's DPI is changed.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -89,7 +89,11 @@ void QgsLayoutContext::setLayer( QgsVectorLayer *layer )
|
|||||||
|
|
||||||
void QgsLayoutContext::setDpi( double dpi )
|
void QgsLayoutContext::setDpi( double dpi )
|
||||||
{
|
{
|
||||||
|
if ( dpi == mMeasurementConverter.dpi() )
|
||||||
|
return;
|
||||||
|
|
||||||
mMeasurementConverter.setDpi( dpi );
|
mMeasurementConverter.setDpi( dpi );
|
||||||
|
emit dpiChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
double QgsLayoutContext::dpi() const
|
double QgsLayoutContext::dpi() const
|
||||||
|
@ -236,6 +236,11 @@ class CORE_EXPORT QgsLayoutContext : public QObject
|
|||||||
*/
|
*/
|
||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitted when the context's DPI is changed.
|
||||||
|
*/
|
||||||
|
void dpiChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Flags mFlags = nullptr;
|
Flags mFlags = nullptr;
|
||||||
|
@ -54,14 +54,12 @@ QgsLayoutItemPicture::QgsLayoutItemPicture( QgsLayout *layout )
|
|||||||
|
|
||||||
//connect some signals
|
//connect some signals
|
||||||
|
|
||||||
#if 0 //TODO
|
|
||||||
//connect to atlas feature changing
|
//connect to atlas feature changing
|
||||||
//to update the picture source expression
|
//to update the picture source expression
|
||||||
connect( &mComposition->atlasComposition(), &QgsAtlasComposition::featureChanged, this, [ = ] { refreshPicture(); } );
|
connect( &layout->context(), &QgsLayoutContext::changed, this, [ = ] { refreshPicture(); } );
|
||||||
|
|
||||||
//connect to layout print resolution changing
|
//connect to layout print resolution changing
|
||||||
connect( layout->context(), &QgsLayoutContext::printResolutionChanged, this, &QgsLayoutItemPicture::recalculateSize );
|
connect( &layout->context(), &QgsLayoutContext::dpiChanged, this, &QgsLayoutItemPicture::recalculateSize );
|
||||||
#endif
|
|
||||||
|
|
||||||
connect( this, &QgsLayoutItem::sizePositionChanged, this, &QgsLayoutItemPicture::shapeChanged );
|
connect( this, &QgsLayoutItem::sizePositionChanged, this, &QgsLayoutItemPicture::shapeChanged );
|
||||||
}
|
}
|
||||||
|
@ -145,9 +145,17 @@ void TestQgsLayoutContext::layer()
|
|||||||
void TestQgsLayoutContext::dpi()
|
void TestQgsLayoutContext::dpi()
|
||||||
{
|
{
|
||||||
QgsLayoutContext context;
|
QgsLayoutContext context;
|
||||||
|
|
||||||
|
QSignalSpy spyDpiChanged( &context, &QgsLayoutContext::dpiChanged );
|
||||||
context.setDpi( 600 );
|
context.setDpi( 600 );
|
||||||
QCOMPARE( context.dpi(), 600.0 );
|
QCOMPARE( context.dpi(), 600.0 );
|
||||||
QCOMPARE( context.measurementConverter().dpi(), 600.0 );
|
QCOMPARE( context.measurementConverter().dpi(), 600.0 );
|
||||||
|
QCOMPARE( spyDpiChanged.count(), 1 );
|
||||||
|
|
||||||
|
context.setDpi( 600 );
|
||||||
|
QCOMPARE( spyDpiChanged.count(), 1 );
|
||||||
|
context.setDpi( 6000 );
|
||||||
|
QCOMPARE( spyDpiChanged.count(), 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsLayoutContext::renderContextFlags()
|
void TestQgsLayoutContext::renderContextFlags()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user