Skip to content

Commit

Permalink
QcPenPrinter: no need to allocate QPrintDialog on heap
Browse files Browse the repository at this point in the history
  • Loading branch information
lijon committed Dec 5, 2011
1 parent 91a2cdb commit 9e6e6da
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions QtCollider/widgets/QcPenPrinter.h
Expand Up @@ -59,20 +59,19 @@ class QcPenPrinter : public QObject
private Q_SLOTS:

void show() {
QPrintDialog *dialog = new QPrintDialog(&printer);
QPrintDialog dialog(&printer);

dialog->setWindowTitle( QString("Print Document") );
dialog->setOptions (
dialog.setWindowTitle( QString("Print Document") );
dialog.setOptions (
QAbstractPrintDialog::PrintToFile |
QAbstractPrintDialog::PrintPageRange |
QAbstractPrintDialog::PrintShowPageSize
);
if (dialog->exec() != QDialog::Accepted) {
if (dialog.exec() != QDialog::Accepted) {
Q_EMIT( cancel() );
} else {
Q_EMIT( ok() );
}
delete dialog;
}

void print() {
Expand Down

0 comments on commit 9e6e6da

Please sign in to comment.