-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeorywindow.cpp
More file actions
36 lines (28 loc) · 1.13 KB
/
theorywindow.cpp
File metadata and controls
36 lines (28 loc) · 1.13 KB
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
#include "theorywindow.h"
#include "ui_theorywindow.h"
TheoryWindow::TheoryWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::TheoryWindow)
{
ui->setupUi(this);
DisplayTheoryFile();
}
TheoryWindow::~TheoryWindow()
{
delete ui;
}
void TheoryWindow::DisplayTheoryFile()
{
// - Получаем путь к файлу с теорией из менеджера файлов (FileManager.h)
FileManager FManager;
QString TheoryFile_PATH = FManager.TheoryFile_PATH;
// - Загружаме файл по полученному пути
QFile TheoryFile(TheoryFile_PATH);
// - Если с файлом что-то случилось (например пользователь удалил), то вызвать окно с ошибкой
if(!TheoryFile.open(QIODevice::ReadOnly))
QMessageBox::information(0, "info", TheoryFile.errorString());
// - Читаем весь файл и выводим в TextBox
const QString Theory = QString::fromLocal8Bit(TheoryFile.readAll());
ui -> TheoryDisplayBox -> setOpenExternalLinks(true);
ui -> TheoryDisplayBox -> setHtml(Theory);
}