1 Replies - 1491 Views - Last Post: 24 June 2016 - 02:53 PM

#1 Tafla  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 24-June 16

I need help on gui to load multiple text files one by one from folders

Posted 24 June 2016 - 02:29 PM

My plan is to develop a gui program that can read all text files on the same directory but on different folders and file names.
for example I have files like
F1= some files with columns and rows
F2= other files with columns and rows
and so on up to Fn
How can I read these files by one one until... Fn by entering only the file names on the GUI button?
I have this program below , but it can read only one file at a time( the only file which I specify its file name on the code).
can any one help me please?
Thanks

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFile>
#include <QTextStream>
#include <QMessageBox>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::on_pushButton_clicked()
{
QFile file(":/Final/Training_location1_hammer_2.txt");

if(!file.open(QFileDevice::ReadOnly))

QMessageBox::information(0,"No!",file.errorString());


QTextStream in(&file);

ui->textBrowser->setText(in.readAll());


}

Is This A Good Question/Topic? 0
  • +

Replies To: I need help on gui to load multiple text files one by one from folders

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13656
  • View blog
  • Posts: 54,487
  • Joined: 12-June 08

Re: I need help on gui to load multiple text files one by one from folders

Posted 24 June 2016 - 02:53 PM

Seriously, stop creating duplicate topics. Closing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1