Skip to content

Commit

Permalink
[composer] When opening pre 2.3 projects keep picture item placement …
Browse files Browse the repository at this point in the history
…at middle (fix #10458)
  • Loading branch information
nyalldawson committed Jun 7, 2014
1 parent a5c0e7e commit 6b973e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/core/qgsprojectfiletransform.cpp
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 )
{
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsprojectfiletransform.h
Expand Up @@ -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 );
Expand Down

0 comments on commit 6b973e1

Please sign in to comment.