diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-04-22 13:50:21 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-05-05 14:06:27 +0000 |
commit | a6bcdf151647ab7a97c9fe1d2c8c8dd2b718244e (patch) | |
tree | c9d2194926ea28e83a18c61ebab3b3d1e75e8932 /src/plugins/platforms/cocoa/qprintengine_mac.mm | |
parent | 7c6b6876aa8841a56a6571c6a039c67a5d649bdb (diff) |
Clean up API of QPlatformPrintDevice (QPA).
The class inherited QSharedData, had a non-virtual clone() function and
a non-virtual operator==() which compared QPlatformPrintDevice::id().
Derived classes implemented clone() and operator==() comparing ids
to no effect. The class does not have any setters modifying its values,
so detaching, copying and assigning does not make sense.
Remove the inheritance, clone(), and operator==() and make the class
a non-copyable base class. Use a QSharedPointer instead of
a QSharedDataPointer to store it in QPrintDevice.
Remove copy constructors and clone() reimplementations that were never
called in implementations.
Found while investigating QTBUG-44991.
Task-number: QTBUG-44991
Change-Id: Ib79354b37048d04d50d936f1d0ae06c36efaac00
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qprintengine_mac.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qprintengine_mac.mm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index 348b537691..9e8fe8f1c8 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -50,7 +50,7 @@ QMacPrintEngine::QMacPrintEngine(QPrinter::PrinterMode mode) : QPaintEngine(*(ne { Q_D(QMacPrintEngine); d->mode = mode; - d->m_printDevice = new QCocoaPrintDevice(QCocoaPrinterSupport().defaultPrintDeviceId()); + d->m_printDevice.reset(new QCocoaPrintDevice(QCocoaPrinterSupport().defaultPrintDeviceId())); d->m_pageLayout.setPageSize(d->m_printDevice->defaultPageSize()); d->initialize(); } @@ -558,7 +558,7 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va id = QCocoaPrinterSupport().defaultPrintDeviceId(); else if (!QCocoaPrinterSupport().availablePrintDeviceIds().contains(id)) break; - d->m_printDevice = new QCocoaPrintDevice(id); + d->m_printDevice.reset(new QCocoaPrintDevice(id)); PMPrinter printer = d->m_printDevice->macPrinter(); PMRetain(printer); PMSessionSetCurrentPMPrinter(d->session(), printer); |