Review Request 126851: Places data engine: Rename model role name "index" to "id"

Kai Uwe Broulik kde at privat.broulik.de
Sat Jan 23 13:36:48 UTC 2016



> On Jan. 23, 2016, 1:22 nachm., Kai Uwe Broulik wrote:
> > id isn't particularly better either as that's also a reserved QML keyword.
> > 
> > Also, you can access any role with a name clash by accessing it through "model", ie. model.index
> 
> Daniel Faust wrote:
>     id is the first thing that came to mind, of cause it could be called something else as well. (suggestions?)
>     
>     I know that I can access the model role through the model variable, but I want to access the ListView's index variable.

Right. Perhaps "itemIndex" / "placeIndex" instead? It also seems that "id" and "index" aren't the same thing? So we shouldn't just remove the one in favor of the other.


- Kai Uwe


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126851/#review91476
-----------------------------------------------------------


On Jan. 23, 2016, 1:14 nachm., Daniel Faust wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126851/
> -----------------------------------------------------------
> 
> (Updated Jan. 23, 2016, 1:14 nachm.)
> 
> 
> Review request for kde-workspace and Plasma.
> 
> 
> Repository: plasma-workspace
> 
> 
> Description
> -------
> 
> I wrote a qml applet using the places data engine and noticed that I can't access the index variable of ListView items because it gets overwritten by the places model.
> This patch renames the "index" role name to "id" in order to avoid this naming conflict.
> 
> 
> Diffs
> -----
> 
>   dataengines/places/org.kde.places.operations 98a951d 
>   dataengines/places/placeservice.cpp e0c93c5 
>   dataengines/places/placesproxymodel.h 467fe83 
>   dataengines/places/placesproxymodel.cpp 5ea807b 
> 
> Diff: https://git.reviewboard.kde.org/r/126851/diff/
> 
> 
> Testing
> -------
> 
> I couldn't find any other model that is using the places data engine so I hope renaming the model role is fine.
> The provided model still works and I tested the "Setup Device" and "Teardown Device" operations of the service.
> The operations "Show" and "Hide" don't seem to work anyway and the others were not tested.
> 
> 
> Thanks,
> 
> Daniel Faust
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160123/173cea4c/attachment-0001.html>


More information about the Plasma-devel mailing list