From 2ca87eebc02549277d229ccd2fd8e8789b284a1a Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Mon, 29 Oct 2018 22:05:34 +0100 Subject: [PATCH] Print hello-world dummy document --- source/mainwindow.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source/mainwindow.cpp b/source/mainwindow.cpp index ad4d72d..ce4e36f 100644 --- a/source/mainwindow.cpp +++ b/source/mainwindow.cpp @@ -12,6 +12,8 @@ #include #include #include +#include + #include MainWindow::MainWindow(QWidget *parent) @@ -136,7 +138,20 @@ void MainWindow::print() const QPrinter printer; QPrintDialog dialog(&printer); - dialog.exec(); + if (dialog.exec() != QDialog::Accepted) + { + return; + } + + QTextDocument printDoc; + printDoc.setHtml( + "" + "" + "

Hello World

" + "" + ""); + + printDoc.print(&printer); } void MainWindow::dataModelChanged()