lundi 20 avril 2015

how to read and view tab-delimited txt files in Qt c++ using QTableView?

I need some general advice to point me in the correct direction of solving this problem: I have a .txt file with table data like the following:

Time    Pin
11:00   EIO4
12:55   EIO6
16:40   EIO4
20:10   EIO3

etc......

I need to be able to parse this .txt file. Then I need to display this table in Qt (perhaps in a QTableView).

I have looked into using QTableView, and it appears I pass a QAbstractModel* to the QTableView using QTableView::setModel(QAbstractModel* model), after which my QTableView will display whatever data is in the QAbstractModel (right?).

If that last paragraph was logical, then my next question is how do I construct a QAbstractModel using my .txt file? I don't see any functions in the documentation that do this?

Aucun commentaire:

Enregistrer un commentaire