Merge pull request #13 from mandlm/develop

Print hello-world dummy document
feature/qt-as-conan-package
mandlm 2018-10-29 21:04:30 +01:00 committed by GitHub
commit 5e01ad1498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -12,6 +12,8 @@
#include <QMessageBox>
#include <QtPrintSupport/QPrinter>
#include <QtPrintSupport/QPrintDialog>
#include <QTextDocument>
#include <QDebug>
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(
"<html>"
"<body>"
"<h2>Hello World</h2>"
"</body>"
"</hthml>");
printDoc.print(&printer);
}
void MainWindow::dataModelChanged()