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?

How to go a particular cell within Qtablewidget?

Scheduled Pinned Locked Moved Solved General and Desktop
qtablewidgetcellfocus
3 Posts 2 Posters 3.7k 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.
  • PabloArgP Offline
    PabloArgP Offline
    PabloArg
    wrote on 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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      1 Reply Last reply
      1
      • PabloArgP Offline
        PabloArgP Offline
        PabloArg
        wrote on 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

        • Login

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