Some QTextDocument things

This commit is contained in:
Nicolas Mailloux 2021-06-11 19:33:51 -04:00
parent 6ad18aaba7
commit 8d1ec95161
2 changed files with 13 additions and 3 deletions

View file

@ -16,7 +16,7 @@
#include <QDirIterator>
#include <QDebug>
#include <QTextDocument>
#include <QTextCodec>
#include <QSizeF>
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() {

View file

@ -6,6 +6,7 @@
#include "generaldialog.h"
#include <QWidget>
#include <QTextDocument>
using namespace std;
@ -96,6 +97,7 @@ private:
Ui::reader *ui;
alert *alertWindow;
generalDialog *generalDialogWindow;
QTextDocument *textDocument;
};
#endif // READER_H