Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How to add item to an existing QTableWidget?

    General and Desktop
    3
    7
    1284
    Loading More Posts
    • 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
      tokafr last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • T
          tokafr last edited by

          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 Reply Quote 0
          • A
            andre last edited by

            Looking for columnCount() too then?

            1 Reply Last reply Reply Quote 0
            • T
              tokafr last edited by

              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 Reply Quote 0
              • T
                tokafr last edited by

                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 Reply Quote 0
                • A
                  andre last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post