Hi,
I have complete data read from a file in QTableWidget, now I want to save the QTableWidget as it is into a database and then use.
Thanks & regards
Manmohan
Hi,
I have complete data read from a file in QTableWidget, now I want to save the QTableWidget as it is into a database and then use.
Thanks & regards
Manmohan
That is maybe not the best way to do it.
Why not try the following approach:
create a database and table
create a QSqlTableModel and QSqlRecord for the model
read the file into a QTextStream
loop through the stream load the records
insert the data from the model into the table
Create a QTableView to display the data from the model
See the model/view programming doc here: http://doc.trolltech.com/4.5/model-v...ogramming.html
Header columns are not same all the time so its hard to read data and store in database table format. I wanted to create a data base which gets its no of columns by reading the file.
Then why not just read the first record in the file to see how many fields you need in the database table, then proceed to create the rest as above?
Bookmarks