Load text file to tableview
Hello everyone,
I have a problem with loading the data from the file into the control tableview. For now, I created a function that has to load data from a file.
Code:
void example
::load(const QString &file
) {
p+=file;
if (!filein.
open(QFile::ReadOnly)) qDebug(Error couldn't open file: %s",qPrintable(file));
double p1;
QTextStream stream(&filein);
while (!filein.atEnd())
{
stream>>p1;
}
stream.readLine() ;
}
Tableview indicator added to the form, and now i want the data to be loaded when you start the application.
Re: Load text file to tableview
Easiest way is to populate a QStandardItemModel with your data and then set this as the model on the view.
Cheers,
_
Re: Load text file to tableview
You can give an example of such a table?
Re: Load text file to tableview
The documentation for QStandardItemModel has one.
Cheers,
_