/srv/irclogs.ubuntu.com/2015/07/30/#ubuntu-app-devel.txt

=== chriadam|away is now known as chriadam
kongsuhello05:26
=== chihchun_afk is now known as chihchun
dholbachgood morning06:54
=== chriadam is now known as chriadam|away
=== chihchun is now known as chihchun_afk
=== chihchun_afk is now known as chihchun
=== _salem is now known as salem_
=== chihchun is now known as chihchun_afk
=== chihchun_afk is now known as chihchun
=== JanC_ is now known as JanC
didrockszsombi: hey, small question about delegates in listView vs refering by id. I had an leading and trailing actions defined within the component itself. However, reading the documentation, for perf reason, you say rightly to put them at outside14:21
didrockslike at https://developer.ubuntu.com/api/apps/qml/sdk-15.04/Ubuntu.Components.ListItemActions/14:21
didrocksso, I tried to do that in bhttp://paste.ubuntu.com/11966640/, but I can't access to the item attached to this delegate14:21
didrocksvalue is indeed the index, but I want to access through that index to the correct delegated item14:22
zsombididrocks: there's no item attached to a delegate14:22
zsombididrocks: you cannot do that14:22
zsombididrocks: the thing is that those items are cached, and disappear whjen you scroll out14:22
zsombididrocks: I am checking what are you doing... but I don't get it14:24
zsombididrocks: contentItem is a single item, not an array14:24
didrockszsombi: basically, I want when clicking on "edit" to run a function() on the delegated object14:24
zsombididrocks: and it contains all the list items visible at a time... + the cached ones14:24
zsombidelegated object?14:24
zsombididrocks: why woudl you do that?14:25
didrockszsombi: BillListItem content14:25
didrockszsombi: before, it was inlined14:25
didrocks(before looking at your perf comment in the doc)14:25
zsombididrocks: why everyone wants to rape ListView?14:26
didrocksrape?14:26
zsombididrocks: ListView visualizes a model, you shoudl work on models not on the items, the delegates only visualize the model, they should never do more14:26
zsombididrocks: so if you want too much on a ListItem, you are designing your app wrongly14:27
zsombididrocks: beside, listview.contentItem[value] is just wrong14:27
didrockszsombi: so, basically, you mean that edit() just call the edit on the model? that doesn't sound like controller separated from model14:27
zsombididrocks: ListView.contentItem is a single item, not an array, you cannot access the visible list items like that14:28
didrocksgot that14:28
zsombididrocks: then, actions do get the index, so they can do whatever is needed based on that14:28
zsombiyou can do whaveter you want wit separate functions, preferably on the action level, so mbased on the model data and the index you can do your magic14:29
zsombinot saying that the edit should be on teh model, but it should be separated from teh delegate (which is btw a Compinent, from which ListView creates the items)14:30
zsombididrocks: so what you should do is to have this function either in the action, which does turn on some whatever page or whatever it is needed to edit the model data from the index14:31
zsombior to have this function somewhere else, but definitely not in the listview's delegate14:31
didrockszsombi: so, let's say I implement this edit() on another handler14:31
didrockszsombi: now,  in the ListView, I want that a long press to call this edit() as well, you would pass the handler to each ref?14:32
zsombididrocks: by handler you mean in a different module?14:33
zsombior in a different document?14:33
didrocksdifferent document14:33
zsombididrocks: so this handler would be a page?14:34
zsombididrocks: if it is, you use a PAgeStack, then you push the new page with the parameters you need14:34
zsombididrocks: in the action you can reference the ListView.model, right?14:34
zsombididrocks: if the model has a get funtion (like ListModel does) then you simply pass the entire model.get(value) as parameter to the push function14:35
bregmafolks, I'm looking for information on help apps proposed for the Unity 8 environment -- are there plans or something in the works?14:36
didrockszsombi: right, but it means that the ListItem will have a reference to the handler to call that function on long press event forinstance14:36
didrockszsombi: it has some from the model, of course, but it adds another coupling?14:37
zsombididrocks: thats' why I asked what a handler is, a Page you want to open, or what?14:37
zsombididrocks: beside, now you want long press, in your sample you have trailing actions :)14:37
didrockszsombi: no, it's another Component { function edit() { /* do stuff */ }}14:38
zsombididrocks: component...14:38
didrockszsombi: this is just an example for something where the event is in the ListEvent14:38
didrocksListItem*14:38
zsombididrocks: a Component cannot have anything else but an item in it...14:38
zsombididrocks: or you meant Item {....}14:38
didrockszsombi: ok, sorry for being a qml newbie, but I think you got what I meant14:38
didrocksso yeah, an Item { }14:39
zsombididrocks: that's why I'm asking, in orde rto drive you I need to know what you want :)14:39
didrocksso, I have an Item { function edit(model, value) { /* do stuff with model, value */ }}  being a controller14:40
didrocks(or model being data-bound)14:40
zsombididrocks: so, if this handler component (i.e. QtObject { id: handler; function edit(data) {...}}) is in teh same document as the ListView, then you can give the whole data to the edit14:40
zsombididrocks: like ListItem.onPressAndHold: handler.edit(modelData)14:41
didrocksok, so I need to data-bound to all ListItem elements the handler?14:41
didrocks(so that they can act on it)14:41
zsombididrocks: if you want it in the Action, then if you know the model id, and if the model has the get() function, you can do the following: Action.onTriggered: handler.edit(theListItemModel.get(value))14:42
didrockszsombi: yeah, which is quite easy because the Action is outside of the ListItem/ListView (and just attached), but I think you meant that for the listItem I just pass the whole handler object as a property binding (and then, use the modelData)14:44
zsombididrocks: you never pass whole objects in QML :)14:45
didrocksref*14:45
zsombididrocks: the same woudl be if you'd have the Actions inside the ListView btw14:45
didrockswell, you pass the reference, right?14:45
didrocks(so I guess a pointer)14:45
zsombididrocks: when you use Actions, you should think that these, on right click, appear in teh context menu of the ListItem14:45
zsombididrocks: yes14:45
zsombididrocks: and, what you pass to the edit() is the content that is visualized by the ListItem14:46
didrockszsombi: hum, let's take back that edit() method being on the ListItem (the edit() acts on the model anyway)14:47
didrocksshouldn't I would be able in my case to directly call then:14:48
didrocksonTriggered: edit()14:48
didrocks?14:48
zsombididrocks: onTriggered being the Action's one?14:48
didrocksyeah14:48
didrocksthat's the first thing I tried14:48
zsombididrocks: the Action being in the trailing?14:48
didrocksyep14:48
zsombior leading?14:49
zsombiok14:49
didrockstrailing14:49
didrocksbut doesn't matter I guess14:49
zsombididrocks: so, if you check what I've said before, the Action part applies to it14:49
didrocksI would have thought that would call the edit() method on the ListItem element that has this trailing attached14:49
didrocks(as it's in context)14:49
zsombididrocks: these actions - as said - will also be in the menu, so the menu won't necessarily be in the ListItem, right?14:50
zsombididrocks: so the Action cannot be linked to the ListItem14:50
zsombionly14:50
didrockszsombi: it's not attached to a menu in that case, so only to a ListItem, but it's not executed in context of the ListItem right? Otherwise edit() would be accessible as it's a function on my ListItem14:51
zsombididrocks: you need to know on what model the action has been triggered, and only if the value parameter is not invalid14:51
zsombididrocks: it will be shown in the menu context menu of the ListItem as well14:51
didrocksah, that's what you mean by "content"14:51
didrockscontext*14:52
zsombididrocks: and as Actions are generic, you don't know where these can be used14:52
didrocksgot it14:52
zsombis/can/are14:52
didrocksI thought you told that the Item would be in context14:52
didrocksyeah, ok, that's why I misunderstood your last part :)14:52
zsombididrocks: so, the Actions you give there do not have a clue on what "context" are they used atm14:52
zsombii.e a ListItem, Menu, Button, CheckBox, etc14:52
zsombior even in the Header...14:53
didrocksok, making sense14:53
zsombididrocks: value is the only thing that drives you, it can be an integer, a string, whatever14:53
didrocksyeah, it's the index of the model, right? (index which can be a hash key)14:54
zsombididrocks: so if value is defined, then you can assume (as you are the app developer ;) ) that it was triggered from the known ListView, so the model can also be accessed, and then get() function, and you have the whole data you need in place14:54
zsombiyes14:54
didrockszsombi: ok, I think I understood how to properly implement it now. Many thanks!14:55
zsombididrocks: yw :)14:55
=== chihchun is now known as chihchun_afk
=== Pici` is now known as Pici
mihirhey popey18:57
mihirpopey: i have reviews some of MP from Gray and kunal.19:30
mihirWhen  you have talk with Gray , could you ask him to revert pot file changes ?19:30
mihirfrom that , the MP becomes too large in terms of lines and fie changes , which is not neccery19:31
mihirpopey: ^19:31
mihirGood night.19:31
=== chihchunl is now known as chihchun
=== cwayne- is now known as cwayne
=== salem_ is now known as _salem

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!