通过将QSqlRecord插入QSqlTableModel时出现问题
record = self.tablemodel.record()
record.setValue('originfile_path', filepath)
record.setValue('originfile_hash', filehash)
record.setValue('image', img_pkl)
record.setValue('area', area)
self.tablemodel.insertRecord(-1, record)
插入的记录在QTableView中显示为带有感叹号的空白记录。它被插入到数据库中-关闭并重新打开应用程序会导致记录正常显示。
发布于 2018-06-08 05:24:59
尝试更改您的编辑策略:
tablemodel.setEditStrategy(QSqlTableModel::OnManualSubmit);
https://stackoverflow.com/questions/42319333
复制相似问题