Hi,
I don't mean this to be a double post, so please forgive me if I should have added this to my last thread.
I have a model derived from QAbstractTabelModel, this is used with a QTableView. To sort the data in the table, I used the following :
m_pModel = new DACanTreeModel();
m_proxyModel->setDynamicSortFilter(true);
m_proxyModel->setSourceModel(m_pModel);
list << "ECU" << "Signal" << "Signal Data" << "Real value" << "Unit" << "Count";
m_pModel->setHeaders( list );
ui.canTreeView->setSortingEnabled( true );
ui.canTreeView->setModel( m_proxyModel);
m_pModel = new DACanTreeModel();
m_proxyModel = new QSortFilterProxyModel(this);
m_proxyModel->setDynamicSortFilter(true);
m_proxyModel->setSourceModel(m_pModel);
QStringList list;
list << "ECU" << "Signal" << "Signal Data" << "Real value" << "Unit" << "Count";
m_pModel->setHeaders( list );
ui.canTreeView->setSortingEnabled( true );
ui.canTreeView->setModel( m_proxyModel);
To copy to clipboard, switch view to plain text mode
For some reason, data is now not being shown in the table view unless I click on the column headers and when I do, a crash occurs, is the above code wrong? If I set the views model to m_pModel, the data appears, but I cannot sort it.
Thanks,
Steve
Bookmarks