Hi !<div><br></div><div>So here's a pull request about that :</div><div><a href="https://github.com/qgis/Quantum-GIS/pull/443">https://github.com/qgis/Quantum-GIS/pull/443</a></div><div><br></div><div>This contains only the UUID part, so there's no API change (and no modification on the QgsComposerItem::id() vs QgsComposerMap::id() problem).</div>

<div><br></div><div>Regards,</div><div><br></div><div>Olivier</div><div><br></div><div><br><br><div class="gmail_quote">2013/2/21 Marco Hugentobler <span dir="ltr"><<a href="mailto:marco.hugentobler@sourcepole.ch" target="_blank">marco.hugentobler@sourcepole.ch</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Olivier<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
3) But then, as Marco Hugentobler said, there's QgsComposerMap which<br>
implements it's own ID which are unique integer inside one<br>
composition.<br>
I removed that implementation, so the normal QgsComposerItem's ID<br>
implementation is used. The QgsComposerMap only overrides the setId()<br>
method to ensure the ID is unique inside one composition.<br>
</blockquote>
<br></div>
One problem might be if the user changes composer map ids and other items depend on it. Therefore it would be good to use the uuid for the references to the maps (from image item or overview map) but present the name in the selection dialog.<br>


<br>
Regards,<br>
Marco<div class="HOEnZb"><div class="h5"><br>
<br>
On 20.02.2013 17:08, Olivier Dalang wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi !<br>
<br>
So I've been working on this ID stuff and got a proposition (which<br>
I'll post as pull request after testing a little more) :<br>
<br>
<a href="https://github.com/olivierdalang/Quantum-GIS/tree/ComposerItemsUniqueIds" target="_blank">https://github.com/<u></u>olivierdalang/Quantum-GIS/<u></u>tree/ComposerItemsUniqueIds</a><br>
<br>
<br>
The idea is to following (this concerns QgsComposerItems)   :<br>
<br>
1) ID : this property is unaltered. It is still a user-defined QString<br>
which is not necessarily unique. Only thing changed : all<br>
QgsComposerItems now show the ID as a ToolTip. (same behaviour as<br>
current QgsComposerMap)<br>
<br>
2) UUID: this is a new property, which is not modifiable. It consists<br>
of a QUuid geneated QString (looking like<br>
{00000000-0000-0000-0000-<u></u>000000000000} ). The Uuid is generated on<br>
creation. It is kept when cut/paste, but regenerated on copy/paste and<br>
on template loading. This way, the Uuid should always be unique.<br>
<br>
So this induces no API changes.<br>
<br>
3) But then, as Marco Hugentobler said, there's QgsComposerMap which<br>
implements it's own ID which are unique integer inside one<br>
composition.<br>
I removed that implementation, so the normal QgsComposerItem's ID<br>
implementation is used. The QgsComposerMap only overrides the setId()<br>
method to ensure the ID is unique inside one composition.<br>
<br>
This induces an API change, since the ComposerMap's ID now is a<br>
QString instead of an int.<br>
If this is a major problem, 3) could be let as it is now.<br>
<br>
Regards,<br>
<br>
Olivier<br>
<br>
<br>
2013/2/19 Marco Hugentobler <<a href="mailto:marco.hugentobler@sourcepole.ch" target="_blank">marco.hugentobler@sourcepole.<u></u>ch</a>>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thinking about this. There really isn't a reason to force item names/id to<br>
be unqiue . if I want to have three items named the same then that is really<br>
my choice.  If I have say three map windows that I >want to set all to the<br>
same extents then I could just call them all "maps" and just loop over all<br>
the items with that name.<br>
</blockquote>
There is use for both unique names (or auto-incrementing numbers) and<br>
user-defined names. And both cases are already used:<br>
<br>
- auto-incrementing number in QgsComposerMap::mId. Needs to be unique within<br>
the composition because other elements may refer to it (north-arrow items or<br>
overview maps)<br>
- user-defined names: QgsComposerItem::mId (unfortunately with the same<br>
attribute name as the composer map int id).<br>
<br>
Regards,<br>
Marco<br>
<br>
<br>
On 19.02.2013 01:04, Nathan Woodrow wrote:<br>
<br>
Thinking about this. There really isn't a reason to force item names/id to<br>
be unqiue . if I want to have three items named the same then that is really<br>
my choice.  If I have say three map windows that I want to set all to the<br>
same extents then I could just call them all "maps" and just loop over all<br>
the items with that name.<br>
<br>
- sent from a tablet device that isn't an iPad<br>
<br>
On 19 Feb 2013 10:54, "Nathan Woodrow" <<a href="mailto:madmanwoo@gmail.com" target="_blank">madmanwoo@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Personally I'm not a fan of using a uuid unless the user doesn't need to<br>
enter them.<br>
<br>
For me a composer item only needs a id or name not both.  You can just<br>
store a counter on the composer the item belongs to as only has to be unique<br>
for that composer. I would just auto name them "composeritem_n" and have the<br>
composer assign the name/id when the item is added to the composer. If the<br>
user wants to change it later he can.<br>
<br>
- sent from a tablet device that isn't an iPad<br>
<br>
On 19 Feb 2013 10:38, "Olivier Dalang" <<a href="mailto:olivier.dalang@gmail.com" target="_blank">olivier.dalang@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
OK I've got something which seems to work well using QUuid.<br>
It's easier with QUuid than an incremental id since there's no need to<br>
store the last key.<br>
<br>
It already works more or less, I'll make a pull request soon.<br>
<br>
What do you think about the other attribute ? (which would be called<br>
smthg like "Internal name", and would replace current id's behavior)<br>
I'm not sure this is useful though. Maybe it will only be confusing to<br>
the user...<br>
<br>
Should I add this attribute or not ?<br>
<br>
<br>
<br>
2013/2/18 Nathan Woodrow <<a href="mailto:madmanwoo@gmail.com" target="_blank">madmanwoo@gmail.com</a>>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Olivier,<br>
<br>
I added the item id for that reason. Feel free to rework then so they<br>
are auto generated and unique. That was my intention just never got<br>
around to it.<br>
<br>
- Nathan<br>
<br>
Sent from some fancy phone looking thingo<br>
From: Olivier Dalang<br>
Sent: 19/02/2013 3:27 AM<br>
To: <a href="mailto:qgis-developer@lists.osgeo.org" target="_blank">qgis-developer@lists.osgeo.org</a><br>
Subject: [Qgis-developer] Composer item's IDs<br>
Hi !<br>
<br>
I'm developing a plugin which needs to attach some custom data to some<br>
Composer Item's instances.<br>
Thus, I need a way to identify the instances.<br>
<br>
I saw that there's an ID attribute in the ComposerItems, but don't<br>
really know how it's supposed to work. It seems for now it's only an<br>
user defined value, which remains empty when the user doesn't provide<br>
it and which also can be duplicated.<br>
So it seems I can't use this as an unique ID.<br>
<br>
What's the best way to do that ?<br>
<br>
<br>
More globally, what is this ID good for ? Is it's behavior not fully<br>
implemented yet ?<br>
<br>
I think it would be useful to auto-assign unique which the user<br>
couldn't change. If needed, another attribute ("name" or "tag") could<br>
be added to replace the current "ID" behaviour, allowing the user to<br>
define custom data.<br>
<br>
What do you think ?<br>
<br>
Thanks !!<br>
<br>
Olivier<br>
______________________________<u></u>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-<u></u>developer</a><br>
</blockquote></blockquote></blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-<u></u>developer</a><br>
<br>
<br>
<br>
--<br>
Dr. Marco Hugentobler<br>
Sourcepole -  Linux & Open Source Solutions<br>
Weberstrasse 5, CH-8004 Zürich, Switzerland<br>
<a href="mailto:marco.hugentobler@sourcepole.ch" target="_blank">marco.hugentobler@sourcepole.<u></u>ch</a> <a href="http://www.sourcepole.ch" target="_blank">http://www.sourcepole.ch</a><br>
Technical Advisor QGIS Project Steering Committee<br>
<br>
<br>
______________________________<u></u>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-<u></u>developer</a><br>
<br>
</blockquote></blockquote>
<br>
<br>
-- <br>
Dr. Marco Hugentobler<br>
Sourcepole -  Linux & Open Source Solutions<br>
Weberstrasse 5, CH-8004 Zürich, Switzerland<br>
<a href="mailto:marco.hugentobler@sourcepole.ch" target="_blank">marco.hugentobler@sourcepole.<u></u>ch</a> <a href="http://www.sourcepole.ch" target="_blank">http://www.sourcepole.ch</a><br>
Technical Advisor QGIS Project Steering Committee<br>
<br>
</div></div></blockquote></div><br></div>