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 add item to an existing QTableWidget?
QtWS25 Last Chance

How to add item to an existing QTableWidget?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 1.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.
  • T Offline
    T Offline
    tokafr
    wrote on last edited by
    #1

    Hello again!

    I have a tableWidget and I add data to it from input interface, I cannot add a new item at the next of the last item, How can I do it? how can I find the last position in the QTableWidget?

    thank you!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean rowCount() - 1 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tokafr
        wrote on last edited by
        #3

        No, it will work for QlistWidget, but for QTableWidget(X.Y) this is not enough. if I had QlistWidget also it would help me because
        X= listWidget.count()/tableWidget.columnCount() and
        Y = listWidget.count()%tableWidget.columnCount(); but I have only
        QtableWidget.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Looking for columnCount() too then?

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tokafr
            wrote on last edited by
            #5

            and I can do it by using nested for loop and check each cell if it's NULL or not, but that's not very good solution, I'm interested if there's any built in method

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tokafr
              wrote on last edited by
              #6

              Andre will it work if I have 10X4 table and the last item is set in the cell with position 4x2?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                Then, to me, it is not clear what you are after.

                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