Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to find the number of entered cells in QTableWidget



  • Hi, I'm using Pyqt5.I made a table with 100 rows and 2 columns by using QTableWidget.
    The rows are user defined. Not all rows have to be used but the rows entered must be entered in order. If the user will use 5 rows, she/he must fill in from the 1st to the 5th rows.
    There should be no rows skipped in between

    With which code I can find out how many rows of the table are used.
    I'm wondering how many rows are active in the table ?
    I entered 5 rows out of 100 rows. I want to know that 5 rows are used or I entered 27 rows out of 100 rows I should retrieve "27 rows " .
    rowCount or selectedIndexes are not useful , I've tried many things. Answer can be very easy but I'm confused. If you have any experience, can you share with me ?
    Thank you for your attention.



  • https://doc.qt.io/qt-5/qtablewidget.html#cellChanged could be part of a solution, along with tracking each edited cell in a set.
    Another alternative is https://doc.qt.io/qt-5/qtablewidget.html#findItems using a regular expression match.


Log in to reply