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 go a particular cell within Qtablewidget?
QtWS25 Last Chance

How to go a particular cell within Qtablewidget?

Scheduled Pinned Locked Moved Solved General and Desktop
qtablewidgetcellfocus
3 Posts 2 Posters 3.6k Views
  • 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.
  • P Offline
    P Offline
    PabloArg
    wrote on 17 May 2016, 12:43 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 17 May 2016, 12:53 last edited by
      #2

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

      1 Reply Last reply
      1
      • P Offline
        P Offline
        PabloArg
        wrote on 17 May 2016, 13:54 last edited by
        #3

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

        1 Reply Last reply
        1

        2/3

        17 May 2016, 12:53

        • Login

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