Given that strHTMLtext was populated with HTML code earlier:
QFont f
("TypeWriter",
10);
editor->setHtml(strHTMLtext);
editor->setCurrentFont(f);
this->setCursor(Qt::ArrowCursor);
if (dlg
->exec
() == QDialog::Accepted) document->print(&printer);
ui.leStatus->setText("Report completed!");
delete dlg;
delete editor;
QFont f("TypeWriter",10);
QTextEdit *editor = new QTextEdit(this);
editor->setHtml(strHTMLtext);
editor->setCurrentFont(f);
QTextDocument *document = editor->document();
QPrinter printer;
this->setCursor(Qt::ArrowCursor);
QApplication::processEvents();
QPrintDialog *dlg = new QPrintDialog(&printer,this);
if (dlg->exec() == QDialog::Accepted)
document->print(&printer);
ui.leStatus->setText("Report completed!");
delete dlg;
delete editor;
To copy to clipboard, switch view to plain text mode
Bookmarks