I am trying to filter text files from a directory and read contents inside these text files using textEdit Widgets . I want to display each textEdit for each textfiles . Now I can print a textEdit with contents of a text file .Here is my approach.(fot 1 text file and 1 textEdit)
QString filename = QFileDialog::getOpenFileName(this,tr("Open File"),"All files(*.*)");
QFile file(filename);
file.open(QIODevice::ReadOnly);
QTextStream stream(&file);
QString content = stream.readAll();
file.close();
ui->textEdit->setPlainText(content);
Lets say there are 5 .txt files in my directory . I want to read all the contents in these .txt files with textbrowsers . I want to see 5 textbrowsers which show the contents of 5 .txt files .
Aucun commentaire:
Enregistrer un commentaire