Skip to content
Permalink
Browse files

[Composer] Fix The ComposerMap's tooltip is not updated after readXML

The ComposerMap's tooltip is only set in the private init method. This method is only used in the ComposerMap constructor. The result is that the tooltip is not updated after reading the id from the XML.

The solution could be to add a private method updateToolTip used when the id is changed :
* constructor
* assignFreeId
* readXML
  • Loading branch information
rldhont authored and nyalldawson committed Oct 9, 2014
1 parent 0a4dae2 commit 10ffcebfd946d52c893b37e5dc101669ba35819b
Showing with 9 additions and 2 deletions.
  1. +8 −2 src/core/composer/qgscomposermap.cpp
  2. +1 −0 src/core/composer/qgscomposermap.h
@@ -112,6 +112,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition )
mCurrentRectangle = rect();

init();
updateToolTip();
}

void QgsComposerMap::init()
@@ -120,8 +121,6 @@ void QgsComposerMap::init()
mOverviewStack = new QgsComposerMapOverviewStack( this );
connectUpdateSlot();

setToolTip( tr( "Map %1" ).arg( mId ) );

// data defined strings
mDataDefinedNames.insert( QgsComposerObject::MapRotation, QString( "dataDefinedMapRotation" ) );
mDataDefinedNames.insert( QgsComposerObject::MapScale, QString( "dataDefinedMapScale" ) );
@@ -132,6 +131,11 @@ void QgsComposerMap::init()
mDataDefinedNames.insert( QgsComposerObject::MapAtlasMargin, QString( "dataDefinedMapAtlasMargin" ) );
}

void QgsComposerMap::updateToolTip()
{
setToolTip( tr( "Map %1" ).arg( mId ) );
}

void QgsComposerMap::adjustExtentToItemShape( double itemWidth, double itemHeight, QgsRectangle& extent ) const
{
double itemWidthHeightRatio = itemWidth / itemHeight;
@@ -1292,6 +1296,7 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
if ( idRead != "not found" )
{
mId = idRead.toInt();
updateToolTip();
}
mPreviewMode = Rectangle;

@@ -2268,6 +2273,7 @@ void QgsComposerMap::assignFreeId()
}
}
mId = maxId + 1;
updateToolTip();
}

bool QgsComposerMap::imageSizeConsideringRotation( double& width, double& height ) const
@@ -906,6 +906,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
double mAtlasMargin;

void init();
void updateToolTip();

/**Returns a list of the layers to render for this map item*/
QStringList layersToRender() const;

0 comments on commit 10ffceb

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