[Qt-interest] How to just show tree model _leaf nodes_ in a table view?

Patricia Santana Cruz patriciasc at openismus.com
Mon Apr 4 10:53:34 CEST 2011


Hello everybody,

I have a tree model that I am using as the master model, and two proxy
models (a tree proxy model and a table proxy model) that set this master
model as their source model. On the other hand I have a tree view using
the tree proxy model and a table view using the table proxy model (see
attached picture).

The structure of my tree looks like follows:
--------
| Root |
--------
    |
    |__Year1
    |  |
    |  |__Week1
    |  |  |
    |  |  |__Day1
    |  |     |
    |  |     |_Task1
    |  |     |
    |  |     |_Task2
    |  |     |
    |  |     |_Task3
    |  |
    |  |__Week2
    |     |
    |     |__Day1
    |     |  |
    |     |  |_Task1
    |     |
    |     |__Day2  
    |
    |__Year2
       |
       |__Week1
          |
          |__Day1
             |
             |_Task1
             |
             |_Task2
             |
             |_Task3

As you see, all the leaf-nodes are tasks. I would like that every time I
click an item in the tree view, all its _leaf nodes_ and just the _leaf
nodes_ are displayed in the table view. Example:
Click on Year1: Task1, Task2, Task3 and Task1.
Click on Year1->Week1: Task1, Task2 and Task3.
Click on Year1->Week2->Day1: Task1.

Currently, I am connecting the 'clicked' signal on the tree view with
'setRootIndex()' on the table view, so I am getting the following
results:
Click on Year1: Week1 and Week2.
Click on Year1->Week2: Day1 and Day2.
Click on Year1->Week1->Day1: Task1, Task2 and Task3.

How could I get just the _leaf nodes_ for all the other elements (year
and week) as I explained?

Thank you in advance,
Patricia.

-- 
patriciasc at openismus.com
http://psconboard.blogspot.com/
www.openismus.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: output.png
Type: image/png
Size: 10893 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110404/5f4f472d/attachment.png 


More information about the Qt-interest-old mailing list