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. add row to qtablewidget with button
Forum Updated to NodeBB v4.3 + New Features

add row to qtablewidget with button

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 528 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.
  • D Offline
    D Offline
    DouglinhasZN
    wrote on 13 May 2020, 18:48 last edited by
    #1

    Hello,
    I want to add an empty row that the user will use to add as much row as he wants.
    The key thing is, the rows have to be empty. I haven't been able to do this with the following code:

        def add_row(self):
            rowPosition = self.table.rowCount()
            table.insertRow(rowPosition)
    

    I get this error:

    <class 'NameError'> name 'table' is not defined <traceback object at 0x000001D8286B4940>
    
    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 13 May 2020, 18:52 last edited by
      #2

      you just forgot self. before table.insertRow

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      D 1 Reply Last reply 13 May 2020, 18:59
      2
      • V VRonin
        13 May 2020, 18:52

        you just forgot self. before table.insertRow

        D Offline
        D Offline
        DouglinhasZN
        wrote on 13 May 2020, 18:59 last edited by
        #3

        @VRonin I cant believe I made this rookie mistake. Thank you so much. Cant believe it lol

        1 Reply Last reply
        0

        3/3

        13 May 2020, 18:59

        • Login

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