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

add row to qtablewidget with button

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 569 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 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
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on 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
      2
      • VRoninV VRonin

        you just forgot self. before table.insertRow

        D Offline
        D Offline
        DouglinhasZN
        wrote on 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

        • Login

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