Nominate our 2022 Qt Champions!

QsqlTableModel.removeRow() erase row content

  • Hi All,
    (This is my first discussion, so forgive me if i made some posting mistakes).

    I am using QSqlTableModel to populate a QTableView with data from MySql table, this works fine, calling model.removeRow() method returns True and the selected row verticalHeaderDate changed to "!" which is fine, but the row content is erased on the view (cells become blank).

    mw = QMainWindow()

    model = QSqlTableModel(None, connectionManager().getConnection())
    tv = QTableView(mw)
    bt = QPushButton("Delete", mw)
    bt.clicked.connect(lambda: model.removeRow(tv.currentIndex().row()))


    Extra Informations:

    • Calling submitAll() works as expected.
    • I am using python2.7 with PyQt 4.9.4
    • This problem arise just after updating PyQt 4.8.5 to 4.9.4
    • I tried to install Python, PyQt (latest Versions) to a new machine, but the problem is persist.

    Appreciate any kind of help.

Log in to reply