//! [0] QPrintDialog printDialog(printer, parent); if (printDialog.exec() == QDialog::Accepted) { // print ... } //! [0]