Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to select next row in QTableView programmatically
Forum Updated to NodeBB v4.3 + New Features

How to select next row in QTableView programmatically

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on 13 Mar 2012, 03:53 last edited by
    #1

    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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 13 Mar 2012, 08:19 last edited by
      #2

      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]].

      1 Reply Last reply
      0

      2/2

      13 Mar 2012, 08:19

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved