Skip to content
Permalink
Browse files

[composer] When opening pre 2.3 projects keep picture item placement …

…at middle (fix #10458)
  • Loading branch information
nyalldawson committed Jun 7, 2014
1 parent a5c0e7e commit 6b973e1c3e9e31ae9e5f30b67da7484528cba653
Showing with 17 additions and 1 deletion.
  1. +16 −1 src/core/qgsprojectfiletransform.cpp
  2. +1 −0 src/core/qgsprojectfiletransform.h
@@ -52,7 +52,11 @@ QgsProjectFileTransform::transform QgsProjectFileTransform::transformers[] =
{PFV( 1, 5, 0 ), PFV( 1, 6, 0 ), &QgsProjectFileTransform::transformNull},
{PFV( 1, 6, 0 ), PFV( 1, 7, 0 ), &QgsProjectFileTransform::transformNull},
{PFV( 1, 7, 0 ), PFV( 1, 8, 0 ), &QgsProjectFileTransform::transformNull},
{PFV( 1, 8, 0 ), PFV( 1, 9, 0 ), &QgsProjectFileTransform::transform1800to1900}
{PFV( 1, 8, 0 ), PFV( 1, 9, 0 ), &QgsProjectFileTransform::transform1800to1900},
{PFV( 1, 9, 0 ), PFV( 2, 0, 0 ), &QgsProjectFileTransform::transformNull},
{PFV( 2, 0, 0 ), PFV( 2, 1, 0 ), &QgsProjectFileTransform::transformNull},
{PFV( 2, 1, 0 ), PFV( 2, 2, 0 ), &QgsProjectFileTransform::transformNull},
{PFV( 2, 2, 0 ), PFV( 2, 3, 0 ), &QgsProjectFileTransform::transform2200to2300},
};

bool QgsProjectFileTransform::updateRevision( QgsProjectVersion newVersion )
@@ -594,6 +598,17 @@ void QgsProjectFileTransform::transform1800to1900()
QgsDebugMsg( mDom.toString() );
}

void QgsProjectFileTransform::transform2200to2300()
{
//composer: set placement for all picture items to middle, to mimic <=2.2 behaviour
QDomNodeList composerPictureList = mDom.elementsByTagName( "ComposerPicture" );
for ( int i = 0; i < composerPictureList.size(); ++i )
{
QDomElement picture = composerPictureList.at( i ).toElement();
picture.setAttribute( "anchorPoint", QString::number( 4 ) );
}
}

void QgsProjectFileTransform::convertRasterProperties( QDomDocument& doc, QDomNode& parentNode,
QDomElement& rasterPropertiesElem, QgsRasterLayer* rlayer )
{
@@ -85,6 +85,7 @@ class CORE_EXPORT QgsProjectFileTransform
void transform1100to1200();
void transform1400to1500();
void transform1800to1900();
void transform2200to2300();

//helper functions
static int rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, QgsRasterLayer *rlayer );

0 comments on commit 6b973e1

Please sign in to comment.
You can’t perform that action at this time.