Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to fill a QSqlTableModel from dbf file
i need to fill a QSqlTableModel with data comming from dbf file
the question is i need to create a QSqlDatabase in memory
or can do in direct way and how ?
To parse the dbf file use Xbase:
Need the next step.
topse last edited by
You need a QSqlDatabase to use the QSqlTableModel. Do you have a database-driver compatible with XBase and QSqlDatabase?
This "thread":http://qt-project.org/forums/viewthread/8459 might help
Thanks for the reply.
The question is not about the driver to read the dbf file
I dont want to use Access Odbc o wherever.
Forget the source of data, think that i have a QList
The question is if i need to create a QSqlDatabase or if the QSqlTableModel
can work alone, and how fill it from the QList in a clasic while loop.
Yes you need to, as it names implies QSqlTableModel needs a database behind it. You can use an in memory sqlite database if you don't want to store things permanently.
Depending on your list content you can use e.g. QStringListModel or you can create your on own model that handles that list.
Thanks, now understand why I was trying to work alone and nothing hapen.
Now will research about the QStringListModel.