-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
54 lines (36 loc) · 942 Bytes
/
mainwindow.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
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QString>
#include <QDebug>
#include <QFileDialog>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
box = new QMessageBox(this);
tree_model = new TreeModel(this, ui->treeWidget);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QString file_name = QFileDialog::getOpenFileName(this, "Выбрать файл");
QFile file(file_name);
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
qDebug() << "File didn't open";
} else {
ui->treeWidget->clear();
tree_model->GetInput(file);
file.close();
}
}
void MainWindow::on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
{
if(!item->isDisabled()){
box->setText(item->whatsThis(column));
box->exec();
}
}