Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    How to select next row in QTableView programmatically

    General and Desktop
    2
    2
    3992
    Loading More Posts
    • 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
      umen242 last edited by

      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 Reply Quote 0
      • A
        andre last edited by

        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 Reply Quote 0
        • First post
          Last post