Merge pull request #13 from mandlm/develop
Print hello-world dummy document
This commit is contained in:
commit
5e01ad1498
@ -12,6 +12,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QtPrintSupport/QPrinter>
|
#include <QtPrintSupport/QPrinter>
|
||||||
#include <QtPrintSupport/QPrintDialog>
|
#include <QtPrintSupport/QPrintDialog>
|
||||||
|
#include <QTextDocument>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
@ -136,7 +138,20 @@ void MainWindow::print() const
|
|||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
|
|
||||||
QPrintDialog dialog(&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()
|
void MainWindow::dataModelChanged()
|
||||||
|
Reference in New Issue
Block a user