summaryrefslogtreecommitdiffstats
path: root/examples/widgets/richtext
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/richtext')
-rw-r--r--examples/widgets/richtext/orderform/mainwindow.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/widgets/richtext/orderform/mainwindow.cpp b/examples/widgets/richtext/orderform/mainwindow.cpp
index 4334e8bb71..e6e7e3bd6f 100644
--- a/examples/widgets/richtext/orderform/mainwindow.cpp
+++ b/examples/widgets/richtext/orderform/mainwindow.cpp
@@ -240,12 +240,13 @@ void MainWindow::printFile()
//! [18]
QPrinter printer;
- QPrintDialog *dialog = new QPrintDialog(&printer, this);
- dialog->setWindowTitle(tr("Print Document"));
+ QPrintDialog dialog(&printer, this);
+ dialog.setWindowTitle(tr("Print Document"));
if (editor->textCursor().hasSelection())
- dialog->addEnabledOption(QAbstractPrintDialog::PrintSelection);
- if (dialog->exec() != QDialog::Accepted)
+ dialog.addEnabledOption(QAbstractPrintDialog::PrintSelection);
+ if (dialog.exec() != QDialog::Accepted) {
return;
+ }
//! [18]
editor->print(&printer);