[Qt-interest] how to reorder in different tree.

Alan Ezust alan.ezust at gmail.com
Fri Aug 5 15:44:56 CEST 2011


The QSortFilterProxyModel might be what you need. It already has sorting
capabilities.
You just need to define a way to compare items in your model and point the
proxy model to your original model,
and point the view to the proxy.


On Fri, Aug 5, 2011 at 5:34 AM, David Heremans <
david.heremans at intersoft-electronics.com> wrote:

> Hello,
>
> I throw this in the group in the hope that somebody can provide my with
> some 'best practices' tips.
>
> The problem: I have designed a data model that looks a little like the
> output of a Linux "pstree" command. It is a tree view showing the
> parent/child relations between some objects/processes and in the columns
> I show extra info like the CPU, process owner,...
> This is nicely displayed in a TreeView.
>
> Now the need arises to show this info as a collapsed tree view but with
> the process owner as the items that expand&collapse to reveal the
> objects/processes.
>
> Does anybody have some good recommendations on how to handle this?
> I was thinking about creating a second model containing Persistent
> modelindexes towards the current model but were I insert/delete rows
> based upon the events from my original model. Or is there a better way
> to rewrite/redesign the original model? I had a quick look at the
> QSortFilterProxyModel but these do not seem to be appropriate to
> rearrange a tree structure.
>
> Any hints are greatly appreciated....
>
> rgds,
>
> David H
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110805/a68b1a4c/attachment.html 


More information about the Qt-interest-old mailing list