-
Notifications
You must be signed in to change notification settings - Fork 0
/
debugwindow.cpp
43 lines (37 loc) · 958 Bytes
/
debugwindow.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
#include "debugwindow.h"
#include "ui_debugwindow.h"
#include <QFileSystemWatcher>
#include <QFile>
#include <QTextStream>
#include <QDebug>
#include <QPixmap>
#include <QDir>
DebugWindow::DebugWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::DebugWindow)
{
ui->setupUi(this);
debug_watcher = new QFileSystemWatcher(this);
debug_watcher->addPath("../Qt_interface/resources/data/debug.txt");
connect(debug_watcher, SIGNAL(fileChanged(QString)), this, SLOT(readdebug()));
}
DebugWindow::~DebugWindow()
{
delete ui;
}
void DebugWindow::on_debugclose_clicked()
{
DebugWindow::close();
}
void DebugWindow::readdebug()
{
qDebug("fuck");
QFile file("../Qt_interface/resources/data/debug.txt");
if (!file.open(QFile::ReadOnly | QFile::Text)){
qDebug() << "couldnt read file";
}
QTextStream in(&file);
QString text = in.readAll();
ui->debugtextbrowser->setText(text);
file.close();
}