Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 10ffceb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/composer/qgscomposermap.cpp
Expand Up @@ -112,6 +112,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition )
mCurrentRectangle = rect();

init();
updateToolTip();
}

void QgsComposerMap::init()
Expand All @@ -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" ) );
Expand All @@ -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;
Expand Down Expand Up @@ -1292,6 +1296,7 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
if ( idRead != "not found" )
{
mId = idRead.toInt();
updateToolTip();
}
mPreviewMode = Rectangle;

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

bool QgsComposerMap::imageSizeConsideringRotation( double& width, double& height ) const
Expand Down
1 change: 1 addition & 0 deletions src/core/composer/qgscomposermap.h
Expand Up @@ -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;
Expand Down

0 comments on commit 10ffceb

Please sign in to comment.