Skip to content

Commit 10ffceb

Browse files
rldhontnyalldawson
authored andcommittedOct 9, 2014
[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
1 parent 0a4dae2 commit 10ffceb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
 

‎src/core/composer/qgscomposermap.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition )
112112
mCurrentRectangle = rect();
113113

114114
init();
115+
updateToolTip();
115116
}
116117

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

123-
setToolTip( tr( "Map %1" ).arg( mId ) );
124-
125124
// data defined strings
126125
mDataDefinedNames.insert( QgsComposerObject::MapRotation, QString( "dataDefinedMapRotation" ) );
127126
mDataDefinedNames.insert( QgsComposerObject::MapScale, QString( "dataDefinedMapScale" ) );
@@ -132,6 +131,11 @@ void QgsComposerMap::init()
132131
mDataDefinedNames.insert( QgsComposerObject::MapAtlasMargin, QString( "dataDefinedMapAtlasMargin" ) );
133132
}
134133

134+
void QgsComposerMap::updateToolTip()
135+
{
136+
setToolTip( tr( "Map %1" ).arg( mId ) );
137+
}
138+
135139
void QgsComposerMap::adjustExtentToItemShape( double itemWidth, double itemHeight, QgsRectangle& extent ) const
136140
{
137141
double itemWidthHeightRatio = itemWidth / itemHeight;
@@ -1292,6 +1296,7 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
12921296
if ( idRead != "not found" )
12931297
{
12941298
mId = idRead.toInt();
1299+
updateToolTip();
12951300
}
12961301
mPreviewMode = Rectangle;
12971302

@@ -2268,6 +2273,7 @@ void QgsComposerMap::assignFreeId()
22682273
}
22692274
}
22702275
mId = maxId + 1;
2276+
updateToolTip();
22712277
}
22722278

22732279
bool QgsComposerMap::imageSizeConsideringRotation( double& width, double& height ) const

‎src/core/composer/qgscomposermap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
906906
double mAtlasMargin;
907907

908908
void init();
909+
void updateToolTip();
909910

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

0 commit comments

Comments
 (0)