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).

    Code
    @
    mw = QMainWindow()

    model = QSqlTableModel(None, connectionManager().getConnection())
    model.setTable("vouchertypes")
    model.setEditStrategy(model.OnManualSubmit)
    model.select()
    
    tv = QTableView(mw)
    tv.setModel(model)
    
    bt = QPushButton("Delete", mw)
    bt.clicked.connect(lambda: model.removeRow(tv.currentIndex().row()))
    mw.show()
    

    @

    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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.