Yes, I've tried:
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!"),
}
}
void frmTitoli::funModifica()
{
QModelIndexList selection = ui.tvView->selectionModel()->selectedRows(0);
QItemSelection rowSel = ui.tvView->selectionModel()->selection();
if (!selection.empty())
{
QModelIndex idIndex = selection.at(0);
int id = idIndex.data().toInt();
ui.tvView->hide();
...
ui.tvView->show();
refreshView();
ui.tvView->setFocus();
ui.tvView->selectionModel()->setCurrentIndex(idIndex, QItemSelectionModel::SelectCurrent);
ui.tvView->selectionModel()->select(rowSel, QItemSelectionModel::SelectCurrent);
}
else
{
QMessageBox::warning(this, tr("Attenzione!"),
tr("Selezionare prima un elemento nella lista!"),
QMessageBox::Ok);
}
}
To copy to clipboard, switch view to plain text mode
but it doesn't work
Bookmarks