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
|
||||
Emitted certain settings in the context is changed, e.g. by setting a new feature or vector layer
|
||||
for the context.
|
||||
%End
|
||||
|
||||
void dpiChanged();
|
||||
%Docstring
|
||||
Emitted when the context's DPI is changed.
|
||||
%End
|
||||
|
||||
};
|
||||
|
@ -89,7 +89,11 @@ void QgsLayoutContext::setLayer( QgsVectorLayer *layer )
|
||||
|
||||
void QgsLayoutContext::setDpi( double dpi )
|
||||
{
|
||||
if ( dpi == mMeasurementConverter.dpi() )
|
||||
return;
|
||||
|
||||
mMeasurementConverter.setDpi( dpi );
|
||||
emit dpiChanged();
|
||||
}
|
||||
|
||||
double QgsLayoutContext::dpi() const
|
||||
|
@ -236,6 +236,11 @@ class CORE_EXPORT QgsLayoutContext : public QObject
|
||||
*/
|
||||
void changed();
|
||||
|
||||
/**
|
||||
* Emitted when the context's DPI is changed.
|
||||
*/
|
||||
void dpiChanged();
|
||||
|
||||
private:
|
||||
|
||||
Flags mFlags = nullptr;
|
||||
|
@ -54,14 +54,12 @@ QgsLayoutItemPicture::QgsLayoutItemPicture( QgsLayout *layout )
|
||||
|
||||
//connect some signals
|
||||
|
||||
#if 0 //TODO
|
||||
//connect to atlas feature changing
|
||||
//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( layout->context(), &QgsLayoutContext::printResolutionChanged, this, &QgsLayoutItemPicture::recalculateSize );
|
||||
#endif
|
||||
connect( &layout->context(), &QgsLayoutContext::dpiChanged, this, &QgsLayoutItemPicture::recalculateSize );
|
||||
|
||||
connect( this, &QgsLayoutItem::sizePositionChanged, this, &QgsLayoutItemPicture::shapeChanged );
|
||||
}
|
||||
|
@ -145,9 +145,17 @@ void TestQgsLayoutContext::layer()
|
||||
void TestQgsLayoutContext::dpi()
|
||||
{
|
||||
QgsLayoutContext context;
|
||||
|
||||
QSignalSpy spyDpiChanged( &context, &QgsLayoutContext::dpiChanged );
|
||||
context.setDpi( 600 );
|
||||
QCOMPARE( context.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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user