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

David Heremans david.heremans at intersoft-electronics.com
Fri Aug 5 14:34:38 CEST 2011


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





More information about the Qt-interest-old mailing list