PDA

View Full Version : QAbstractTableModel and 2 different QTableView (remap one row to one column)



darth vader
8th May 2012, 22:09
Hi,

I have a QAbstractTableModel with one QSortFilterProxyModel connected to a QTableView.
Now I want that if a user clicks on one row (any horizontal item) of the QTableView another QTableView is showing additional data of the QAbstractTableModel. Both QTableViews are editable and should correctly set the model data.

So far I connected

connect(fileTableView, SIGNAL(clicked(QModelIndex)), this, SLOT(onFileClicked(QModelIndex)));

In onFileClicked I save the clicked row to be used later.

void MyClass::onFileClicked(const QModelIndex& index)
{
myModel->setClickedRow(index);
}

I then used another QSortFilterProxyModel for the 2nd table and tried to reimplement mapFromSource(), but with no success.
Has anybody an idea how to design the desired behaviour?

Thanks Darth