How to select next row in QTableView programmatically



  • Hello
    i have QTableView subclass that im marking and saving its state with this :
    @connect(this,
    SIGNAL(clicked(const QModelIndex &)),
    this,
    SLOT(clickedRowHandler(const QModelIndex &))
    );

    void PlayListPlayerView::clickedRowHandler(const QModelIndex & index)
    {
    int iSelectedRow = index.row();
    QString link = index.model()->index(index.row(),0, index.parent()).data(Qt::UserRole).toString();
    emit UpdateApp(1,link );
    }@

    now i like programmatically to move the selection to the next row (not by pressing the row with the mouse)
    and invoking clickedRowHandler(...) how shell i do that ?
    Thanks



  • Did you try the setCurrentIndex() method?

    If that doesn't give you enough control, you should use the selectionModel() method to manipulate the associated [[doc:QItemSelectionModel]].


Log in to reply
 

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