How to go a particular cell within Qtablewidget?



  • Hi, I have a parent form who has a Qtablewidget, "this one was created not using a model".

    I insert data in that Qtablewidget calling a child form, the data is added correctly at the row "N".

    But when I assign the focus to the Qtablewidget, this is positioned at row 0. And I want set the focus in the row "N".

    Someone can help me as going to the desired row.


  • Qt Champions 2016

    hi
    maybe
    ui->tableWidget->selectRow( ROW_NUMBER ); ?



  • I solved it,
    ui->tableWidget->setFocus();
    ui->tableWidget->setCurrentCell(N-1,0);

    The problem that I was confused, because the first row is 0 not "1". So when I insert a row N, I will have a total rows = N - 1.

    So, my problem was an error of positioning.

    Thanks Guys!!.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.