Alright, for understanding the principle I stripped my model class to this:
def __init__(self, db_file, mode):
super().__init__()
print(db_file)
self.db.setDatabaseName("start.db")
self.setTable("VOCABULARY")
self.select()
print(self.rowCount())
class model(QSqlTableModel):
def __init__(self, db_file, mode):
super().__init__()
self.db = QSqlDatabase.addDatabase('QSQLITE')
print(db_file)
self.db.setDatabaseName("start.db")
self.setEditStrategy(QSqlRelationalTableModel.OnFieldChange)
self.setTable("VOCABULARY")
self.select()
print(self.rowCount())
To copy to clipboard, switch view to plain text mode
I also removed all the constraints from the database.
But The Row Count is showing 0, and the treeview is still empty. There should be exactly 1 row in the table.
Bookmarks