Hi All

On a QWidget I've displayed a QTreeView and QTabWidget. They both have the same QAbstractItemModel as source model and the idea is to view the treestructure in the treeview but let the user modify the individual items in the QTabWidget where the items are also shown. Basically exactly the same as in C++ GUI Programming with Qt 4, the staff manager example (relevant section starts p.324).

Everything works according to plan but QDataWidgetMapper will only display items from the QTreeView column 0 so only top level treeitems are displayed in the QDataWidgetMapper.

I initiate the QDataWidgetMapper with;
Qt Code:
  1. mapper->setModel(mytreemodel);
  2. mapper->setRootIndex(myTreeView->rootIndex() );
  3.  
  4. //connect model to mapper
  5. connect(myTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
  6. mapper, SLOT(setCurrentModelIndex(QModelIndex)));
To copy to clipboard, switch view to plain text mode 

With this setup only top nodes will be displayed! I've tried with

Qt Code:
  1. connect(myTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
  2. mapper, SLOT(setCurrentModelIndex(QModelIndex)));
To copy to clipboard, switch view to plain text mode 
and
Qt Code:
  1. connect(myTreeView->selectionModel(), SIGNAL(currentColumnChanged(QModelIndex,QModelIndex)),
  2. mapper, SLOT(setCurrentModelIndex(QModelIndex)));
To copy to clipboard, switch view to plain text mode 

and both of them at the same time but no luck.

Any idea out there how I can get the QDataWidgetMapper to change with the QTreeView selection change?

Thanks