[Qt-interest] How select next row in QTableView
Jesús Fernández Prieto
jsfdez at gmail.com
Wed Jun 17 16:39:37 CEST 2009
Try a piece of code like this:
{
//[...]
if(model->removeRow(row, parent))
{
row=(row<model->rowCount(parent) ? row : model->rowCount(parent)-1);
int column=model->columnCount(parent)-1;
QModelIndex topLeft=model->index(row, 0, parent);
QModelIndex bottomRight=model->index(row, column);
QItemSelection selection(topLeft, bottomRight);
QItemSelectionModel *selectionModel=new QItemSelectionModel(model);
selectionModel->select(selection);
}
//[...]
}
On Tue, Jun 16, 2009 at 9:42 PM, Marcelo Estanislau Geyer <
estanisgeyer at hotmail.com> wrote:
> Hi friends,
>
> How to select the next row of a QTableView/QSqlQueryModel? I need to delete
> a record from the database and then run the SQL command, but I want to
> position the cursor to select this next record (row).
>
> Thank you for your attention.
>
> Marcelo E. Geyer
>
> ------------------------------
> Novo Internet Explorer 8: mais rápido e muito mais seguro. Baixe agora, é
> grátis!<http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090617/92cc757c/attachment.html
More information about the Qt-interest-old
mailing list