Editor: add log for printing

Task-number: QTCREATORBUG-24110
Change-Id: Ic4fef2e268cf3adf852a3ce7b229cb98356bbc5e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2020-08-14 10:40:33 +02:00
parent e6c063f877
commit 462a0f5b5d

View File

@@ -96,6 +96,7 @@
#include <QFutureWatcher>
#include <QGridLayout>
#include <QKeyEvent>
#include <QLoggingCategory>
#include <QMap>
#include <QMenu>
#include <QMessageBox>
@@ -1147,6 +1148,8 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc,
painter->restore();
}
Q_LOGGING_CATEGORY(printLog, "qtc.editor.print", QtWarningMsg)
void TextEditorWidgetPrivate::print(QPrinter *printer)
{
QTextDocument *doc = q->document();
@@ -1256,6 +1259,13 @@ void TextEditorWidgetPrivate::print(QPrinter *printer)
ascending = false;
}
qCDebug(printLog) << "Printing " << m_document->filePath() << ":\n"
<< " number of copies:" << printer->numCopies() << '\n'
<< " from page" << fromPage << "to" << toPage << '\n'
<< " document page count:" << doc->pageCount() << '\n'
<< " page rectangle:" << pageRect << '\n'
<< " title box:" << titleBox << '\n';
for (int i = 0; i < docCopies; ++i) {
int page = fromPage;