[Interest] Problem understanding QAbstractProxyModel::mapFromSource and displaying summary data from a model
h
hdixon at bigpond.net.au
Thu Jul 19 01:09:52 CEST 2012
On Wed, 18 Jul 2012 15:53:54 Tony Rietwyk wrote:
> > Sent: Wednesday, 18 July 2012 2:28 PM
> >
> > Hi,
> >
> > I am writing an app in which I am wanting to display my data in a
> > number
>
> of
>
> > different ways. (Currently QT4.8 on linux, but will also run it on
>
> windows, if
>
> > this is relevant!)
> >
> > As an example what I have is a set of tuples with two field, say Name
> > and
> > Hours
> >
> > I have this working with table view and am able to access and edit the
>
> data.
>
> > What I want is a not editable view of the data which shows the total of
>
> all the
>
> > Hours for each Name.
--snip--
> > With thanks,
> > Hugh
>
> Hi,
>
> I think QAbstractProxyModel only applies when there IS a direct mapping
> between the elements of each model, that maintains their identity.
>
> You need a model with an element for each group (or grouping level), that
> listens for the changes in the source model and adjusts the group's summary,
> then signals the change for that one group.
>
> The QML VisualDataModel component looks like it has grouping capabilities.
> Maybe you can get some ideas from its implementation?
>
> Hope that helps,
>
> Tony.
>
Hi,
Thanks for the response. I have not developed great QML skills yet so nothing
is jumping out at me, but will continue to investigate this.
I am thinking I will extend my data class to be an aggregation holding
multiple QAbstractProxyModels and handle the different changes there.
Hugh
More information about the Interest
mailing list