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/printsupport | |
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/printsupport')
4 files changed, 0 insertions, 55 deletions
diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp index c2bd2872a9..808424b1ed 100644 --- a/src/plugins/printsupport/cups/qppdprintdevice.cpp +++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp @@ -89,16 +89,6 @@ QPpdPrintDevice::QPpdPrintDevice(const QString &id) } } -QPpdPrintDevice::QPpdPrintDevice(const QPpdPrintDevice &other) - : QPlatformPrintDevice(other), - m_cupsDest(0), - m_ppd(0) -{ - m_cupsName = other.m_cupsName; - m_cupsInstance = other.m_cupsInstance; - loadPrinter(); -} - QPpdPrintDevice::~QPpdPrintDevice() { if (m_ppd) @@ -109,20 +99,6 @@ QPpdPrintDevice::~QPpdPrintDevice() m_ppd = 0; } -QPpdPrintDevice &QPpdPrintDevice::operator=(const QPpdPrintDevice &other) -{ - m_cupsName = other.m_cupsName; - m_cupsInstance = other.m_cupsInstance; - if (other.m_cupsDest && other.m_ppd) - loadPrinter(); - return *this; -} - -bool QPpdPrintDevice::operator==(const QPpdPrintDevice &other) const -{ - return (m_id == other.m_id); -} - bool QPpdPrintDevice::isValid() const { return m_cupsDest && m_ppd; diff --git a/src/plugins/printsupport/cups/qppdprintdevice.h b/src/plugins/printsupport/cups/qppdprintdevice.h index 0d618192fe..5ebcf39566 100644 --- a/src/plugins/printsupport/cups/qppdprintdevice.h +++ b/src/plugins/printsupport/cups/qppdprintdevice.h @@ -59,15 +59,8 @@ class QPpdPrintDevice : public QPlatformPrintDevice public: QPpdPrintDevice(); explicit QPpdPrintDevice(const QString &id); - QPpdPrintDevice(const QPpdPrintDevice &other); virtual ~QPpdPrintDevice(); - QPpdPrintDevice &operator=(const QPpdPrintDevice &other); - - QPpdPrintDevice *clone(); - - bool operator==(const QPpdPrintDevice &other) const; - bool isValid() const Q_DECL_OVERRIDE; bool isDefault() const Q_DECL_OVERRIDE; diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp index af8e07edd2..505f3138ca 100644 --- a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp +++ b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp @@ -113,28 +113,11 @@ QWindowsPrintDevice::QWindowsPrintDevice(const QString &id) } } -QWindowsPrintDevice::QWindowsPrintDevice(const QWindowsPrintDevice &other) - : QPlatformPrintDevice(other) -{ - OpenPrinter((LPWSTR)other.m_id.utf16(), &m_hPrinter, NULL); -} - QWindowsPrintDevice::~QWindowsPrintDevice() { ClosePrinter(m_hPrinter); } -QWindowsPrintDevice &QWindowsPrintDevice::operator=(const QWindowsPrintDevice &other) -{ - OpenPrinter((LPWSTR)other.m_id.utf16(), &m_hPrinter, NULL); - return *this; -} - -bool QWindowsPrintDevice::operator==(const QWindowsPrintDevice &other) const -{ - return (m_id == other.m_id); -} - bool QWindowsPrintDevice::isValid() const { return m_hPrinter; diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.h b/src/plugins/printsupport/windows/qwindowsprintdevice.h index 2e0f6e4658..8ab487a59c 100644 --- a/src/plugins/printsupport/windows/qwindowsprintdevice.h +++ b/src/plugins/printsupport/windows/qwindowsprintdevice.h @@ -58,15 +58,8 @@ class QWindowsPrintDevice : public QPlatformPrintDevice public: QWindowsPrintDevice(); explicit QWindowsPrintDevice(const QString &id); - QWindowsPrintDevice(const QWindowsPrintDevice &other); virtual ~QWindowsPrintDevice(); - QWindowsPrintDevice &operator=(const QWindowsPrintDevice &other); - - QWindowsPrintDevice *clone(); - - bool operator==(const QWindowsPrintDevice &other) const; - bool isValid() const Q_DECL_OVERRIDE; bool isDefault() const Q_DECL_OVERRIDE; |