From 8d1ec951618d16550c33c9426a1d105e820d39f3 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Fri, 11 Jun 2021 19:33:51 -0400 Subject: [PATCH] Some QTextDocument things --- reader.cpp | 14 +++++++++++--- reader.h | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/reader.cpp b/reader.cpp index 23e3d8c..356ae47 100644 --- a/reader.cpp +++ b/reader.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include using namespace std; @@ -29,8 +29,7 @@ reader::reader(QWidget *parent) : global::battery::showCriticalBatteryAlert = true; // QTextDocument - QTextDocument *text = new QTextDocument(); - + QTextDocument *textDocument = new QTextDocument(); ui->setupUi(this); ui->previousBtn->setProperty("type", "borderless"); @@ -507,6 +506,15 @@ int reader::setup_book(QString book) { bookFile.close(); ittext = content; + textDocument->setHtml(content); + + // Getting the screen's size + float sW = QGuiApplication::screens()[0]->size().width(); + float sH = QGuiApplication::screens()[0]->size().height(); + QSizeF textDocumentSize(sW, sH); + textDocument->setPageSize(textDocumentSize); + + return 0; } void reader::checkwords() { diff --git a/reader.h b/reader.h index 756f720..1443690 100644 --- a/reader.h +++ b/reader.h @@ -6,6 +6,7 @@ #include "generaldialog.h" #include +#include using namespace std; @@ -96,6 +97,7 @@ private: Ui::reader *ui; alert *alertWindow; generalDialog *generalDialogWindow; + QTextDocument *textDocument; }; #endif // READER_H