Browse files

QcPenPrinter: no need to allocate QPrintDialog on heap

  • Loading branch information...
1 parent 91a2cdb commit 9e6e6daaa0196a4e4a6d94404174987f30972174 @lijon lijon committed Dec 5, 2011
Showing with 4 additions and 5 deletions.
  1. +4 −5 QtCollider/widgets/QcPenPrinter.h
View
9 QtCollider/widgets/QcPenPrinter.h
@@ -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() {

0 comments on commit 9e6e6da

Please sign in to comment.