umen
4th July 2011, 14:10
hi
im trying to get text and data from column in index number 0 from row that is selected
but i never get the right data im using simple model view treeview with QSortFilterProxyModel proxy to sort the columns and QStandardItemModel as the model
this is the slot function that is triggered on each doubleClicked
connect(ui.treeView_mainwindow, SIGNAL(doubleClicked( const QModelIndex &)), this,SLOT(tree_itemClicked( const QModelIndex &)));
....
...
void MainWindowContainer::tree_itemClicked(const QModelIndex & index)
{
int iSelectedRow = index.row();
QString groupID;
QString groupName;
groupID = m_model->item(iSelectedRow,0)->data(Qt::UserRole).toString();
groupName = m_model->item(iSelectedRow,0)->text();
}
im trying to get text and data from column in index number 0 from row that is selected
but i never get the right data im using simple model view treeview with QSortFilterProxyModel proxy to sort the columns and QStandardItemModel as the model
this is the slot function that is triggered on each doubleClicked
connect(ui.treeView_mainwindow, SIGNAL(doubleClicked( const QModelIndex &)), this,SLOT(tree_itemClicked( const QModelIndex &)));
....
...
void MainWindowContainer::tree_itemClicked(const QModelIndex & index)
{
int iSelectedRow = index.row();
QString groupID;
QString groupName;
groupID = m_model->item(iSelectedRow,0)->data(Qt::UserRole).toString();
groupName = m_model->item(iSelectedRow,0)->text();
}