[Kde-pim] RR: Add additional parameter to EntityTreeModel::entityData()
Stephen Kelly
steveire at gmail.com
Thu Dec 17 10:53:03 GMT 2009
David Jarvie wrote:
> On Wednesday 16 Dec 2009 19:54:18 Tobias Koenig wrote:
>> On Wed, Dec 16, 2009 at 07:28:05PM -0000, David Jarvie wrote:
>> Hej,
>>
>> > In KAlarm, when it overrides EntityTreeModel::entityData(const Item&,
>> > ...), it needs to know which collection the Item belongs to.
>> What's wrong with item.parentCollection()?
>
> I hadn't spotted that method. But what if an item is in virtual
> collections as well - I need to know which collection is its parent in the
> model.
>
the entityData methods are just for convenience. As you have a special use
case, I recommend that you override ::data instead.
You can then get the Item and ParentCollection from the index parameter
passed into that. The ParentCollectionRole should give you the parent
Collection whether it's virtual or not.
All the best,
Steve.
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list