From: Bradley T. Hughes Date: Mon, 31 Oct 2011 13:10:52 +0000 (+0100) Subject: Move QPrinter::init() to QPrinterPrivate::init() X-Git-Tag: qt-v5.0.0-alpha1~2962 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fde3b2e93c1e5462660e84503a2370372de69bf3;p=profile%2Fivi%2Fqtbase.git Move QPrinter::init() to QPrinterPrivate::init() This method is private, and only called from the QPrinter constructor. This also removes warnings about overloading the virtual QPaintDevice::init() method interitted form QWidget: ../../include/QtPrintSupport/../../src/printsupport/kernel/qprinter.h:259:10: warning: 'QPrinter::init' hides overloaded virtual function [-Woverloaded- void init(PrinterMode mode); ^ ../../include/QtGui/../../src/gui/painting/qpaintdevice.h:93:18: note: hidden overloaded virtual function 'QPaintDevice::init' declared here virtual void init(QPainter *painter) const; ^ Change-Id: I7c5203a1264b0ad825ed4075b66017fef22a40fb Reviewed-by: Bradley T. Hughes Reviewed-by: David Faure Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart --- diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index d748bbd..252ebd1 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -549,7 +549,7 @@ QPrinter::QPrinter(PrinterMode mode) : QPagedPaintDevice(), d_ptr(new QPrinterPrivate(this)) { - init(mode); + d_ptr->init(mode); QPrinterInfo defPrn(QPrinterInfo::defaultPrinter()); if (!defPrn.isNull()) { setPrinterName(defPrn.printerName()); @@ -569,11 +569,11 @@ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode) : QPagedPaintDevice(), d_ptr(new QPrinterPrivate(this)) { - init(mode); + d_ptr->init(mode); setPrinterName(printer.printerName()); } -void QPrinter::init(PrinterMode mode) +void QPrinterPrivate::init(QPrinter::PrinterMode mode) { #if !defined(Q_WS_X11) if (!QCoreApplication::instance()) { @@ -583,22 +583,21 @@ void QPrinter::init(PrinterMode mode) qFatal("QPrinter: Must construct a QApplication before a QPaintDevice"); return; } - Q_D(QPrinter); - d->printerMode = mode; - d->outputFormat = QPrinter::NativeFormat; - d->createDefaultEngines(); + printerMode = mode; + outputFormat = QPrinter::NativeFormat; + createDefaultEngines(); #ifndef QT_NO_PRINTPREVIEWWIDGET - d->previewEngine = 0; + previewEngine = 0; #endif - d->realPrintEngine = 0; - d->realPaintEngine = 0; + realPrintEngine = 0; + realPaintEngine = 0; #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) if (QCUPSSupport::cupsVersion() >= 10200 && QCUPSSupport().currentPPD()) { - setOutputFormat(QPrinter::PdfFormat); - d->outputFormat = QPrinter::NativeFormat; + q_func()->setOutputFormat(QPrinter::PdfFormat); + outputFormat = QPrinter::NativeFormat; } #endif } diff --git a/src/printsupport/kernel/qprinter.h b/src/printsupport/kernel/qprinter.h index 7d04099..f09a4cc 100644 --- a/src/printsupport/kernel/qprinter.h +++ b/src/printsupport/kernel/qprinter.h @@ -256,8 +256,6 @@ protected: void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine); private: - void init(PrinterMode mode); - Q_DISABLE_COPY(QPrinter) QScopedPointer d_ptr; diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h index 08877f0..362202f 100644 --- a/src/printsupport/kernel/qprinter_p.h +++ b/src/printsupport/kernel/qprinter_p.h @@ -90,6 +90,8 @@ public: } + void init(QPrinter::PrinterMode mode); + void createDefaultEngines(); #ifndef QT_NO_PRINTPREVIEWWIDGET QList previewPages() const;