highlight a selected row in a QTreeView without clicking on it
Hi to all,
I'm using a QTreeView to list items, I hide the QTreeView after a row selection and then show it setting correctly the current index but I don't know how to highlight the row. The following it has been my attempt (rows 18-19):
Code:
void frmTitoli::funModifica()
{
QModelIndexList selection = ui.tvView->selectionModel()->selectedRows(0);
if (!selection.empty())
{
int id = idIndex.data().toInt();
ui.tvView->hide();
...
ui.tvView->show();
refreshView();
ui.tvView->setFocus();
}
else
{
tr("Selezionare prima un elemento nella lista!"),
}
}
Thanks!!!
Re: highlight a selected row in a QTreeView without clicking on it
Re: highlight a selected row in a QTreeView without clicking on it
Yes, I've tried:
Code:
void frmTitoli::funModifica()
{
QModelIndexList selection = ui.tvView->selectionModel()->selectedRows(0);
if (!selection.empty())
{
int id = idIndex.data().toInt();
ui.tvView->hide();
...
ui.tvView->show();
refreshView();
ui.tvView->setFocus();
}
else
{
tr("Selezionare prima un elemento nella lista!"),
}
}
but it doesn't work :(
Re: highlight a selected row in a QTreeView without clicking on it
Did you ever get this working?
How did you do it?
Thanks.