[PyQt] QsqlTableModel.removeRow() erase row content
engdarkman89
darkman20050 at hotmail.com
Mon Aug 6 10:36:33 BST 2012
Hi All,
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-1
* This problem arise just after updating PyQt 4.8.5 to 4.9.4-1
* I tried to install Python, PyQt (latest Versions) to a new machine, but
the problem is persist.
Appreciate any kind of help.
--
View this message in context: http://python.6.n6.nabble.com/QsqlTableModel-removeRow-erase-row-content-tp4984208.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt
mailing list