-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialog.cpp
41 lines (29 loc) · 838 Bytes
/
dialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "dialog.h"
#include "ui_dialog.h"
#include"widget.h"
#include"ui_widget.h"
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
connect(ui->pushButton_close,SIGNAL(clicked()),this,SLOT(close())); //to close second window
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_Read_clicked()
{
getTextFile(); //calling function to import file
}
//getting input textfile.
void Dialog::getTextFile()
{
QFile myFile(":/to_user.txt");
myFile.open(QIODevice::ReadOnly); //Textfile opening and reading.
QTextStream textStream(&myFile);
QString line=textStream.readAll(); //Storing textfile in line variable.
myFile.close();
ui->textEdit->setPlainText(line); //Getting the content of the text file in the textedit area of the window.
}